Mercurial > public > ostc4
annotate Discovery/Src/settings.c @ 768:dfdfea8897f3
1.6.2 release
author | heinrichsweikamp |
---|---|
date | Thu, 13 Apr 2023 09:35:43 +0200 |
parents | da8126d5ea9f |
children | 45b8f3c2acce |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/settings.c | |
5 /// \brief settingsHelperButtonSens_translate_hwOS_values_to_percentage. | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 6-March-2017 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 #include <string.h> | |
765
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
30 #include <stdbool.h> |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
31 |
38 | 32 #include "settings.h" |
33 #include "firmwareEraseProgram.h" // for HARDWAREDATA_ADDRESS | |
34 #include "externLogbookFlash.h" // for SAMPLESTART and SAMPLESTOP | |
35 #include "text_multilanguage.h" // for LANGUAGE_END | |
36 #include "tHome.h" // for CVIEW_END | |
389
ebc2b571a0b9
Fix case for case sensitive OS
Jan Mulder <jan@jlmulder.nl>
parents:
382
diff
changeset
|
37 #include "motion.h" |
443
a5101c688b49
Introduced enum for lower left corner view selection:
ideenmodellierer
parents:
439
diff
changeset
|
38 #include "t7.h" |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
39 #include "data_central.h" |
38 | 40 |
662 | 41 static uint8_t settingsWarning = 0; /* Active if setting values have been corrected */ |
42 | |
38 | 43 SSettings Settings; |
44 | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
45 const uint8_t RTErequiredHigh = 3; |
762 | 46 const uint8_t RTErequiredLow = 1; |
38 | 47 |
75 | 48 const uint8_t FONTrequiredHigh = 1; |
49 const uint8_t FONTrequiredLow = 0; | |
38 | 50 |
51 uint8_t RTEactualHigh = 0; | |
52 uint8_t RTEactualLow = 0; | |
53 | |
54 // =============================================================================== | |
55 // SFirmwareData FirmwareData | |
56 /// @brief internal counter is for changes after last release | |
57 /// use date and info as well for this purpose | |
58 /// | |
59 // =============================================================================== | |
60 | |
61 const SFirmwareData firmware_FirmwareData __attribute__( (section(".firmware_firmware_data")) ) = | |
62 { | |
63 .versionFirst = 1, | |
695 | 64 .versionSecond = 6, |
762 | 65 .versionThird = 2, |
66 .versionBeta = 0, | |
38 | 67 |
68 /* 4 bytes with trailing 0 */ | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
48
diff
changeset
|
69 .signature = "mh", |
38 | 70 |
762 | 71 .release_year = 23, |
768 | 72 .release_month = 4, |
73 .release_day = 13, | |
38 | 74 .release_sub = 0, |
75 | |
76 /* max 48 with trailing 0 */ | |
77 //release_info ="12345678901234567890123456789012345678901" | |
286
733877ab87d9
Minor: Some Texts fixed, allign RTErequired* values with RTE firmware
heinrichsweikamp
parents:
274
diff
changeset
|
78 .release_info ="gcc_2nd", |
38 | 79 |
80 /* for safety reasons and coming functions */ | |
81 .magic[0] = FIRMWARE_MAGIC_FIRST, | |
82 .magic[1] = FIRMWARE_MAGIC_SECOND, | |
83 .magic[2] = FIRMWARE_MAGIC_FIRMWARE, /* the magic byte */ | |
84 .magic[3] = FIRMWARE_MAGIC_END | |
85 }; | |
86 | |
87 | |
88 /* always adjust check_and_correct_settings() accordingly | |
89 * There might even be entries with fixed values that have no range | |
90 */ | |
91 const SSettings SettingsStandard = { | |
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
92 .header = 0xFFFF0025, |
38 | 93 .warning_blink_dsec = 8 * 2, |
94 .lastDiveLogId = 0, | |
662 | 95 .logFlashNextSampleStartAddress = SAMPLESTART, |
38 | 96 |
97 .gas[0].oxygen_percentage = 21, | |
98 .gas[1].oxygen_percentage = 21, | |
99 .gas[2].oxygen_percentage = 21, | |
100 .gas[3].oxygen_percentage = 21, | |
101 .gas[4].oxygen_percentage = 21, | |
102 .gas[5].oxygen_percentage = 21, | |
103 .gas[6].oxygen_percentage = 21, | |
104 .gas[7].oxygen_percentage = 21, | |
105 .gas[8].oxygen_percentage = 21, | |
106 .gas[9].oxygen_percentage = 21, | |
107 .gas[10].oxygen_percentage = 21, | |
108 .gas[0].helium_percentage = 0, | |
109 .gas[1].helium_percentage = 0, | |
110 .gas[2].helium_percentage = 0, | |
111 .gas[3].helium_percentage = 0, | |
112 .gas[4].helium_percentage = 0, | |
113 .gas[5].helium_percentage = 0, | |
114 .gas[6].helium_percentage = 0, | |
115 .gas[7].helium_percentage = 0, | |
116 .gas[8].helium_percentage = 0, | |
117 .gas[9].helium_percentage = 0, | |
118 .gas[10].helium_percentage = 0, | |
119 .gas[0].depth_meter = 0, | |
120 .gas[1].depth_meter = 0, | |
121 .gas[2].depth_meter = 0, | |
122 .gas[3].depth_meter = 0, | |
123 .gas[4].depth_meter = 0, | |
124 .gas[5].depth_meter = 0, | |
125 .gas[6].depth_meter = 0, | |
126 .gas[7].depth_meter = 0, | |
127 .gas[8].depth_meter = 0, | |
128 .gas[9].depth_meter = 0, | |
129 .gas[10].depth_meter = 0, | |
130 .gas[0].depth_meter_travel = 0, | |
131 .gas[1].depth_meter_travel = 0, | |
132 .gas[2].depth_meter_travel = 0, | |
133 .gas[3].depth_meter_travel = 0, | |
134 .gas[4].depth_meter_travel = 0, | |
135 .gas[5].depth_meter_travel = 0, | |
136 .gas[6].depth_meter_travel = 0, | |
137 .gas[7].depth_meter_travel = 0, | |
138 .gas[8].depth_meter_travel = 0, | |
139 .gas[9].depth_meter_travel = 0, | |
140 .gas[10].depth_meter_travel = 0, | |
141 .gas[0].note.uw = 0, | |
142 .gas[1].note.ub.first = 1, | |
143 .gas[1].note.ub.active = 1, | |
144 .gas[1].note.ub.deco = 0, | |
145 .gas[1].note.ub.travel = 0, | |
146 .gas[2].note.uw = 0, | |
147 .gas[3].note.uw = 0, | |
148 .gas[4].note.uw = 0, | |
149 .gas[5].note.uw = 0, | |
150 .gas[6].note.ub.first = 1, | |
151 .gas[6].note.ub.active = 1, | |
152 .gas[6].note.ub.deco = 0, | |
153 .gas[6].note.ub.travel = 0, | |
154 .gas[7].note.uw = 0, | |
155 .gas[8].note.uw = 0, | |
156 .gas[9].note.uw = 0, | |
157 .gas[10].note.uw = 0, | |
158 .gas[0].bottle_size_liter = 0, | |
159 .gas[1].bottle_size_liter = 0, | |
160 .gas[2].bottle_size_liter = 0, | |
161 .gas[3].bottle_size_liter = 0, | |
162 .gas[4].bottle_size_liter = 0, | |
163 .gas[5].bottle_size_liter = 0, | |
164 .gas[6].bottle_size_liter = 0, | |
165 .gas[7].bottle_size_liter = 0, | |
166 .gas[8].bottle_size_liter = 0, | |
167 .gas[9].bottle_size_liter = 0, | |
168 .gas[10].bottle_size_liter = 0, | |
169 /* | |
170 .gas[0].bottle_wireless_status = 0, | |
171 .gas[1].bottle_wireless_status = 0, | |
172 .gas[2].bottle_wireless_status = 0, | |
173 .gas[3].bottle_wireless_status = 0, | |
174 .gas[4].bottle_wireless_status = 0, | |
175 .gas[5].bottle_wireless_status = 0, | |
176 .gas[6].bottle_wireless_status = 0, | |
177 .gas[7].bottle_wireless_status = 0, | |
178 .gas[8].bottle_wireless_status = 0, | |
179 .gas[9].bottle_wireless_status = 0, | |
180 .gas[10].bottle_wireless_status = 0, | |
181 */ | |
182 .gas[0].bottle_wireless_id = 0, | |
183 .gas[1].bottle_wireless_id = 0, | |
184 .gas[2].bottle_wireless_id = 0, | |
185 .gas[3].bottle_wireless_id = 0, | |
186 .gas[4].bottle_wireless_id = 0, | |
187 .gas[5].bottle_wireless_id = 0, | |
188 .gas[6].bottle_wireless_id = 0, | |
189 .gas[7].bottle_wireless_id = 0, | |
190 .gas[8].bottle_wireless_id = 0, | |
191 .gas[9].bottle_wireless_id = 0, | |
192 .gas[10].bottle_wireless_id = 0, | |
193 .setpoint[0].setpoint_cbar = 100, | |
194 .setpoint[1].setpoint_cbar = 70, | |
195 .setpoint[2].setpoint_cbar = 90, | |
196 .setpoint[3].setpoint_cbar = 100, | |
197 .setpoint[4].setpoint_cbar = 120, | |
198 .setpoint[5].setpoint_cbar = 140, | |
199 .setpoint[0].depth_meter = 0, | |
200 .setpoint[1].depth_meter = 0, | |
201 .setpoint[2].depth_meter = 0, | |
202 .setpoint[3].depth_meter = 0, | |
203 .setpoint[4].depth_meter = 0, | |
204 .setpoint[5].depth_meter = 0, | |
205 .setpoint[0].note.uw = 0, | |
206 .setpoint[1].note.ub.active = 1, | |
207 .setpoint[1].note.ub.first = 1, | |
208 .setpoint[2].note.ub.active = 1, | |
209 .setpoint[2].note.ub.first = 0, | |
210 .setpoint[3].note.ub.active = 1, | |
211 .setpoint[3].note.ub.first = 0, | |
212 .setpoint[4].note.ub.active = 1, | |
213 .setpoint[4].note.ub.first = 0, | |
214 .setpoint[5].note.ub.active = 1, | |
215 .setpoint[5].note.ub.first = 0, | |
216 | |
217 .CCR_Mode = CCRMODE_Sensors, | |
218 .dive_mode = DIVEMODE_OC, | |
219 .deco_type.ub.standard = GF_MODE, | |
220 .deco_type.ub.alternative = GF_MODE, | |
221 .ppO2_max_deco = 160, | |
222 .ppO2_max_std = 140, | |
223 .ppO2_min = 15, | |
224 .CNS_max = 90, | |
225 .ascent_MeterPerMinute_max = 30, | |
662 | 226 .ascent_MeterPerMinute_showGraph = 30, |
38 | 227 .future_TTS = 5, |
228 .GF_high = 85, | |
229 .GF_low = 30, | |
230 .aGF_high = 95, | |
231 .aGF_low = 95, | |
232 .VPM_conservatism.ub.standard = 2, | |
233 .VPM_conservatism.ub.alternative = 0, | |
234 .safetystopDuration = 1, | |
235 .AtemMinutenVolumenLiter = 25, | |
236 .ReserveFractionDenominator = 4, | |
237 .salinity = 0, | |
238 .last_stop_depth_meter = 3, | |
239 .stop_increment_depth_meter = 3, | |
240 .brightness = 1, | |
241 .date_format = DDMMYY, | |
242 .selected_language = 0, /* 0 = LANGUAGE_English */ | |
243 .customtext = " <your name>\n" " <address>", | |
244 .timeoutSurfacemode = 120, | |
245 .timeoutMenuSurface = 120,//240, | |
246 .timeoutMenuDive = 120,//20, | |
247 .timeoutMenuEdit = 120,//40, | |
248 .timeoutInfo = 120,//60, | |
249 .timeoutInfoCompass = 60, | |
250 .design = 7, | |
251 .timeoutDiveReachedZeroDepth = 300, | |
252 .divetimeToCreateLogbook = 60, | |
253 .serialHigh = 0, | |
254 .serialLow = 2, | |
255 /* | |
256 .firmwareVersion16to32bit.ub.first = 0, | |
257 .firmwareVersion16to32bit.ub.second = 6, | |
258 .firmwareVersion16to32bit.ub.third = 0, | |
259 .firmwareVersion16to32bit.ub.betaFlag = 0, | |
260 */ | |
261 .backup_localtime_rtc_tr = 0, | |
262 .backup_localtime_rtc_dr = 0, | |
263 .totalDiveCounter = 0, | |
264 .personalDiveCount = 0, | |
265 .showDebugInfo = 0, | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
266 .ButtonResponsiveness[0] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306 |
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
267 .ButtonResponsiveness[1] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306 |
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
268 .ButtonResponsiveness[2] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306 |
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
269 .ButtonResponsiveness[3] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306 |
38 | 270 .nonMetricalSystem = 0, |
271 .fallbackToFixedSetpoint = 1, | |
272 .bluetoothActive = 0, | |
273 .safetystopDepth = 5, | |
274 .updateSettingsAllowedFromHeader = 0xFFFF0002, | |
662 | 275 .pscr_lung_ratio = 10, |
276 .pscr_o2_drop = 4, | |
277 .co2_sensor_active = 0, | |
38 | 278 .ppo2sensors_deactivated = 0, |
279 .tX_colorscheme = 0, | |
443
a5101c688b49
Introduced enum for lower left corner view selection:
ideenmodellierer
parents:
439
diff
changeset
|
280 .tX_userselectedLeftLowerCornerPrimary = LLC_Temperature, |
38 | 281 .tX_userselectedLeftLowerCornerTimeout = 0, |
282 .tX_customViewPrimary = 1, | |
283 .tX_customViewTimeout = 0, | |
284 .timeoutEnterButtonSelectDive = 10, | |
285 .logbookOffset = 0, | |
286 .alwaysShowPPO2 = 0, | |
287 .extraDisplay = EXTRADISPLAY_BIGFONT, | |
288 .display_toogle_desc = 200, | |
289 .offsetPressure_mbar = 0, | |
290 .offsetTemperature_centigrad = 0, | |
291 .gasConsumption_travel_l_min = 30, | |
292 .gasConsumption_bottom_l_min = 30, | |
293 .gasConsumption_deco_l_min = 20, | |
294 .debugModeOnStart = 0, | |
295 .compassBearing = 0, | |
296 .lastKnownBatteryPercentage = 0, | |
297 .buttonBalance[0] = 3, | |
298 .buttonBalance[1] = 3, | |
299 .buttonBalance[2] = 3, | |
300 .firmwareVersion[0] = 0,//FirmwareData.firmwareVersion16to32bit.ub.first, | |
301 .firmwareVersion[1] = 0,//FirmwareData.firmwareVersion16to32bit.ub.second, | |
302 .firmwareVersion[2] = 0,//FirmwareData.firmwareVersion16to32bit.ub.third, | |
303 .firmwareVersion[3] = 0,//FirmwareData.firmwareVersion16to32bit.ub.betaFlag, | |
304 .timeoutSurfacemodeWithSensors = 600, | |
305 .VPM_model = 0, | |
306 .GF_model = 0, | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
307 .FactoryButtonBase = DEFAULT_BUTTONRESPONSIVENESS_GUI, |
38 | 308 .FactoryButtonBalance[0] = 3, |
309 .FactoryButtonBalance[1] = 3, | |
310 .FactoryButtonBalance[2] = 3, | |
111
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
311 .FlipDisplay = 0, |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
172
diff
changeset
|
312 .cv_configuration = 0xFFFFFFFF, |
375
4bb5ceebfaf9
Use Enum values for initialization and setting check:
ideenmodellierer
parents:
372
diff
changeset
|
313 .MotionDetection = MOTION_DETECT_OFF, |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
492
diff
changeset
|
314 .cv_config_BigScreen = 0xFFFFFFFF, |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
315 .compassInertia = 0, |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
316 .tX_customViewPrimaryBF = CVIEW_T3_Decostop, |
546 | 317 .viewPortMode = 0, |
318 .viewRoll = 0, | |
319 .viewPitch = 0, | |
320 .viewYaw = 0, | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
321 .ppo2sensors_source = 0, |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
322 .ppo2sensors_calibCoeff[0] = 0.0, |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
323 .ppo2sensors_calibCoeff[1] = 0.0, |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
324 .ppo2sensors_calibCoeff[2] = 0.0, |
567 | 325 .amPMTime = 0, |
650 | 326 .autoSetpoint = 0, |
710 | 327 .scrubTimerMax_Obsolete = 0, |
328 .scrubTimerCur_Obsolete = 0, | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
329 .scrubTimerMode = SCRUB_TIMER_OFF, |
733 | 330 .ext_sensor_map[0] = SENSOR_OPTIC, |
331 .ext_sensor_map[1] = SENSOR_OPTIC, | |
332 .ext_sensor_map[2] = SENSOR_OPTIC, | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
333 .ext_sensor_map[3] = SENSOR_NONE, |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
334 .ext_sensor_map[4] = SENSOR_NONE, |
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
335 .buttonLockActive = 0 |
38 | 336 }; |
337 | |
338 /* Private function prototypes -----------------------------------------------*/ | |
339 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to); | |
340 | |
341 /* Functions -----------------------------------------------------------------*/ | |
342 | |
343 | |
344 // =============================================================================== | |
345 // set_new_settings_missing_in_ext_flash | |
346 /// @brief Add all the new setting variables of this version | |
347 /// or/and change what has changed in the meantime | |
348 /// | |
349 /// Additionally update the serial number if written via bluetooth | |
350 /// | |
351 // =============================================================================== | |
352 void set_new_settings_missing_in_ext_flash(void) | |
353 { | |
354 // never delete this part setting the serial | |
355 if(hardwareDataGetPointer()->secondarySerial != 0xFFFF) | |
356 { | |
357 settingsGetPointer()->serialHigh = (hardwareDataGetPointer()->secondarySerial / 256); | |
358 settingsGetPointer()->serialLow = (hardwareDataGetPointer()->secondarySerial & 0xFF); | |
359 } | |
360 else | |
361 if(hardwareDataGetPointer()->primarySerial != 0xFFFF) | |
362 { | |
363 settingsGetPointer()->serialHigh = (hardwareDataGetPointer()->primarySerial / 256); | |
364 settingsGetPointer()->serialLow = (hardwareDataGetPointer()->primarySerial & 0xFF); | |
365 } | |
366 else | |
367 { | |
368 settingsGetPointer()->serialHigh = 0; | |
369 settingsGetPointer()->serialLow = 0; | |
370 } | |
371 | |
372 settingsGetPointer()->firmwareVersion[0] = firmware_FirmwareData.versionFirst; | |
373 settingsGetPointer()->firmwareVersion[1] = firmware_FirmwareData.versionSecond; | |
374 settingsGetPointer()->firmwareVersion[2] = firmware_FirmwareData.versionThird; | |
375 settingsGetPointer()->firmwareVersion[3] = firmware_FirmwareData.versionBeta; | |
376 | |
377 SSettings* pSettings = settingsGetPointer(); | |
378 const SSettings* pStandard = settingsGetPointerStandard(); | |
379 | |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
380 /* Pointing to the old header data => set new data depending on what had been added since last version */ |
38 | 381 switch(pSettings->header) |
382 { | |
383 case 0xFFFF0000: | |
384 case 0xFFFF0001: | |
385 case 0xFFFF0002: | |
386 case 0xFFFF0003: | |
387 case 0xFFFF0004: | |
388 case 0xFFFF0005: | |
389 pSettings->ppo2sensors_deactivated = pStandard->ppo2sensors_deactivated; | |
390 pSettings->tX_colorscheme = pStandard->tX_colorscheme; | |
391 pSettings->tX_userselectedLeftLowerCornerPrimary = pStandard->tX_userselectedLeftLowerCornerPrimary; | |
392 pSettings->tX_userselectedLeftLowerCornerTimeout = pStandard->tX_userselectedLeftLowerCornerTimeout; | |
393 pSettings->tX_customViewPrimary = pStandard->tX_customViewPrimary; | |
394 pSettings->tX_customViewTimeout = pStandard->tX_customViewTimeout; | |
395 // no break | |
396 case 0xFFFF0006: | |
397 pSettings->timeoutEnterButtonSelectDive = pStandard->timeoutEnterButtonSelectDive; | |
398 pSettings->ButtonResponsiveness[0] = pStandard->ButtonResponsiveness[0]; | |
399 pSettings->ButtonResponsiveness[1] = pStandard->ButtonResponsiveness[1]; | |
400 pSettings->ButtonResponsiveness[2] = pStandard->ButtonResponsiveness[2]; | |
401 pSettings->ButtonResponsiveness[3] = pStandard->ButtonResponsiveness[3]; | |
402 pSettings->timeoutSurfacemode = pStandard->timeoutSurfacemode; | |
403 pSettings->timeoutMenuSurface = pStandard->timeoutMenuSurface; | |
404 pSettings->timeoutMenuDive = pStandard->timeoutMenuDive; | |
405 pSettings->timeoutMenuEdit = pStandard->timeoutMenuEdit; | |
406 pSettings->timeoutInfo = pStandard->timeoutInfo; | |
407 pSettings->timeoutInfoCompass = pStandard->timeoutInfoCompass; | |
408 pSettings->timeoutDiveReachedZeroDepth = pStandard->timeoutDiveReachedZeroDepth; | |
409 pSettings->divetimeToCreateLogbook = pStandard->divetimeToCreateLogbook; | |
410 pSettings->safetystopDuration = pStandard->safetystopDuration; // change from on/off to minutes | |
411 // no break | |
412 case 0xFFFF0007: | |
413 case 0xFFFF0008: | |
414 pSettings->alwaysShowPPO2 = pStandard->alwaysShowPPO2; | |
415 pSettings->logbookOffset = pStandard->logbookOffset; | |
416 // no break | |
417 case 0xFFFF0009: | |
418 pSettings->extraDisplay = pStandard->extraDisplay; | |
419 // no break | |
420 case 0xFFFF000A: | |
421 pSettings->display_toogle_desc = pStandard->display_toogle_desc; | |
422 // no break | |
423 case 0xFFFF000B: | |
424 pSettings->offsetPressure_mbar = pStandard->offsetPressure_mbar; | |
425 pSettings->offsetTemperature_centigrad = pStandard->offsetTemperature_centigrad; | |
426 pSettings->gasConsumption_travel_l_min = pStandard->gasConsumption_travel_l_min; | |
427 pSettings->gasConsumption_bottom_l_min = pStandard->gasConsumption_bottom_l_min; | |
428 pSettings->gasConsumption_deco_l_min = pStandard->gasConsumption_deco_l_min; | |
429 // no break | |
430 case 0xFFFF000C: | |
431 memcpy(pSettings->customtext, " hwOS 4\n\r" " welcome\n\r", 60); | |
432 // no break | |
433 case 0xFFFF000D: // nothing to do from 0xFFFF000D to 0xFFFF000E, just about header :-) | |
434 case 0xFFFF000E: | |
435 pSettings->debugModeOnStart = 0; | |
436 // no break | |
437 case 0xFFFF000F: | |
438 pSettings->compassBearing = 0; | |
439 // no break | |
440 case 0xFFFF0011: | |
441 pSettings->lastKnownBatteryPercentage = 0; | |
442 // no break | |
443 case 0xFFFF0012: | |
444 pSettings->buttonBalance[0] = 3; | |
445 pSettings->buttonBalance[1] = 3; | |
446 pSettings->buttonBalance[2] = 3; | |
447 // no break | |
448 case 0xFFFF0013: | |
449 case 0xFFFF0014: | |
450 pSettings->timeoutSurfacemodeWithSensors = pStandard->timeoutSurfacemodeWithSensors; | |
451 // no break | |
452 case 0xFFFF0015: | |
453 pSettings->ButtonResponsiveness[3] = pStandard->ButtonResponsiveness[3]; | |
454 settingsHelperButtonSens_keepPercentageValues(settingsHelperButtonSens_translate_hwOS_values_to_percentage(pSettings->ButtonResponsiveness[3]), pSettings->ButtonResponsiveness); | |
455 pSettings->VPM_model = 0; | |
456 pSettings->GF_model = 0; | |
457 // no break | |
458 case 0xFFFF0016: | |
459 pSettings->FactoryButtonBase = pStandard->FactoryButtonBase; | |
460 pSettings->FactoryButtonBalance[0] = pStandard->FactoryButtonBalance[0]; | |
461 pSettings->FactoryButtonBalance[1] = pStandard->FactoryButtonBalance[1]; | |
462 pSettings->FactoryButtonBalance[2] = pStandard->FactoryButtonBalance[2]; | |
463 // no break | |
111
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
464 case 0xFFFF0017: |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
465 pSettings->FlipDisplay = 0; |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
466 // no break |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
172
diff
changeset
|
467 case 0xFFFF0018: |
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
172
diff
changeset
|
468 pSettings->cv_configuration = 0xFFFFFFFF; |
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
172
diff
changeset
|
469 // no break |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
470 case 0xFFFF0019: |
375
4bb5ceebfaf9
Use Enum values for initialization and setting check:
ideenmodellierer
parents:
372
diff
changeset
|
471 pSettings->MotionDetection = MOTION_DETECT_OFF; |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
472 // no break |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
492
diff
changeset
|
473 case 0xFFFF001A: |
505 | 474 /* deactivate new views => to be activated by customer */ |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
492
diff
changeset
|
475 pSettings->cv_config_BigScreen = 0xFFFFFFFF; |
505 | 476 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_Navigation; |
477 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DepthData; | |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
492
diff
changeset
|
478 // no break |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
479 case 0xFFFF001B: |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
480 pSettings->compassInertia = 0; /* no inertia */ |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
481 pSettings->tX_customViewPrimaryBF = CVIEW_T3_Decostop; |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
482 pSettings->cv_config_BigScreen &= pSettings->cv_configuration ^= 1 << CVIEW_T3_DecoTTS; |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
483 // no break |
546 | 484 case 0xFFFF001C: |
485 pSettings->viewPortMode = 0; | |
486 pSettings->viewRoll = 0; | |
487 pSettings->viewPitch = 0; | |
488 pSettings->viewYaw = 0; | |
489 // no break | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
490 case 0xFFFF001D: |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
491 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
492 pSettings->ppo2sensors_calibCoeff[0] = 0.0; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
493 pSettings->ppo2sensors_calibCoeff[1] = 0.0; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
494 pSettings->ppo2sensors_calibCoeff[2] = 0.0; |
662 | 495 pSettings->amPMTime = 0; |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
496 // no break |
662 | 497 case 0xFFFF001E: |
498 pSettings->autoSetpoint = 0; | |
710 | 499 pSettings->scrubTimerMax_Obsolete = 0; |
500 pSettings->scrubTimerCur_Obsolete = 0; | |
662 | 501 pSettings->scrubTimerMode = SCRUB_TIMER_OFF; |
502 // no break | |
503 case 0xFFFF001F: | |
504 pSettings->pscr_lung_ratio = 10; | |
505 pSettings->pscr_o2_drop = 4; | |
506 // no break | |
507 case 0xFFFF0020: | |
508 pSettings->co2_sensor_active = 0; | |
509 // no break; | |
687 | 510 case 0xFFFF0021: |
511 pSettings->ext_uart_protocol = 0; | |
512 // no break; | |
710 | 513 case 0xFFFF0022: |
514 pSettings->scubberActiveId = 0; | |
515 pSettings->scrubberData[0].TimerCur = pSettings->scrubTimerCur_Obsolete; | |
516 pSettings->scrubberData[0].TimerMax = pSettings->scrubTimerMax_Obsolete; | |
517 pSettings->scrubberData[0].lastDive.WeekDay = 0; | |
518 pSettings->scrubberData[0].lastDive.Month = 0; | |
519 pSettings->scrubberData[0].lastDive.Date = 0; | |
520 pSettings->scrubberData[0].lastDive.Year = 0; | |
521 | |
522 pSettings->scrubberData[1].TimerCur = 0; | |
523 pSettings->scrubberData[1].TimerMax = 0; | |
524 pSettings->scrubberData[1].lastDive.WeekDay = 0; | |
525 pSettings->scrubberData[1].lastDive.Month = 0; | |
526 pSettings->scrubberData[1].lastDive.Date = 0; | |
527 pSettings->scrubberData[1].lastDive.Year = 0; | |
528 // no break; | |
733 | 529 case 0xFFFF0023: pSettings->ext_sensor_map[0] = SENSOR_OPTIC; |
530 pSettings->ext_sensor_map[1] = SENSOR_OPTIC; | |
531 pSettings->ext_sensor_map[2] = SENSOR_OPTIC; | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
532 pSettings->ext_sensor_map[3] = SENSOR_NONE; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
533 pSettings->ext_sensor_map[4] = SENSOR_NONE; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
534 // no break; |
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
535 case 0xFFFF0024: pSettings->buttonLockActive = 0; |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
536 // no break; |
38 | 537 default: |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
172
diff
changeset
|
538 pSettings->header = pStandard->header; |
38 | 539 break; // no break before!! |
540 } | |
541 } | |
542 | |
543 | |
544 uint8_t newFirmwareVersionCheckViaSettings(void) | |
545 { | |
546 SSettings* pSettings = settingsGetPointer(); | |
547 | |
548 if(pSettings->header < 0xFFFF0014) // for the versions without firmwareVersion[] | |
549 return 1; | |
550 | |
551 if(pSettings->firmwareVersion[0] != firmware_FirmwareData.versionFirst) | |
552 return 1; | |
553 if(pSettings->firmwareVersion[1] != firmware_FirmwareData.versionSecond) | |
554 return 1; | |
555 if(pSettings->firmwareVersion[2] != firmware_FirmwareData.versionThird) | |
556 return 1; | |
557 if(pSettings->firmwareVersion[3] != firmware_FirmwareData.versionBeta) | |
558 return 1; | |
559 | |
560 return 0; | |
561 } | |
562 | |
563 | |
765
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
564 void set_settings_button_to_factory_with_individual_buttonBalance(void) |
38 | 565 { |
765
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
566 bool factoryBalanceSettingsValid = true; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
567 unsigned i = 0; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
568 while (factoryBalanceSettingsValid && i < 3) { |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
569 if (Settings.FactoryButtonBalance[i] < 2 || Settings.FactoryButtonBalance[i] > 5) { |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
570 factoryBalanceSettingsValid = false; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
571 } |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
572 |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
573 i++; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
574 } |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
575 if (factoryBalanceSettingsValid) { |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
576 for (i = 0; i < 3; i++) { |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
577 Settings.buttonBalance[i] = Settings.FactoryButtonBalance[i]; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
578 } |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
579 } |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
580 |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
581 uint8_t buttonResponsiveness = Settings.FactoryButtonBase; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
582 if (buttonResponsiveness < 70 || buttonResponsiveness > 110) { |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
583 buttonResponsiveness = SettingsStandard.ButtonResponsiveness[3]; |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
584 } |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
585 |
da8126d5ea9f
After a firmware update, use the factory settings for button sensitivity if these exist, the default settings otherwise.
heinrichsweikamp
parents:
762
diff
changeset
|
586 settingsHelperButtonSens_keepPercentageValues(buttonResponsiveness, settingsGetPointer()->ButtonResponsiveness); |
38 | 587 } |
588 | |
589 | |
590 uint8_t check_and_correct_settings(void) | |
591 { | |
592 uint32_t corrections = 0; | |
593 uint8_t firstGasFoundOC = 0; | |
594 uint8_t firstGasFoundCCR = 0; | |
595 | |
662 | 596 |
597 settingsWarning = 0; /* reset warning indicator */ | |
598 | |
38 | 599 /* uint32_t header; |
600 */ | |
601 | |
602 /* uint8_t warning_blink_dsec; 1/10 seconds | |
603 */ | |
604 if((Settings.warning_blink_dsec < 1) || (Settings.warning_blink_dsec > 100)) | |
605 { | |
606 Settings.warning_blink_dsec = SettingsStandard.warning_blink_dsec; | |
607 corrections++; | |
608 } | |
609 | |
610 /* uint8_t lastDiveLogId; | |
611 */ | |
612 | |
613 /* uint32_t logFlashNextSampleStartAddress; | |
614 */ | |
615 if((Settings.logFlashNextSampleStartAddress < SAMPLESTART) || (Settings.logFlashNextSampleStartAddress > SAMPLESTOP)) | |
616 { | |
617 Settings.logFlashNextSampleStartAddress = SAMPLESTART; | |
618 corrections++; | |
619 } | |
620 | |
621 | |
622 /* uint8_t dive_mode; has to before the gases | |
623 */ | |
624 if( (Settings.dive_mode != DIVEMODE_OC) && | |
625 (Settings.dive_mode != DIVEMODE_CCR) && | |
626 (Settings.dive_mode != DIVEMODE_Gauge) && | |
662 | 627 (Settings.dive_mode != DIVEMODE_Apnea) && |
628 (Settings.dive_mode != DIVEMODE_PSCR)) | |
38 | 629 { |
630 Settings.dive_mode = DIVEMODE_OC; | |
631 corrections++; | |
632 } | |
633 | |
634 | |
635 /* SGasLine gas[1 + (2*NUM_GASES)]; | |
636 */ | |
637 for(int i=1; i<=2*NUM_GASES;i++) | |
638 { | |
639 if(Settings.gas[i].oxygen_percentage < 4) | |
640 { | |
641 Settings.gas[i].oxygen_percentage = 4; | |
642 corrections++; | |
643 } | |
644 if(Settings.gas[i].oxygen_percentage > 100) | |
645 { | |
646 Settings.gas[i].oxygen_percentage = 100; | |
647 corrections++; | |
648 } | |
649 if((Settings.gas[i].oxygen_percentage + Settings.gas[i].helium_percentage) > 100) | |
650 { | |
651 Settings.gas[i].helium_percentage = 100 - Settings.gas[i].oxygen_percentage; | |
652 corrections++; | |
653 } | |
654 if(Settings.gas[i].note.ub.deco) | |
655 { | |
656 if(Settings.gas[i].note.ub.active != 1) | |
657 { | |
658 Settings.gas[i].note.ub.active = 1; | |
659 corrections++; | |
660 } | |
661 if(Settings.gas[i].note.ub.travel == 1) | |
662 { | |
663 Settings.gas[i].note.ub.travel = 0; | |
664 corrections++; | |
665 } | |
666 } | |
667 if(Settings.gas[i].note.ub.travel) | |
668 { | |
669 if(Settings.gas[i].note.ub.active != 1) | |
670 { | |
671 Settings.gas[i].note.ub.active = 1; | |
672 corrections++; | |
673 } | |
674 if(Settings.gas[i].note.ub.deco == 1) | |
675 { | |
676 Settings.gas[i].note.ub.deco = 0; | |
677 corrections++; | |
678 } | |
679 } | |
680 if(Settings.gas[i].note.ub.first) | |
681 { | |
662 | 682 if(Settings.gas[i].note.ub.active != 1) |
38 | 683 { |
662 | 684 Settings.gas[i].note.ub.active = 1; |
38 | 685 corrections++; |
686 } | |
687 if(Settings.gas[i].note.ub.travel == 1) | |
688 { | |
689 Settings.gas[i].note.ub.travel = 0; | |
690 corrections++; | |
691 } | |
692 if(Settings.gas[i].note.ub.deco == 1) | |
693 { | |
694 Settings.gas[i].note.ub.deco = 0; | |
695 corrections++; | |
696 } | |
697 if((i<=NUM_GASES) && (!firstGasFoundOC)) | |
698 firstGasFoundOC = 1; | |
699 else | |
700 if((i>NUM_GASES) && (!firstGasFoundCCR)) | |
701 firstGasFoundCCR = 1; | |
702 else | |
703 Settings.gas[i].note.ub.first = 0; | |
704 } | |
705 if(Settings.gas[i].bottle_size_liter > 40) | |
706 { | |
707 Settings.gas[i].bottle_size_liter = 40; | |
708 corrections++; | |
709 } | |
710 if(Settings.gas[i].depth_meter > 250) | |
711 { | |
712 Settings.gas[i].depth_meter = 250; | |
713 corrections++; | |
714 } | |
715 if(Settings.gas[i].depth_meter_travel > 250) | |
716 { | |
717 Settings.gas[i].depth_meter_travel = 250; | |
718 corrections++; | |
719 } | |
720 /*if(Settings.gas[i].note.ub.senderCode) | |
721 { | |
722 } | |
723 if(Settings.gas[i].bottle_wireless_id) | |
724 { | |
725 } | |
726 */ | |
727 } // for(int i=1; i<=2*NUM_GASES;i++) | |
728 | |
729 if(!firstGasFoundOC) | |
730 { | |
731 Settings.gas[1].note.ub.active = 1; | |
732 Settings.gas[1].note.ub.first = 1; | |
733 Settings.gas[1].note.ub.travel = 0; | |
734 Settings.gas[1].note.ub.deco = 0; | |
662 | 735 corrections++; |
38 | 736 } |
737 if(!firstGasFoundCCR) | |
738 { | |
739 Settings.gas[1 + NUM_GASES].note.ub.active = 1; | |
740 Settings.gas[1 + NUM_GASES].note.ub.first = 1; | |
741 Settings.gas[1 + NUM_GASES].note.ub.travel = 0; | |
742 Settings.gas[1 + NUM_GASES].note.ub.deco = 0; | |
662 | 743 corrections++; |
38 | 744 } |
745 /* SSetpointLine setpoint[1 + NUM_GASES]; | |
746 */ | |
747 for(int i=1; i<=NUM_GASES;i++) | |
748 { | |
652 | 749 if(Settings.setpoint[i].setpoint_cbar < MIN_PPO2_SP_CBAR) |
38 | 750 { |
652 | 751 Settings.setpoint[i].setpoint_cbar = MIN_PPO2_SP_CBAR; |
38 | 752 corrections++; |
753 } | |
754 if(Settings.setpoint[i].setpoint_cbar > 160) | |
755 { | |
756 Settings.setpoint[i].setpoint_cbar = 160; | |
757 corrections++; | |
758 } | |
759 if(Settings.setpoint[i].depth_meter > 250) | |
760 { | |
761 Settings.setpoint[i].depth_meter = 250; | |
762 corrections++; | |
763 } | |
764 if(Settings.setpoint[i].note.ub.deco) | |
765 { | |
766 if(Settings.setpoint[i].note.ub.active != 1) | |
767 { | |
768 Settings.setpoint[i].note.ub.active = 1; | |
769 corrections++; | |
770 } | |
771 if(Settings.setpoint[i].note.ub.travel == 1) | |
772 { | |
773 Settings.setpoint[i].note.ub.travel = 0; | |
774 corrections++; | |
775 } | |
776 } | |
777 if(Settings.setpoint[i].note.ub.travel) | |
778 { | |
779 if(Settings.setpoint[i].note.ub.active != 1) | |
780 { | |
781 Settings.setpoint[i].note.ub.active = 1; | |
782 corrections++; | |
783 } | |
784 if(Settings.setpoint[i].note.ub.deco == 1) | |
785 { | |
786 Settings.setpoint[i].note.ub.deco = 0; | |
787 corrections++; | |
788 } | |
789 } | |
790 if(Settings.setpoint[i].note.ub.first) | |
791 { | |
792 if(Settings.setpoint[i].note.ub.active != 1) | |
793 { | |
794 Settings.setpoint[i].note.ub.active = 1; | |
795 corrections++; | |
796 } | |
797 if(Settings.setpoint[i].note.ub.travel == 1) | |
798 { | |
799 Settings.setpoint[i].note.ub.travel = 0; | |
800 corrections++; | |
801 } | |
802 if(Settings.setpoint[i].note.ub.deco == 1) | |
803 { | |
804 Settings.setpoint[i].note.ub.deco = 0; | |
805 corrections++; | |
806 } | |
807 } | |
808 } // for(int i=1; i<=NUM_GASES;i++) | |
809 | |
810 /* uint8_t CCR_Mode; | |
811 */ | |
812 if( (Settings.CCR_Mode != CCRMODE_Sensors) && | |
662 | 813 (Settings.CCR_Mode != CCRMODE_Simulation) && |
38 | 814 (Settings.CCR_Mode != CCRMODE_FixedSetpoint)) |
815 { | |
816 Settings.CCR_Mode = CCRMODE_FixedSetpoint; | |
817 corrections++; | |
818 } | |
819 | |
820 /* split2x4_Type deco_type; | |
821 */ | |
822 if( (Settings.deco_type.ub.standard != GF_MODE) && | |
823 (Settings.deco_type.ub.standard != VPM_MODE)) | |
824 { | |
825 Settings.deco_type.ub.standard = VPM_MODE; | |
826 corrections++; | |
827 } | |
828 if(Settings.deco_type.ub.alternative != GF_MODE) | |
829 { | |
830 Settings.deco_type.ub.alternative = GF_MODE; | |
831 corrections++; | |
832 } | |
833 | |
834 /* uint8_t ppO2_max_deco; | |
835 */ | |
836 if(Settings.ppO2_max_deco > 190) | |
837 { | |
838 Settings.ppO2_max_deco = 190; | |
839 corrections++; | |
840 } | |
841 if(Settings.ppO2_max_deco < 100) | |
842 { | |
843 Settings.ppO2_max_deco = 100; | |
844 corrections++; | |
845 } | |
846 | |
847 /* uint8_t ppO2_max_std; | |
848 */ | |
849 if(Settings.ppO2_max_std > 190) | |
850 { | |
851 Settings.ppO2_max_std = 190; | |
852 corrections++; | |
853 } | |
854 if(Settings.ppO2_max_std < 100) | |
855 { | |
856 Settings.ppO2_max_std = 100; | |
857 corrections++; | |
858 } | |
859 | |
860 /* uint8_t ppO2_min; | |
861 */ | |
862 if(Settings.ppO2_min != 15) | |
863 { | |
864 Settings.ppO2_min = 15; | |
865 corrections++; | |
866 } | |
867 | |
868 /* uint8_t CNS_max; | |
869 */ | |
870 if(Settings.CNS_max != 90) | |
871 { | |
872 Settings.CNS_max = 90; | |
873 corrections++; | |
874 } | |
875 | |
876 /* uint8_t ascent_MeterPerMinute_max; | |
877 */ | |
878 if(Settings.ascent_MeterPerMinute_max != 30) | |
879 { | |
880 Settings.ascent_MeterPerMinute_max = 30; | |
881 corrections++; | |
882 } | |
883 | |
884 /* uint8_t ascent_MeterPerMinute_showGraph; | |
885 */ | |
886 if(Settings.ascent_MeterPerMinute_showGraph != 30) | |
887 { | |
888 Settings.ascent_MeterPerMinute_showGraph = 30; | |
889 corrections++; | |
890 } | |
891 | |
892 /* uint8_t future_TTS; | |
893 */ | |
894 if(Settings.future_TTS > 15) | |
895 { | |
896 Settings.future_TTS = 15; | |
897 corrections++; | |
898 } | |
899 | |
900 /* uint8_t GF_high; | |
901 */ | |
902 if(Settings.GF_high > 99) | |
903 { | |
904 Settings.GF_high = 99; | |
905 corrections++; | |
906 } | |
907 if(Settings.GF_high < 45) | |
908 { | |
909 Settings.GF_high = 45; | |
910 corrections++; | |
911 } | |
912 | |
913 /* uint8_t GF_low; | |
914 */ | |
915 if(Settings.GF_low > 99) | |
916 { | |
917 Settings.GF_low = 99; | |
918 corrections++; | |
919 } | |
920 if(Settings.GF_low < 10) | |
921 { | |
922 Settings.GF_low = 10; | |
923 corrections++; | |
924 } | |
925 if(Settings.GF_low > Settings.GF_high) | |
926 { | |
927 Settings.GF_low = Settings.GF_high; | |
928 corrections++; | |
929 } | |
930 | |
931 /* uint8_t aGF_high; | |
932 */ | |
933 if(Settings.aGF_high > 99) | |
934 { | |
935 Settings.aGF_high = 99; | |
936 corrections++; | |
937 } | |
938 if(Settings.aGF_high < 45) | |
939 { | |
940 Settings.aGF_high = 45; | |
941 corrections++; | |
942 } | |
943 | |
944 /* uint8_t aGF_low; | |
945 */ | |
946 if(Settings.aGF_low > 99) | |
947 { | |
948 Settings.aGF_low = 99; | |
949 corrections++; | |
950 } | |
951 if(Settings.aGF_low < 10) | |
952 { | |
953 Settings.aGF_low = 10; | |
954 corrections++; | |
955 } | |
956 if(Settings.aGF_low > Settings.aGF_high) | |
957 { | |
958 Settings.aGF_low = Settings.aGF_high; | |
959 corrections++; | |
960 } | |
961 | |
962 /* split2x4_Type VPM_conservatism; | |
963 */ | |
964 if(Settings.VPM_conservatism.ub.standard > 5) | |
965 { | |
966 Settings.VPM_conservatism.ub.standard = 5; | |
967 corrections++; | |
968 } | |
969 if(Settings.VPM_conservatism.ub.alternative > 5) | |
970 { | |
971 Settings.VPM_conservatism.ub.alternative = 5; | |
972 corrections++; | |
973 } | |
974 | |
975 /* uint8_t safetystopDuration; | |
976 */ | |
977 if(Settings.safetystopDuration > 5) | |
978 { | |
979 Settings.safetystopDuration = 5; | |
980 corrections++; | |
981 } | |
982 | |
983 /* uint8_t AtemMinutenVolumenLiter; | |
984 */ | |
985 if(Settings.AtemMinutenVolumenLiter != 25) | |
986 { | |
987 Settings.AtemMinutenVolumenLiter = 25; | |
988 corrections++; | |
989 } | |
990 | |
991 /* uint8_t ReserveFractionDenominator; | |
992 */ | |
993 if(Settings.ReserveFractionDenominator != 4) | |
994 { | |
995 Settings.ReserveFractionDenominator = 4; | |
996 corrections++; | |
997 } | |
998 | |
999 /* uint8_t salinity; | |
1000 */ | |
1001 if(Settings.salinity > 4) | |
1002 { | |
1003 Settings.salinity = 4; | |
1004 corrections++; | |
1005 } | |
1006 | |
1007 /* uint8_t last_stop_depth_meter; | |
1008 */ | |
1009 if(Settings.last_stop_depth_meter > 9) | |
1010 { | |
1011 Settings.last_stop_depth_meter = 9; | |
1012 corrections++; | |
1013 } | |
1014 if(Settings.last_stop_depth_meter < 3) | |
1015 { | |
1016 Settings.last_stop_depth_meter = 3; | |
1017 corrections++; | |
1018 } | |
1019 | |
1020 /* uint8_t stop_increment_depth_meter; | |
1021 */ | |
1022 if(Settings.stop_increment_depth_meter != 3) | |
1023 { | |
1024 Settings.stop_increment_depth_meter = 3; | |
1025 corrections++; | |
1026 } | |
1027 | |
1028 /* uint8_t brightness; | |
1029 */ | |
1030 if(Settings.brightness > 4) | |
1031 { | |
1032 Settings.brightness = 4; | |
1033 corrections++; | |
1034 } | |
1035 | |
1036 /* uint8_t date_format; | |
1037 */ | |
1038 if( (Settings.date_format != DDMMYY) && | |
1039 (Settings.date_format != MMDDYY) && | |
1040 (Settings.date_format != YYMMDD)) | |
1041 { | |
1042 Settings.date_format = DDMMYY; | |
1043 corrections++; | |
1044 } | |
1045 | |
1046 /* uint8_t selected_language; | |
1047 */ | |
1048 if(Settings.selected_language >= LANGUAGE_END) | |
1049 { | |
1050 Settings.selected_language = LANGUAGE_English; | |
1051 corrections++; | |
1052 } | |
1053 | |
1054 /* char customtext[60]; | |
1055 */ | |
1056 if(Settings.customtext[59] != 0) | |
1057 { | |
1058 Settings.customtext[59] = 0; | |
1059 corrections++; | |
1060 } | |
1061 | |
1062 /* uint16_t timeoutSurfacemode; | |
1063 */ | |
1064 if( (Settings.timeoutSurfacemode != 20) && // Quick Sleep Option | |
1065 (Settings.timeoutSurfacemode != 120)) | |
1066 { | |
1067 Settings.timeoutSurfacemode = 120; | |
1068 corrections++; | |
1069 } | |
1070 | |
1071 /* uint8_t timeoutMenuSurface; | |
1072 */ | |
1073 if(Settings.timeoutMenuSurface != 120) | |
1074 { | |
1075 Settings.timeoutMenuSurface = 120; | |
1076 corrections++; | |
1077 } | |
1078 | |
1079 /* uint8_t timeoutMenuDive; | |
1080 */ | |
1081 if(Settings.timeoutMenuDive != 120) | |
1082 { | |
1083 Settings.timeoutMenuDive = 120; | |
1084 corrections++; | |
1085 } | |
1086 | |
1087 /* uint8_t timeoutMenuEdit; | |
1088 */ | |
1089 if(Settings.timeoutMenuEdit != 120) | |
1090 { | |
1091 Settings.timeoutMenuEdit = 120; | |
1092 corrections++; | |
1093 } | |
1094 | |
1095 /* uint8_t timeoutInfo; | |
1096 */ | |
1097 if(Settings.timeoutInfo != 120) | |
1098 { | |
1099 Settings.timeoutInfo = 120; | |
1100 corrections++; | |
1101 } | |
1102 | |
1103 /* uint8_t timeoutInfoCompass; | |
1104 */ | |
1105 if(Settings.timeoutInfoCompass != 60) | |
1106 { | |
1107 Settings.timeoutInfoCompass = 60; | |
1108 corrections++; | |
1109 } | |
1110 | |
1111 /* uint8_t design; | |
1112 */ | |
1113 if(Settings.design != 7) | |
1114 { | |
1115 Settings.design = 7; | |
1116 corrections++; | |
1117 } | |
1118 | |
1119 /* uint16_t timeoutDiveReachedZeroDepth; | |
1120 */ | |
1121 if(Settings.timeoutDiveReachedZeroDepth != 300) | |
1122 { | |
1123 Settings.timeoutDiveReachedZeroDepth = 300; | |
1124 corrections++; | |
1125 } | |
1126 | |
1127 /* uint16_t divetimeToCreateLogbook; | |
1128 */ | |
1129 if(Settings.divetimeToCreateLogbook != 60) | |
1130 { | |
1131 Settings.divetimeToCreateLogbook = 60; | |
1132 corrections++; | |
1133 } | |
1134 | |
1135 /* uint8_t serialHigh; | |
1136 */ | |
1137 | |
1138 /* uint8_t serialLow; | |
1139 */ | |
1140 | |
1141 /* SUFirmware firmwareVersion16to32bit; | |
1142 */ | |
1143 | |
1144 /* uint32_t backup_localtime_rtc_tr; | |
1145 */ | |
1146 | |
1147 /* uint32_t backup_localtime_rtc_dr; | |
1148 */ | |
1149 | |
1150 /* uint16_t totalDiveCounter; | |
1151 */ | |
1152 | |
1153 /* uint16_t personalDiveCount; | |
1154 */ | |
1155 | |
1156 /* uint8_t showDebugInfo; | |
1157 */ | |
492
4ce932235578
Added compiler switch for existing debug view parameter
Ideenmodellierer
parents:
488
diff
changeset
|
1158 |
4ce932235578
Added compiler switch for existing debug view parameter
Ideenmodellierer
parents:
488
diff
changeset
|
1159 #ifdef HAVE_DEBUG_VIEW |
38 | 1160 if(Settings.showDebugInfo > 1) |
1161 { | |
1162 Settings.showDebugInfo = 0; | |
1163 corrections++; | |
1164 } | |
492
4ce932235578
Added compiler switch for existing debug view parameter
Ideenmodellierer
parents:
488
diff
changeset
|
1165 #else |
4ce932235578
Added compiler switch for existing debug view parameter
Ideenmodellierer
parents:
488
diff
changeset
|
1166 Settings.showDebugInfo = 0; |
4ce932235578
Added compiler switch for existing debug view parameter
Ideenmodellierer
parents:
488
diff
changeset
|
1167 #endif |
38 | 1168 |
1169 /* uint8_t ButtonResponsiveness[4]; | |
1170 */ | |
1171 // Base value, index 3 | |
93 | 1172 if(Settings.ButtonResponsiveness[3] < MIN_BUTTONRESPONSIVENESS_GUI) |
38 | 1173 { |
93 | 1174 Settings.ButtonResponsiveness[3] = MIN_BUTTONRESPONSIVENESS_GUI; |
38 | 1175 corrections++; |
1176 } | |
1177 else | |
151 | 1178 if(Settings.ButtonResponsiveness[3] > MAX_BUTTONRESPONSIVENESS_GUI) |
38 | 1179 { |
151 | 1180 Settings.ButtonResponsiveness[3] = MAX_BUTTONRESPONSIVENESS_GUI; |
38 | 1181 corrections++; |
1182 } | |
1183 // flex values 0, 1, 2 | |
1184 for(int i=0; i<3;i++) | |
1185 { | |
93 | 1186 if(Settings.ButtonResponsiveness[i] < MIN_BUTTONRESPONSIVENESS) // 50-10 //Fix for broken buttons. :) |
38 | 1187 { |
93 | 1188 Settings.ButtonResponsiveness[i] = MIN_BUTTONRESPONSIVENESS; |
38 | 1189 corrections++; |
1190 } | |
1191 else | |
93 | 1192 if(Settings.ButtonResponsiveness[i] > MAX_BUTTONRESPONSIVENESS) // 110+20 |
38 | 1193 { |
93 | 1194 Settings.ButtonResponsiveness[i] = MAX_BUTTONRESPONSIVENESS; |
38 | 1195 corrections++; |
1196 } | |
1197 } | |
1198 | |
1199 /* uint8_t buttonBalance[3]; | |
1200 */ | |
1201 for(int i=0; i<3;i++) | |
1202 { | |
1203 if(Settings.buttonBalance[i] < 2) // 2 = -10 | |
1204 { | |
1205 Settings.buttonBalance[i] = 2; | |
1206 corrections++; | |
1207 } | |
1208 else | |
1209 if(Settings.buttonBalance[i] > 5) // 3 = 0, 4 = +10, 5 = +20 | |
1210 { | |
1211 Settings.buttonBalance[i] = 5; | |
1212 corrections++; | |
1213 } | |
1214 } | |
1215 | |
1216 /* uint8_t nonMetricalSystem; | |
1217 */ | |
1218 if(Settings.nonMetricalSystem > 1) | |
1219 { | |
1220 Settings.nonMetricalSystem = 1; | |
1221 corrections++; | |
1222 } | |
1223 | |
1224 /* uint8_t fallbackToFixedSetpoint; | |
1225 */ | |
1226 if(Settings.fallbackToFixedSetpoint > 1) | |
1227 { | |
1228 Settings.fallbackToFixedSetpoint = 1; | |
1229 corrections++; | |
1230 } | |
1231 | |
1232 /* uint8_t bluetoothActive; | |
1233 */ | |
1234 if(Settings.bluetoothActive > 1) | |
1235 { | |
1236 Settings.bluetoothActive = 1; | |
1237 corrections++; | |
1238 } | |
1239 | |
1240 /* uint8_t safetystopDepth; | |
1241 */ | |
1242 if(Settings.safetystopDepth > 6) | |
1243 { | |
1244 Settings.safetystopDepth = 6; | |
1245 corrections++; | |
1246 } | |
1247 if(Settings.safetystopDepth < 3) | |
1248 { | |
1249 Settings.safetystopDepth = 3; | |
1250 corrections++; | |
1251 } | |
1252 | |
1253 /* uint32_t updateSettingsAllowedFromHeader; | |
1254 */ | |
1255 | |
1256 /* uint8_t ppo2sensors_deactivated; | |
1257 */ | |
1258 if(Settings.ppo2sensors_deactivated > (1+2+4)) | |
1259 { | |
1260 Settings.ppo2sensors_deactivated = 0; | |
1261 corrections++; | |
1262 } | |
1263 | |
1264 /* uint8_t tX_colorscheme; | |
1265 */ | |
1266 if(Settings.tX_colorscheme > 3) | |
1267 { | |
1268 Settings.tX_colorscheme = 0; | |
1269 corrections++; | |
1270 } | |
1271 | |
1272 /* uint8_t tX_userselectedLeftLowerCornerPrimary; | |
1273 */ | |
443
a5101c688b49
Introduced enum for lower left corner view selection:
ideenmodellierer
parents:
439
diff
changeset
|
1274 if(Settings.tX_userselectedLeftLowerCornerPrimary >= LLC_END) |
38 | 1275 { |
443
a5101c688b49
Introduced enum for lower left corner view selection:
ideenmodellierer
parents:
439
diff
changeset
|
1276 Settings.tX_userselectedLeftLowerCornerPrimary = LLC_Temperature; |
38 | 1277 corrections++; |
1278 } | |
1279 | |
1280 /* uint8_t tX_userselectedLeftLowerCornerTimeout; | |
1281 */ | |
1282 if(Settings.tX_userselectedLeftLowerCornerTimeout > 60) | |
1283 { | |
1284 Settings.tX_userselectedLeftLowerCornerTimeout = 0; | |
1285 corrections++; | |
1286 } | |
1287 | |
1288 /* uint8_t tX_customViewPrimary; | |
1289 */ | |
1290 if(Settings.tX_customViewPrimary >= CVIEW_END) | |
1291 { | |
1292 Settings.tX_customViewPrimary = 1; | |
1293 corrections++; | |
1294 } | |
1295 | |
1296 /* uint8_t tX_customViewTimeout; | |
1297 */ | |
1298 if(Settings.tX_customViewTimeout > 60) | |
1299 { | |
1300 Settings.tX_customViewTimeout = 0; | |
1301 corrections++; | |
1302 } | |
1303 | |
1304 /* uint8_t timeoutEnterButtonSelectDive; | |
1305 */ | |
1306 if(Settings.timeoutEnterButtonSelectDive != 10) | |
1307 { | |
1308 Settings.timeoutEnterButtonSelectDive = 10; | |
1309 corrections++; | |
1310 } | |
1311 | |
1312 /* uint8_t logbookOffset; | |
1313 */ | |
1314 if(Settings.logbookOffset > 9000) | |
1315 { | |
1316 Settings.logbookOffset = 0; | |
1317 corrections++; | |
1318 } | |
1319 | |
1320 /* uint8_t alwaysShowPPO2; | |
1321 */ | |
1322 if(Settings.alwaysShowPPO2 > 1) | |
1323 { | |
1324 Settings.alwaysShowPPO2 = 0; | |
1325 corrections++; | |
1326 } | |
1327 | |
1328 /* uint8_t extraDisplay; | |
1329 */ | |
1330 if(Settings.extraDisplay >= EXTRADISPLAY_END) | |
1331 { | |
1332 Settings.extraDisplay = EXTRADISPLAY_BIGFONT; | |
1333 corrections++; | |
1334 } | |
1335 | |
1336 /* int8_t offsetPressure_mbar; | |
1337 */ | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
1338 if((Settings.offsetPressure_mbar > PRESSURE_OFFSET_LIMIT_MBAR) || |
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
1339 (Settings.offsetPressure_mbar < -1 * PRESSURE_OFFSET_LIMIT_MBAR)) |
38 | 1340 { |
1341 Settings.offsetPressure_mbar = 0; | |
1342 corrections++; | |
1343 } | |
1344 | |
1345 /* int8_t offsetTemperature_centigrad; | |
1346 */ | |
1347 if((Settings.offsetTemperature_centigrad > 20) || | |
1348 (Settings.offsetTemperature_centigrad < -20)) | |
1349 { | |
1350 Settings.offsetTemperature_centigrad = 0; | |
1351 corrections++; | |
1352 } | |
1353 | |
1354 /* uint8_t gasConsumption_travel_l_min; | |
1355 */ | |
1356 if((Settings.gasConsumption_travel_l_min < 5) || | |
1357 (Settings.gasConsumption_travel_l_min > 50)) | |
1358 { | |
1359 Settings.gasConsumption_travel_l_min = 20; | |
1360 corrections++; | |
1361 } | |
1362 | |
1363 /* uint8_t gasConsumption_bottom_l_min; | |
1364 */ | |
1365 if((Settings.gasConsumption_bottom_l_min < 5) || | |
1366 (Settings.gasConsumption_bottom_l_min > 50)) | |
1367 { | |
1368 Settings.gasConsumption_bottom_l_min = 20; | |
1369 corrections++; | |
1370 } | |
1371 | |
1372 /* uint8_t gasConsumption_deco_l_min; | |
1373 */ | |
1374 if((Settings.gasConsumption_deco_l_min < 5) || | |
1375 (Settings.gasConsumption_deco_l_min > 50)) | |
1376 { | |
1377 Settings.gasConsumption_deco_l_min = 20; | |
1378 corrections++; | |
1379 } | |
1380 | |
1381 /* uint8_t showDebugInfo; | |
1382 */ | |
1383 #ifdef BOOT16 | |
1384 Settings.showDebugInfo = 0; | |
1385 #else | |
1386 if(Settings.showDebugInfo > 1) | |
1387 Settings.showDebugInfo = 0; | |
1388 | |
1389 #endif | |
1390 | |
1391 /* uint8_t selected_language; | |
1392 */ | |
1393 #ifdef BOOT16 | |
1394 if(Settings.selected_language > 1) | |
1395 Settings.selected_language = 0; | |
1396 #else | |
1397 if(Settings.selected_language > 4) | |
1398 Settings.selected_language = 0; | |
1399 #endif | |
1400 | |
1401 | |
1402 /* uint8_t display_toogle_desc; 1/10 seconds | |
1403 */ | |
1404 if((Settings.display_toogle_desc < 20) || (Settings.display_toogle_desc > 600)) | |
1405 { | |
1406 Settings.display_toogle_desc = SettingsStandard.display_toogle_desc; | |
1407 corrections++; | |
1408 } | |
1409 | |
1410 /* uint8_t debugModeOnStart; | |
1411 */ | |
1412 if(Settings.debugModeOnStart > 1) | |
1413 { | |
1414 Settings.debugModeOnStart = 0; | |
1415 corrections++; | |
1416 } | |
1417 | |
1418 | |
1419 /* uint8_t IAmStolenPleaseKillMe; | |
1420 */ | |
1421 | |
1422 if(hardwareDataGetPointer()->primarySerial == 90) | |
1423 Settings.IAmStolenPleaseKillMe++; | |
1424 else | |
1425 Settings.IAmStolenPleaseKillMe = 0; | |
1426 | |
1427 | |
1428 /* uint8_t debugModeOnStart; | |
1429 */ | |
1430 if(Settings.compassBearing > 360) | |
1431 { | |
1432 Settings.compassBearing = 0; | |
1433 corrections++; | |
1434 } | |
1435 | |
1436 | |
1437 /* uint8_t lastKnownBatteryPercentage; | |
1438 */ | |
1439 if(Settings.lastKnownBatteryPercentage > 100) | |
1440 { | |
1441 Settings.lastKnownBatteryPercentage = 100; | |
1442 corrections++; | |
1443 } | |
1444 | |
1445 /* uint8_t VPM_model | |
1446 */ | |
1447 if((Settings.VPM_model != VPM_FROM_FORTRAN) && (Settings.VPM_model != VPM_BACHELORWORK)) | |
1448 { | |
1449 Settings.VPM_model = VPM_FROM_FORTRAN; | |
1450 corrections++; | |
1451 } | |
1452 | |
1453 /* uint8_t Buehlmann_model | |
1454 */ | |
1455 if((Settings.GF_model != BUEHLMANN_OSTC4) && (Settings.GF_model != BUEHLMANN_hwOS)) | |
1456 { | |
1457 Settings.GF_model = BUEHLMANN_OSTC4; | |
1458 corrections++; | |
1459 } | |
1460 | |
111
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
1461 if(Settings.FlipDisplay > 1) /* only boolean values allowed */ |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
1462 { |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
1463 Settings.FlipDisplay = 0; |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
1464 corrections++; |
38785aa95837
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
75
diff
changeset
|
1465 } |
522 | 1466 |
1467 #ifdef ENABLE_MOTION_CONTROL | |
375
4bb5ceebfaf9
Use Enum values for initialization and setting check:
ideenmodellierer
parents:
372
diff
changeset
|
1468 if(Settings.MotionDetection >= MOTION_DETECT_END) |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
1469 { |
375
4bb5ceebfaf9
Use Enum values for initialization and setting check:
ideenmodellierer
parents:
372
diff
changeset
|
1470 Settings.MotionDetection = MOTION_DETECT_OFF; |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
1471 corrections++; |
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
1472 } |
522 | 1473 #else |
1474 Settings.MotionDetection = MOTION_DETECT_OFF; | |
550
af1c3e3abd5f
Make sure motion detection settings are set to default values:
Ideenmodellierer
parents:
546
diff
changeset
|
1475 Settings.viewPortMode = 0; |
af1c3e3abd5f
Make sure motion detection settings are set to default values:
Ideenmodellierer
parents:
546
diff
changeset
|
1476 Settings.viewRoll = 0.0; |
af1c3e3abd5f
Make sure motion detection settings are set to default values:
Ideenmodellierer
parents:
546
diff
changeset
|
1477 Settings.viewPitch = 0.0; |
af1c3e3abd5f
Make sure motion detection settings are set to default values:
Ideenmodellierer
parents:
546
diff
changeset
|
1478 Settings.viewYaw = 0.0; |
522 | 1479 #endif |
38 | 1480 |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1481 if(Settings.compassInertia > MAX_COMPASS_COMP) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1482 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1483 Settings.compassInertia = 0; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1484 corrections++; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1485 } |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
1486 if(Settings.tX_customViewPrimaryBF > CVIEW_T3_END) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
1487 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
1488 Settings.tX_customViewPrimaryBF = CVIEW_T3_Decostop; |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
1489 corrections++; |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
1490 } |
546 | 1491 if(Settings.viewPortMode > MAX_VIEWPORT_MODE) |
1492 { | |
1493 Settings.viewPortMode = 0; | |
1494 corrections++; | |
1495 } | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1496 if(Settings.ppo2sensors_source >= O2_SENSOR_SOURCE_MAX) |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1497 { |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1498 Settings.ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1499 Settings.ppo2sensors_calibCoeff[0] = 0.0; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1500 Settings.ppo2sensors_calibCoeff[1] = 0.0; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1501 Settings.ppo2sensors_calibCoeff[2] = 0.0; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1502 corrections++; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
1503 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
533
diff
changeset
|
1504 |
567 | 1505 if(Settings.amPMTime > 1) /* only boolean values allowed */ |
1506 { | |
1507 Settings.amPMTime = 0; | |
1508 corrections++; | |
1509 } | |
650 | 1510 |
1511 if(Settings.autoSetpoint > 1) /* only boolean values allowed */ | |
1512 { | |
1513 Settings.autoSetpoint = 0; | |
1514 corrections++; | |
1515 } | |
1516 | |
710 | 1517 if(Settings.scubberActiveId > 1) |
1518 { | |
1519 Settings.scubberActiveId = 0; | |
1520 corrections++; | |
1521 } | |
761 | 1522 if((Settings.scrubberData[0].TimerMax > MAX_SCRUBBER_TIME) || Settings.scrubberData[0].TimerCur < MIN_SCRUBBER_TIME || Settings.scrubberData[0].TimerCur > (int16_t)MAX_SCRUBBER_TIME) |
650 | 1523 { |
710 | 1524 Settings.scrubberData[0].TimerMax = 0; |
1525 Settings.scrubberData[0].TimerCur = 0; | |
1526 corrections++; | |
1527 } | |
761 | 1528 if((Settings.scrubberData[1].TimerMax > MAX_SCRUBBER_TIME) || Settings.scrubberData[1].TimerCur < MIN_SCRUBBER_TIME || Settings.scrubberData[1].TimerCur > (int16_t)MAX_SCRUBBER_TIME) |
710 | 1529 { |
1530 Settings.scrubberData[1].TimerMax = 0; | |
1531 Settings.scrubberData[1].TimerCur = 0; | |
650 | 1532 corrections++; |
1533 } | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1534 if(Settings.scrubTimerMode > SCRUB_TIMER_END) |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1535 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1536 Settings.scrubTimerMode = SCRUB_TIMER_OFF; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1537 corrections++; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1538 } |
662 | 1539 |
1540 if((Settings.pscr_lung_ratio > PSCR_MAX_LUNG_RATIO) || (Settings.pscr_lung_ratio < PSCR_MIN_LUNG_RATIO)) | |
1541 { | |
1542 Settings.pscr_lung_ratio = 10; | |
1543 corrections++; | |
1544 } | |
1545 if(Settings.pscr_o2_drop > PSCR_MAX_O2_DROP) | |
1546 { | |
1547 Settings.pscr_o2_drop = 4; | |
1548 corrections++; | |
1549 } | |
1550 | |
1551 if(Settings.co2_sensor_active > 1) | |
1552 { | |
1553 Settings.co2_sensor_active = 0; | |
1554 corrections++; | |
1555 } | |
710 | 1556 if(Settings.ext_uart_protocol > UART_MAX_PROTOCOL) |
687 | 1557 { |
1558 Settings.ext_uart_protocol = 0; | |
1559 corrections++; | |
1560 } | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1561 if((Settings.ext_sensor_map[0] >= SENSOR_END) |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1562 || (Settings.ext_sensor_map[1] >= SENSOR_END) |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1563 || (Settings.ext_sensor_map[2] >= SENSOR_END) |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1564 || (Settings.ext_sensor_map[3] >= SENSOR_END) |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1565 || (Settings.ext_sensor_map[4] >= SENSOR_END)) |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1566 { |
733 | 1567 Settings.ext_sensor_map[0] = SENSOR_OPTIC; |
1568 Settings.ext_sensor_map[1] = SENSOR_OPTIC; | |
1569 Settings.ext_sensor_map[2] = SENSOR_OPTIC; | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1570 Settings.ext_sensor_map[3] = SENSOR_NONE; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1571 Settings.ext_sensor_map[4] = SENSOR_NONE; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1572 corrections++; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1573 } |
662 | 1574 |
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1575 if(Settings.buttonLockActive > 1) |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1576 { |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1577 Settings.buttonLockActive = 1; |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1578 corrections++; |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1579 } |
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1580 |
662 | 1581 if(corrections) |
1582 { | |
1583 settingsWarning = 1; | |
1584 } | |
1585 else | |
1586 | |
38 | 1587 if(corrections > 255) |
662 | 1588 { |
1589 corrections = 255; | |
1590 } | |
1591 | |
1592 return (uint8_t)corrections; | |
38 | 1593 } |
1594 | |
1595 | |
1596 /* always at 0x8080000, do not move -> bootloader access */ | |
1597 const SFirmwareData* firmwareDataGetPointer(void) | |
1598 { | |
1599 return &firmware_FirmwareData; | |
1600 } | |
1601 | |
1602 | |
1603 #ifndef SPECIALPROGRAMM | |
1604 const SHardwareData* hardwareDataGetPointer(void) | |
1605 { | |
1606 return (SHardwareData *)HARDWAREDATA_ADDRESS; | |
1607 } | |
1608 #endif | |
1609 | |
1610 const SSettings* settingsGetPointerStandard(void) | |
1611 { | |
1612 return &SettingsStandard; | |
1613 } | |
1614 | |
1615 | |
1616 void hardwareBatchCode(uint8_t *high, uint8_t *low) | |
1617 { | |
1618 if(high) | |
1619 { | |
1620 *high = (uint8_t)((hardwareDataGetPointer()->production_year - 16) * 16); | |
1621 *high += hardwareDataGetPointer()->production_month; | |
1622 if(low) | |
1623 { | |
1624 *low = (uint8_t)(hardwareDataGetPointer()->production_day * 8); | |
1625 } | |
1626 } | |
1627 } | |
1628 | |
1629 | |
1630 uint8_t firmwareVersion_16bit_high(void) | |
1631 { | |
319
d8e86af78474
bugfix: correct packed main version number in dive header
Jan Mulder <jlmulder@xs4all.nl>
parents:
286
diff
changeset
|
1632 return ((firmware_FirmwareData.versionFirst & 0x1F) << 3) + ((firmware_FirmwareData.versionSecond & 0x1C) >> 2); |
38 | 1633 } |
1634 | |
1635 uint8_t firmwareVersion_16bit_low(void) | |
1636 { | |
1637 return ((firmware_FirmwareData.versionSecond & 0x03) << 6) + ((firmware_FirmwareData.versionThird & 0x1F) << 1) + (firmware_FirmwareData.versionBeta & 0x01); | |
1638 } | |
1639 | |
368
50ea68c7a153
Added menu item for motion detection. There are several possibility to use motion detection for user action input. To select of the a new menu entry has been added to the Sys2 =>Custom View Menu (Variables in german)
ideenmodellierer
parents:
324
diff
changeset
|
1640 inline SSettings* settingsGetPointer(void) |
38 | 1641 { |
1642 return &Settings; | |
1643 } | |
1644 | |
1645 | |
1646 // =============================================================================== | |
1647 // set_settings_to_Standard | |
1648 /// @brief This function overwrites the current settings of the system | |
1649 /// with the EXCEPTION of the personalDiveCount | |
1650 /// | |
1651 /// It additionally calls set_new_settings_missing_in_ext_flash() and | |
1652 /// check_and_correct_settings(), even so this shouldn't be necessary. | |
1653 /// It is called on every start and from Reset All. | |
1654 /// | |
1655 /// 160622 added lastDiveLogIdBackup | |
1656 /// | |
1657 // =============================================================================== | |
1658 void set_settings_to_Standard(void) | |
1659 { | |
1660 SSettings *pSettings; | |
1661 const SSettings *pSettingsStandard; | |
1662 uint16_t personalDiveCountBackup; | |
1663 uint8_t lastDiveLogIdBackup; | |
1664 pSettings = settingsGetPointer(); | |
1665 pSettingsStandard = settingsGetPointerStandard(); | |
1666 | |
1667 personalDiveCountBackup = pSettings->personalDiveCount; | |
1668 lastDiveLogIdBackup = pSettings->lastDiveLogId; | |
1669 memcpy(pSettings,pSettingsStandard,sizeof(*pSettings)); | |
1670 pSettings->personalDiveCount = personalDiveCountBackup; | |
1671 pSettings->lastDiveLogId = lastDiveLogIdBackup; | |
1672 | |
1673 pSettings->firmwareVersion[0] = firmware_FirmwareData.versionFirst; | |
1674 pSettings->firmwareVersion[1] = firmware_FirmwareData.versionSecond; | |
1675 pSettings->firmwareVersion[2] = firmware_FirmwareData.versionThird; | |
1676 pSettings->firmwareVersion[3] = firmware_FirmwareData.versionBeta; | |
1677 | |
1678 set_new_settings_missing_in_ext_flash(); | |
1679 check_and_correct_settings(); | |
1680 // has to be called too: createDiveSettings(); | |
1681 } | |
1682 | |
1683 | |
1684 // =============================================================================== | |
1685 // mod_settings_for_first_start_with_empty_ext_flash | |
1686 /// @brief This function overwrites some settings of the system | |
1687 /// It is called on every start. | |
1688 /// Those settings will be overwriten by ext_flash_read_settings() | |
1689 /// Will be kept if ext_flash_read_settings() is invalid because | |
1690 /// it is still empty. | |
1691 /// | |
1692 // =============================================================================== | |
1693 void mod_settings_for_first_start_with_empty_ext_flash(void) | |
1694 { | |
1695 settingsGetPointer()->debugModeOnStart = 1; // | |
1696 } | |
1697 | |
1698 | |
1699 | |
1700 // =============================================================================== | |
1701 // hwOS4_to_hwOS_GasType | |
1702 /// @brief Helper for get gas / diluent | |
1703 /// | |
1704 // =============================================================================== | |
1705 uint8_t hwOS4_to_hwOS_GasType(uint8_t inOSTC4style) | |
1706 { | |
1707 switch(inOSTC4style) | |
1708 { | |
1709 case (1+2): // first | |
1710 case (2): // first | |
1711 return 1; // hwOS style first | |
1712 case (1+4): // deco | |
1713 case (4): // deco | |
1714 return 3; // hwOS style deco | |
1715 case (1+8): // travel | |
1716 case (8): // travel | |
1717 return 2; // hwOS style travel | |
1718 default: | |
1719 return 0; // hwOS style Disabled | |
1720 } | |
1721 } | |
1722 | |
1723 | |
1724 // =============================================================================== | |
1725 // hwOS_to_hwOS4_GasType | |
1726 /// @brief Helper for set gas / diluent | |
1727 /// | |
1728 // =============================================================================== | |
1729 uint8_t hwOS_to_hwOS4_GasType(uint8_t inOSTC4style) | |
1730 { | |
1731 switch(inOSTC4style) | |
1732 { | |
1733 case (1): // first | |
1734 return 1+2; // hwOS4 style first | |
1735 case (2): // travel (normal for diluent) | |
1736 return 1+8; // hwOS4 style travel | |
1737 case (3): // deco | |
1738 return 1+4; // hwOS4 style deco | |
1739 default: | |
1740 return 0; // hwOS4 style inactive | |
1741 } | |
1742 } | |
1743 | |
1744 | |
1745 | |
1746 // =============================================================================== | |
1747 // setGas | |
1748 /// @brief This function overwrites one gas, including mode and deco depth, | |
1749 /// it returns 0x4D prompt which is not used by writeData() that calls it. | |
1750 /// | |
1751 /// @param i the gas id from 1 to 5 for OC and 6 to 10 for CCR, 0 is the extra gas | |
1752 /// @param *data 5 bytes with the first the command to call setGas and the four | |
1753 /// following bytes to define oxygen, helium, mode and deco depth | |
1754 /// | |
1755 /// @return 0x4D (prompt that is not used) | |
1756 // =============================================================================== | |
1757 uint8_t setGas(int i,uint8_t * data) | |
1758 { | |
1759 if(!checkValue(data[1],4,100)) | |
1760 return ERROR_; | |
1761 if(!checkValue(data[4],0,250)) | |
1762 return ERROR_; | |
1763 | |
1764 Settings.gas[i].oxygen_percentage = data[1]; | |
1765 Settings.gas[i].helium_percentage = data[2]; | |
1766 Settings.gas[i].note.uw = hwOS_to_hwOS4_GasType(data[3]); | |
1767 Settings.gas[i].depth_meter = data[4]; | |
1768 return 0x4d; | |
1769 } | |
1770 | |
1771 | |
1772 uint8_t getGas(int i,uint8_t * data) | |
1773 { | |
1774 data[0] = Settings.gas[i].oxygen_percentage; | |
1775 data[1] = Settings.gas[i].helium_percentage; | |
1776 data[2] = hwOS4_to_hwOS_GasType(Settings.gas[i].note.uw); | |
1777 data[3] = Settings.gas[i].depth_meter; | |
1778 return 0x4d; | |
1779 } | |
1780 | |
1781 uint8_t setDiluent(int i,uint8_t * data) | |
1782 { | |
1783 if(!checkValue(data[1],4,100)) | |
1784 return ERROR_; | |
1785 if(!checkValue(data[4],0,250)) | |
1786 return ERROR_; | |
1787 | |
1788 Settings.gas[NUM_OFFSET_DILUENT + i].oxygen_percentage = data[1]; | |
1789 Settings.gas[NUM_OFFSET_DILUENT + i].helium_percentage = data[2]; | |
1790 Settings.gas[NUM_OFFSET_DILUENT + i].note.uw = hwOS_to_hwOS4_GasType(data[3]); | |
1791 Settings.gas[NUM_OFFSET_DILUENT + i].depth_meter = data[4]; | |
1792 return 0x4d; | |
1793 } | |
1794 | |
1795 uint8_t getDiluent(int i,uint8_t * data) | |
1796 { | |
1797 data[0] = Settings.gas[NUM_OFFSET_DILUENT + i].oxygen_percentage; | |
1798 data[1] = Settings.gas[NUM_OFFSET_DILUENT + i].helium_percentage; | |
1799 data[2] = hwOS4_to_hwOS_GasType(Settings.gas[NUM_OFFSET_DILUENT + i].note.uw); | |
1800 data[3] = Settings.gas[NUM_OFFSET_DILUENT + i].depth_meter; | |
1801 return 0x4d; | |
1802 } | |
1803 | |
1804 uint8_t setSetpoint(int i,uint8_t * data) | |
1805 { | |
1806 if(!checkValue(data[1],50,160)) | |
1807 return ERROR_; | |
1808 if(!checkValue(data[2],0,250)) | |
1809 return ERROR_; | |
1810 | |
1811 Settings.setpoint[i].setpoint_cbar = data[1]; | |
1812 Settings.setpoint[i].depth_meter = data[2]; | |
1813 return 0x4d; | |
1814 } | |
1815 | |
1816 uint8_t getSetpoint(int i,uint8_t * data) | |
1817 { | |
1818 data[0] = Settings.setpoint[i].setpoint_cbar; | |
1819 data[1] = Settings.setpoint[i].depth_meter; | |
1820 return 0x4d; | |
1821 } | |
1822 | |
1823 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to) | |
1824 { | |
1825 if(value >= from && value <= to) | |
1826 return 1; | |
1827 return 0; | |
1828 } | |
1829 | |
1830 uint8_t writeData(uint8_t * data) | |
1831 { | |
1832 uint32_t newSensitivity; | |
1833 uint16_t newDuration, newOffset; | |
1834 uint8_t newStopDepth; | |
1835 | |
1836 switch(data[0]) | |
1837 { | |
1838 case 0x10: | |
1839 return setGas(1,data); | |
1840 case 0x11: | |
1841 return setGas(2,data); | |
1842 case 0x12: | |
1843 return setGas(3,data); | |
1844 case 0x13: | |
1845 return setGas(4,data); | |
1846 case 0x14: | |
1847 return setGas(5,data); | |
1848 case 0x15: | |
1849 return setDiluent(1,data); | |
1850 case 0x16: | |
1851 return setDiluent(2,data); | |
1852 case 0x17: | |
1853 return setDiluent(3,data); | |
1854 case 0x18: | |
1855 return setDiluent(4,data); | |
1856 case 0x19: | |
1857 return setDiluent(5,data); | |
1858 case 0x1A: | |
1859 return setSetpoint(1,data); | |
1860 case 0x1B: | |
1861 return setSetpoint(2,data); | |
1862 case 0x1C: | |
1863 return setSetpoint(3,data); | |
1864 case 0x1D: | |
1865 return setSetpoint(4,data); | |
1866 case 0x1E: | |
1867 return setSetpoint(5,data); | |
1868 case 0x1F: | |
1869 if(!checkValue(data[2],0,1)) | |
1870 return ERROR_; | |
1871 Settings.CCR_Mode = data[1]; | |
1872 break; | |
1873 case 0x20: | |
1874 if(!checkValue(data[1],0,3)) | |
1875 return ERROR_; | |
1876 Settings.dive_mode = data[1]; | |
1877 break; | |
1878 case 0x21: | |
1879 if(!checkValue(data[1],1,2)) | |
1880 return ERROR_; | |
1881 Settings.deco_type.ub.standard = data[1] & 0x0F; | |
1882 //Settings.deco_type.ub.alternative = (data[1] & 0xF0) >> 4; | |
1883 break; | |
1884 case 0x22: | |
1885 if(!checkValue(data[1],100,190)) | |
1886 return ERROR_; | |
1887 Settings.ppO2_max_std = data[1]; | |
1888 break; | |
1889 case 0x23: | |
1890 if(!checkValue(data[1],15,15)) | |
1891 return ERROR_; | |
1892 Settings.ppO2_min = data[1]; | |
1893 break; | |
1894 case 0x24: | |
1895 if(!checkValue(data[1],0,15)) | |
1896 return ERROR_; | |
1897 Settings.future_TTS = data[1]; | |
1898 break; | |
1899 case 0x25: | |
1900 if(!checkValue(data[1],10,99)) | |
1901 return ERROR_; | |
1902 Settings.GF_low = data[1]; | |
1903 break; | |
1904 case 0x26: | |
1905 if(!checkValue(data[1],45,99)) | |
1906 return ERROR_; | |
1907 Settings.GF_high = data[1]; | |
1908 break; | |
1909 case 0x27: | |
1910 if(!checkValue(data[1],10,99)) | |
1911 return ERROR_; | |
1912 Settings.aGF_low = data[1]; | |
1913 break; | |
1914 case 0x28: | |
1915 if(!checkValue(data[1],45,99)) | |
1916 return ERROR_; | |
1917 Settings.aGF_high = data[1]; | |
1918 break; | |
1919 case 0x29: | |
1920 if(!checkValue(data[1],0,5)) | |
1921 return ERROR_; | |
1922 Settings.VPM_conservatism.ub.standard = data[1]; | |
1923 break; | |
1924 case 0x2A: | |
1925 case 0x2B: | |
1926 return ERROR_; | |
1927 case 0x2C: | |
1928 if(!checkValue(data[1],3,9)) | |
1929 return ERROR_; | |
1930 Settings.last_stop_depth_meter = data[1]; | |
1931 break; | |
1932 case 0x2D: | |
1933 if(!checkValue(data[1],0,4)) | |
1934 return ERROR_; | |
1935 Settings.brightness = data[1]; | |
1936 break; | |
1937 case 0x2E: | |
1938 if(!checkValue(data[1],0,1)) | |
1939 return ERROR_; | |
1940 Settings.nonMetricalSystem = data[1]; | |
1941 break; | |
1942 case 0x2F: | |
1943 return ERROR_; | |
1944 case 0x30: | |
1945 if(!checkValue(data[1],0,4)) | |
1946 return ERROR_; | |
1947 Settings.salinity = data[1]; | |
1948 break; | |
1949 case 0x31: | |
1950 if(!checkValue(data[1],0,3)) | |
1951 return ERROR_; | |
1952 Settings.tX_colorscheme = data[1]; | |
1953 GFX_use_colorscheme(Settings.tX_colorscheme); | |
1954 break; | |
1955 case 0x32: | |
1956 if(!checkValue(data[1],0,4)) | |
1957 return ERROR_; | |
1958 Settings.selected_language = data[1]; | |
1959 break; | |
1960 case 0x33: | |
1961 if(!checkValue(data[1],0,2)) | |
1962 return ERROR_; | |
1963 Settings.date_format = data[1]; | |
1964 break; | |
1965 case 0x34: | |
1966 return ERROR_; | |
1967 case 0x35: | |
1968 if(data[1] & 0x80) | |
1969 { | |
1970 data[1] = ~(data[1]); | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
1971 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
38 | 1972 return ERROR_; |
1973 Settings.offsetPressure_mbar = 0 - data[1]; | |
1974 } | |
1975 else | |
1976 { | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
1977 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
38 | 1978 return ERROR_; |
1979 Settings.offsetPressure_mbar = data[1]; | |
1980 } | |
1981 break; | |
1982 case 0x36: | |
1983 if(!checkValue(data[1],0,1)) | |
1984 return ERROR_; | |
1985 if(data[1]) | |
1986 Settings.safetystopDuration = settingsGetPointerStandard()->safetystopDuration; | |
1987 else | |
1988 Settings.safetystopDuration = 0; | |
1989 break; | |
1990 case 0x37: | |
1991 return ERROR_; | |
1992 case 0x38: | |
1993 if(!checkValue(data[1],0,1)) | |
1994 return ERROR_; | |
1995 Settings.fallbackToFixedSetpoint = data[1]; | |
1996 break; | |
1997 case 0x39: | |
1998 return ERROR_; | |
1999 case 0x3A: | |
2000 if(!checkValue(data[1],70,110)) | |
2001 return ERROR_; | |
2002 newSensitivity = data[1]; | |
2003 settingsHelperButtonSens_keepPercentageValues(newSensitivity, settingsGetPointer()->ButtonResponsiveness); | |
2004 setButtonResponsiveness(Settings.ButtonResponsiveness); | |
2005 break; | |
2006 case 0x3B: | |
2007 // value between 0 and 127 | |
2008 if(buttonBalanceTranslatorHexToArray(data[1], settingsGetPointer()->buttonBalance)) | |
2009 { | |
2010 settingsHelperButtonSens_keepPercentageValues(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->ButtonResponsiveness); | |
2011 } | |
2012 else // value >= 128 (bit 7 set) factory reset | |
2013 { | |
2014 getButtonFactorDefaults(&settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
2015 settingsHelperButtonSens_keepPercentageValues(settingsGetPointerStandard()->ButtonResponsiveness[3], settingsGetPointer()->ButtonResponsiveness); | |
2016 } | |
2017 // valid for both: | |
2018 setButtonResponsiveness(Settings.ButtonResponsiveness); | |
2019 break; | |
2020 case 0x3C: | |
2021 if(!checkValue(data[1],5,50)) | |
2022 return ERROR_; | |
2023 Settings.gasConsumption_bottom_l_min = data[1]; | |
2024 break; | |
2025 case 0x3D: | |
2026 if(!checkValue(data[1],5,50)) | |
2027 return ERROR_; | |
2028 Settings.gasConsumption_deco_l_min = data[1]; | |
2029 break; | |
2030 case 0x3E: | |
2031 if(!checkValue(data[1],5,50)) | |
2032 return ERROR_; | |
2033 Settings.gasConsumption_travel_l_min = data[1]; | |
2034 break; | |
2035 case 0x3F: | |
2036 case 0x40: | |
2037 return ERROR_; | |
2038 case 0x41: | |
2039 if(!checkValue(data[1],0,1)) | |
2040 return ERROR_; | |
2041 Settings.alwaysShowPPO2 = data[1]; | |
2042 break; | |
2043 case 0x42: | |
2044 if(data[1] & 0x80) | |
2045 { | |
2046 data[1] = ~(data[1]); | |
2047 if(!checkValue(data[1],0,20)) | |
2048 return ERROR_; | |
2049 Settings.offsetTemperature_centigrad = 0 - data[1]; | |
2050 } | |
2051 else | |
2052 { | |
2053 if(!checkValue(data[1],0,20)) | |
2054 return ERROR_; | |
2055 Settings.offsetTemperature_centigrad = data[1]; | |
2056 } | |
2057 break; | |
2058 case 0x43: | |
2059 if(!checkValue(data[1],60,255)) | |
2060 return ERROR_; | |
2061 newDuration = (uint16_t)data[1] + 59; | |
2062 newDuration /= 60; | |
2063 Settings.safetystopDuration = (uint8_t)newDuration; | |
2064 break; | |
2065 case 0x44: | |
2066 if(!checkValue(data[1],21,61)) | |
2067 return ERROR_; | |
2068 newStopDepth = data[1] + 9; | |
2069 if(newStopDepth > 60) | |
2070 newStopDepth = 60; | |
2071 newStopDepth /= 10; | |
2072 Settings.safetystopDepth = newStopDepth; | |
2073 break; | |
2074 case 0x45: | |
2075 case 0x46: | |
2076 return ERROR_; | |
2077 case 0x47: | |
2078 newOffset = data[2] * 256; | |
2079 newOffset += data[1]; | |
2080 if(newOffset > 9000) | |
2081 return ERROR_; | |
2082 Settings.logbookOffset = newOffset; | |
2083 break; | |
2084 case 0x70: | |
2085 if(!checkValue(data[1],0,1)) | |
2086 return ERROR_; | |
2087 Settings.showDebugInfo = data[1]; | |
2088 break; | |
2089 case 0x71: | |
2090 if(!checkValue(data[1],0,(EXTRADISPLAY_END - 1))) | |
2091 return ERROR_; | |
2092 Settings.extraDisplay = data[1]; | |
2093 break; | |
2094 case 0x72: | |
2095 if(!checkValue(data[1],0,8)) | |
2096 return ERROR_; | |
2097 Settings.tX_customViewPrimary = data[1]; | |
2098 break; | |
2099 case 0x73: | |
2100 if(!checkValue(data[1],0,20)) | |
2101 return ERROR_; | |
2102 Settings.tX_customViewTimeout = data[1]; | |
2103 break; | |
2104 case 0x74: | |
2105 if(!checkValue(data[1],1,7)) | |
2106 return ERROR_; | |
2107 Settings.tX_userselectedLeftLowerCornerPrimary = data[1]; | |
2108 break; | |
2109 case 0x75: | |
2110 if(!checkValue(data[1],0,20)) | |
2111 return ERROR_; | |
2112 Settings.tX_userselectedLeftLowerCornerTimeout = data[1]; | |
2113 break; | |
2114 } | |
2115 return 0; | |
2116 } | |
2117 | |
2118 | |
2119 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data) | |
2120 { | |
2121 enum JeanDoParameterType { | |
2122 PARAM_UNKNOWN = 0, | |
2123 PARAM_INT15 = 1, | |
2124 PARAM_INT8, | |
2125 PARAM_DECI, | |
2126 PARAM_CENTI, | |
2127 PARAM_MILI, | |
2128 PARAM_PERCENT, | |
2129 PARAM_SEC, | |
2130 PARAM_COLOR, | |
2131 PARAM_BOOL, | |
2132 PARAM_ENUM, | |
2133 PARAM_SIGNED = 128, | |
2134 PARAM_SDECI = PARAM_SIGNED|PARAM_DECI, | |
2135 PARAM_SSEC = PARAM_SIGNED|PARAM_SEC, | |
2136 PARAM_SINT = PARAM_SIGNED|PARAM_INT8 | |
2137 }; | |
2138 | |
2139 // uint32_t buttonSensitivity; | |
2140 uint16_t newDuration; | |
2141 | |
2142 uint8_t datacounter = 0; | |
2143 | |
2144 data[0] = 0; | |
2145 data[1] = 0; | |
2146 data[2] = 0; | |
2147 data[3] = 0; | |
2148 datacounter = 0; | |
2149 | |
2150 switch(what) | |
2151 { | |
2152 case 0x10: | |
2153 case 0x11: | |
2154 case 0x12: | |
2155 case 0x13: | |
2156 case 0x14: | |
2157 data[datacounter++] = PARAM_INT8; | |
2158 data[datacounter++] = 4; | |
2159 data[datacounter++] = settingsGetPointerStandard()->gas[1].oxygen_percentage; | |
2160 data[datacounter++] = 100; | |
2161 break; | |
2162 | |
2163 case 0x15: | |
2164 case 0x16: | |
2165 case 0x17: | |
2166 case 0x18: | |
2167 case 0x19: | |
2168 data[datacounter++] = PARAM_INT8; | |
2169 data[datacounter++] = 4; | |
2170 data[datacounter++] = settingsGetPointerStandard()->gas[1].oxygen_percentage; | |
2171 data[datacounter++] = 100; | |
2172 break; | |
2173 | |
2174 case 0x1A: | |
2175 case 0x1B: | |
2176 case 0x1C: | |
2177 case 0x1D: | |
2178 case 0x1E: | |
2179 data[datacounter++] = PARAM_CENTI; | |
2180 data[datacounter++] = 50; | |
2181 data[datacounter++] = settingsGetPointerStandard()->setpoint[1].setpoint_cbar; | |
2182 data[datacounter++] = 160; | |
2183 break; | |
2184 | |
2185 case 0x1F: | |
2186 data[datacounter++] = PARAM_ENUM; | |
2187 data[datacounter++] = 0; | |
2188 data[datacounter++] = settingsGetPointerStandard()->CCR_Mode; | |
2189 data[datacounter++] = 1; | |
2190 break; | |
2191 | |
2192 case 0x20: | |
2193 data[datacounter++] = PARAM_ENUM; | |
2194 data[datacounter++] = 0; | |
2195 data[datacounter++] = settingsGetPointerStandard()->dive_mode; | |
2196 data[datacounter++] = 3; | |
2197 break; | |
2198 | |
2199 case 0x21: | |
2200 data[datacounter++] = PARAM_ENUM; | |
2201 data[datacounter++] = 1; | |
2202 data[datacounter++] = settingsGetPointerStandard()->deco_type.ub.standard; | |
2203 data[datacounter++] = 2; | |
2204 break; | |
2205 | |
2206 case 0x22: | |
2207 data[datacounter++] = PARAM_CENTI; | |
2208 data[datacounter++] = 100; | |
2209 data[datacounter++] = settingsGetPointerStandard()->ppO2_max_std; | |
2210 data[datacounter++] = 190; | |
2211 break; | |
2212 | |
2213 case 0x23: | |
2214 data[datacounter++] = PARAM_CENTI; | |
2215 data[datacounter++] = 15; | |
2216 data[datacounter++] = settingsGetPointerStandard()->ppO2_min; | |
2217 data[datacounter++] = 15; | |
2218 break; | |
2219 | |
2220 case 0x24: | |
2221 data[datacounter++] = PARAM_INT8; // minutes | |
2222 data[datacounter++] = 0; | |
2223 data[datacounter++] = settingsGetPointerStandard()->future_TTS; | |
2224 data[datacounter++] = 15; | |
2225 break; | |
2226 | |
2227 case 0x25: | |
2228 data[datacounter++] = PARAM_PERCENT; | |
2229 data[datacounter++] = 10; | |
2230 data[datacounter++] = settingsGetPointerStandard()->GF_low; | |
2231 data[datacounter++] = 99; | |
2232 break; | |
2233 | |
2234 case 0x26: | |
2235 data[datacounter++] = PARAM_PERCENT; | |
2236 data[datacounter++] = 45; | |
2237 data[datacounter++] = settingsGetPointerStandard()->GF_high; | |
2238 data[datacounter++] = 99; | |
2239 break; | |
2240 | |
2241 case 0x27: | |
2242 data[datacounter++] = PARAM_PERCENT; | |
2243 data[datacounter++] = 10; | |
2244 data[datacounter++] = settingsGetPointerStandard()->aGF_low; | |
2245 data[datacounter++] = 99; | |
2246 break; | |
2247 | |
2248 case 0x28: | |
2249 data[datacounter++] = PARAM_PERCENT; | |
2250 data[datacounter++] = 45; | |
2251 data[datacounter++] = settingsGetPointerStandard()->aGF_high; | |
2252 data[datacounter++] = 99; | |
2253 break; | |
2254 | |
2255 case 0x29: | |
2256 data[datacounter++] = PARAM_INT8; // conservatism +0 .. +5 | |
2257 data[datacounter++] = 0; | |
2258 data[datacounter++] = settingsGetPointerStandard()->VPM_conservatism.ub.standard; | |
2259 data[datacounter++] = 5; | |
2260 break; | |
2261 | |
2262 case 0x2A: | |
2263 case 0x2B: | |
2264 data[datacounter++] = PARAM_PERCENT; | |
2265 data[datacounter++] = 100; | |
2266 data[datacounter++] = 100;// saturation, desaturation, settingsGetPointerStandard()->; | |
2267 data[datacounter++] = 100; | |
2268 break; | |
2269 | |
2270 case 0x2C: | |
2271 data[datacounter++] = PARAM_INT8; | |
2272 data[datacounter++] = 3; | |
2273 data[datacounter++] = settingsGetPointerStandard()->last_stop_depth_meter; | |
2274 data[datacounter++] = 9; | |
2275 break; | |
2276 | |
2277 case 0x2D: | |
2278 data[datacounter++] = PARAM_ENUM; | |
2279 data[datacounter++] = 0; | |
2280 data[datacounter++] = settingsGetPointerStandard()->brightness; | |
2281 data[datacounter++] = 4; | |
2282 break; | |
2283 | |
2284 case 0x2E: | |
2285 data[datacounter++] = PARAM_ENUM; | |
2286 data[datacounter++] = 0; | |
2287 data[datacounter++] = settingsGetPointerStandard()->nonMetricalSystem; | |
2288 data[datacounter++] = 1; | |
2289 break; | |
2290 | |
2291 case 0x2F: | |
2292 data[datacounter++] = PARAM_INT8; // Sampling rate logbook | |
2293 data[datacounter++] = 2; | |
2294 data[datacounter++] = 2; | |
2295 data[datacounter++] = 2; | |
2296 break; | |
2297 | |
2298 case 0x30: | |
2299 data[datacounter++] = PARAM_PERCENT; | |
2300 data[datacounter++] = 0; | |
2301 data[datacounter++] = settingsGetPointerStandard()->salinity; | |
2302 data[datacounter++] = 4; | |
2303 break; | |
2304 | |
2305 case 0x31: | |
2306 data[datacounter++] = PARAM_INT8; | |
2307 data[datacounter++] = 0; | |
2308 data[datacounter++] = settingsGetPointerStandard()->tX_colorscheme; | |
2309 data[datacounter++] = 3; | |
2310 break; | |
2311 | |
2312 case 0x32: | |
2313 data[datacounter++] = PARAM_ENUM; | |
2314 data[datacounter++] = 0; | |
2315 data[datacounter++] = settingsGetPointerStandard()->selected_language; | |
2316 data[datacounter++] = 1; | |
2317 break; | |
2318 | |
2319 case 0x33: | |
2320 data[datacounter++] = PARAM_ENUM; | |
2321 data[datacounter++] = 0; | |
2322 data[datacounter++] = settingsGetPointerStandard()->date_format; | |
2323 data[datacounter++] = 2; | |
2324 break; | |
2325 | |
2326 case 0x34: | |
2327 data[datacounter++] = PARAM_UNKNOWN ; | |
2328 data[datacounter++] = 0; | |
2329 data[datacounter++] = 0; // compass gain, is unknown,, settingsGetPointerStandard()->; | |
2330 data[datacounter++] = 0; | |
2331 break; | |
2332 | |
2333 case 0x35: | |
2334 data[datacounter++] = PARAM_SINT; | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2335 data[datacounter++] = (uint8_t)(256 - PRESSURE_OFFSET_LIMIT_MBAR); // == -20 |
38 | 2336 if(settingsGetPointerStandard()->offsetPressure_mbar < 0) |
2337 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetPressure_mbar); | |
2338 else | |
2339 data[datacounter++] = settingsGetPointerStandard()->offsetPressure_mbar; | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2340 data[datacounter++] = PRESSURE_OFFSET_LIMIT_MBAR; |
38 | 2341 break; |
2342 | |
2343 case 0x36: | |
2344 data[datacounter++] = PARAM_BOOL; | |
2345 data[datacounter++] = 0; | |
2346 if(settingsGetPointerStandard()->safetystopDuration) | |
2347 data[datacounter++] = 1; | |
2348 else | |
2349 data[datacounter++] = 0; | |
2350 data[datacounter++] = 1; | |
2351 break; | |
2352 | |
2353 case 0x37: | |
2354 data[datacounter++] = PARAM_UNKNOWN ; | |
2355 data[datacounter++] = 0; | |
2356 data[datacounter++] = 0; // Set calibration gas, not possible with optical | |
2357 data[datacounter++] = 0; | |
2358 break; | |
2359 | |
2360 case 0x38: | |
2361 data[datacounter++] = PARAM_BOOL; | |
2362 data[datacounter++] = 0; | |
2363 data[datacounter++] = settingsGetPointerStandard()->fallbackToFixedSetpoint; | |
2364 data[datacounter++] = 1; | |
2365 break; | |
2366 | |
2367 case 0x39: | |
2368 data[datacounter++] = PARAM_BOOL; | |
2369 data[datacounter++] = 0; | |
2370 data[datacounter++] = 0; // flipscreen, not yet :-) settingsGetPointerStandard()->; | |
2371 data[datacounter++] = 0; | |
2372 break; | |
2373 | |
2374 case 0x3A: | |
2375 data[datacounter++] = PARAM_PERCENT; | |
2376 data[datacounter++] = 70; | |
2377 data[datacounter++] = settingsGetPointerStandard()->ButtonResponsiveness[3]; | |
2378 data[datacounter++] = 110; | |
2379 break; | |
2380 | |
2381 case 0x3B: | |
2382 data[datacounter++] = PARAM_UNKNOWN; | |
2383 data[datacounter++] = 0; | |
2384 data[datacounter++] = buttonBalanceTranslateArrayOutHex(settingsGetPointerStandard()->buttonBalance); | |
2385 data[datacounter++] = 128; | |
2386 break; | |
2387 | |
2388 case 0x3C: | |
2389 data[datacounter++] = PARAM_INT8; | |
2390 data[datacounter++] = 5; | |
2391 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_bottom_l_min; | |
2392 data[datacounter++] = 50; | |
2393 break; | |
2394 | |
2395 case 0x3D: | |
2396 data[datacounter++] = PARAM_INT8; | |
2397 data[datacounter++] = 5; | |
2398 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_deco_l_min; | |
2399 data[datacounter++] = 50; | |
2400 break; | |
2401 | |
2402 case 0x3E: | |
2403 data[datacounter++] = PARAM_INT8; | |
2404 data[datacounter++] = 5; | |
2405 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_travel_l_min; | |
2406 data[datacounter++] = 50; | |
2407 break; | |
2408 | |
2409 case 0x3F: | |
2410 data[datacounter++] = PARAM_UNKNOWN; | |
2411 data[datacounter++] = 0; | |
2412 data[datacounter++] = 0; // Dynamic ascend rate, not yet :-) settingsGetPointerStandard()->; | |
2413 data[datacounter++] = 0; | |
2414 break; | |
2415 | |
2416 case 0x40: | |
2417 data[datacounter++] = PARAM_BOOL; | |
2418 data[datacounter++] = 1; | |
2419 data[datacounter++] = 1; // Graphical speed indicator; | |
2420 data[datacounter++] = 1; | |
2421 break; | |
2422 | |
2423 case 0x41: | |
2424 data[datacounter++] = PARAM_BOOL; | |
2425 data[datacounter++] = 0; | |
2426 data[datacounter++] = settingsGetPointerStandard()->alwaysShowPPO2; | |
2427 data[datacounter++] = 1; | |
2428 break; | |
2429 | |
2430 case 0x42: | |
2431 data[datacounter++] = PARAM_SIGNED|PARAM_CENTI; | |
2432 data[datacounter++] = (uint8_t)(256 - 20); // == -20 | |
2433 if(settingsGetPointerStandard()->offsetTemperature_centigrad < 0) | |
2434 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetTemperature_centigrad); | |
2435 else | |
2436 data[datacounter++] = settingsGetPointerStandard()->offsetTemperature_centigrad; | |
2437 data[datacounter++] = 20; | |
2438 break; | |
2439 | |
2440 case 0x43: | |
2441 newDuration = settingsGetPointerStandard()->safetystopDuration; | |
2442 newDuration *= 60; | |
2443 if(newDuration > 255) | |
2444 newDuration = 255; | |
2445 data[datacounter++] = PARAM_INT8; | |
2446 data[datacounter++] = 60; // coud be 1 minute instead | |
2447 data[datacounter++] = (uint8_t)newDuration; | |
2448 data[datacounter++] = 255; // could be 5 minutes instead | |
2449 break; | |
2450 | |
2451 case 0x44: | |
2452 data[datacounter++] = PARAM_INT8; | |
2453 data[datacounter++] = 30; // coud be 3 meter instead | |
2454 data[datacounter++] = settingsGetPointerStandard()->safetystopDepth * 10; | |
2455 data[datacounter++] = 60; // could be 6 meter instead | |
2456 break; | |
2457 | |
2458 case 0x45: | |
2459 case 0x46: | |
2460 data[datacounter++] = PARAM_UNKNOWN; | |
2461 data[datacounter++] = 0; | |
2462 data[datacounter++] = 0; // SafetyStop End Depth and SafetyStop Reset Depth | |
2463 data[datacounter++] = 0; | |
2464 break; | |
2465 | |
2466 case 0x47: | |
2467 data[datacounter++] = PARAM_INT15; | |
2468 data[datacounter++] = 0; | |
2469 data[datacounter++] = 0; | |
2470 data[datacounter++] = settingsGetPointerStandard()->logbookOffset & 0xFF; | |
2471 data[datacounter++] = settingsGetPointerStandard()->logbookOffset / 0xFF; | |
2472 data[datacounter++] = 9000 & 0xFF; | |
2473 data[datacounter++] = 9000 / 0xFF; | |
2474 break; | |
2475 | |
2476 case 0x70: | |
2477 data[datacounter++] = PARAM_BOOL; | |
2478 data[datacounter++] = 0; | |
2479 data[datacounter++] = settingsGetPointerStandard()->showDebugInfo; | |
2480 data[datacounter++] = 1; | |
2481 break; | |
2482 | |
2483 case 0x71: | |
2484 data[datacounter++] = PARAM_ENUM; | |
2485 data[datacounter++] = 0; | |
2486 data[datacounter++] = settingsGetPointerStandard()->extraDisplay; | |
2487 data[datacounter++] = (EXTRADISPLAY_END - 1); | |
2488 break; | |
2489 | |
2490 case 0x72: | |
2491 data[datacounter++] = PARAM_ENUM; | |
2492 data[datacounter++] = 0; | |
2493 data[datacounter++] = settingsGetPointerStandard()->tX_customViewPrimary; | |
2494 data[datacounter++] = 8; | |
2495 break; | |
2496 | |
2497 case 0x73: | |
2498 data[datacounter++] = PARAM_INT8; | |
2499 data[datacounter++] = 0; | |
2500 data[datacounter++] = settingsGetPointerStandard()->tX_customViewTimeout; | |
2501 data[datacounter++] = 60; | |
2502 break; | |
2503 | |
2504 case 0x74: | |
2505 data[datacounter++] = PARAM_ENUM; | |
2506 data[datacounter++] = 1; | |
2507 data[datacounter++] = settingsGetPointerStandard()->tX_userselectedLeftLowerCornerPrimary; | |
2508 data[datacounter++] = 7; | |
2509 break; | |
2510 | |
2511 case 0x75: | |
2512 data[datacounter++] = PARAM_INT8; | |
2513 data[datacounter++] = 0; | |
2514 data[datacounter++] = settingsGetPointerStandard()->tX_userselectedLeftLowerCornerTimeout; | |
2515 data[datacounter++] = 60; | |
2516 break; | |
2517 } | |
2518 | |
2519 if(datacounter == 0) | |
2520 { | |
2521 data[datacounter++] = PARAM_UNKNOWN; | |
2522 data[datacounter++] = 0; | |
2523 data[datacounter++] = 0; // SafetyStop End Depth and SafetyStop Reset Depth | |
2524 data[datacounter++] = 0; | |
2525 } | |
2526 | |
2527 return datacounter; | |
2528 } | |
2529 | |
2530 | |
2531 uint8_t readData(uint8_t what, uint8_t * data) | |
2532 { | |
2533 data[0] = 0; | |
2534 data[1] = 0; | |
2535 data[2] = 0; | |
2536 data[3] = 0; | |
2537 switch(what) | |
2538 { | |
2539 case 0x10: | |
2540 return getGas(1,data); | |
2541 case 0x11: | |
2542 return getGas(2,data); | |
2543 case 0x12: | |
2544 return getGas(3,data); | |
2545 case 0x13: | |
2546 return getGas(4,data); | |
2547 case 0x14: | |
2548 return getGas(5,data); | |
2549 case 0x15: | |
2550 return getDiluent(1,data); | |
2551 case 0x16: | |
2552 return getDiluent(2,data); | |
2553 case 0x17: | |
2554 return getDiluent(3,data); | |
2555 case 0x18: | |
2556 return getDiluent(4,data); | |
2557 case 0x19: | |
2558 return getDiluent(5,data); | |
2559 case 0x1A: | |
2560 return getSetpoint(1,data); | |
2561 case 0x1B: | |
2562 return getSetpoint(2,data); | |
2563 case 0x1C: | |
2564 return getSetpoint(3,data); | |
2565 case 0x1D: | |
2566 return getSetpoint(4,data); | |
2567 case 0x1E: | |
2568 return getSetpoint(5,data); | |
2569 case 0x1F: | |
2570 data[0] = Settings.CCR_Mode; | |
2571 break; | |
2572 case 0x20: | |
2573 data[0] = Settings.dive_mode; | |
2574 break; | |
2575 case 0x21: | |
2576 data[0] = Settings.deco_type.ub.standard; | |
2577 break; | |
2578 case 0x22: | |
2579 data[0] = Settings.ppO2_max_std; | |
2580 break; | |
2581 case 0x23: | |
2582 data[0] = Settings.ppO2_min; | |
2583 break; | |
2584 case 0x24: | |
2585 data[0] = Settings.future_TTS; | |
2586 break; | |
2587 case 0x25: | |
2588 data[0] = Settings.GF_low; | |
2589 break; | |
2590 case 0x26: | |
2591 data[0] = Settings.GF_high; | |
2592 break; | |
2593 case 0x27: | |
2594 data[0] = Settings.aGF_low; | |
2595 break; | |
2596 case 0x28: | |
2597 data[0] = Settings.aGF_high; | |
2598 break; | |
2599 case 0x29: | |
2600 data[0] = Settings.VPM_conservatism.ub.standard; | |
2601 break; | |
2602 case 0x2A: | |
2603 case 0x2B: | |
2604 data[0] = 100; | |
2605 break; | |
2606 case 0x2C: | |
2607 data[0] = Settings.last_stop_depth_meter; | |
2608 break; | |
2609 case 0x2D: | |
2610 data[0] = Settings.brightness; | |
2611 break; | |
2612 case 0x2E: | |
2613 data[0] = Settings.nonMetricalSystem; | |
2614 break; | |
2615 case 0x2F: | |
2616 data[0] = 0; // 0 == 2 sec sampling rate | |
2617 break; | |
2618 case 0x30: | |
2619 data[0] = Settings.salinity; | |
2620 break; | |
2621 case 0x31: | |
2622 data[0] = Settings.tX_colorscheme; | |
2623 break; | |
2624 case 0x32: | |
2625 data[0] = Settings.selected_language; | |
2626 break; | |
2627 case 0x33: | |
2628 data[0] = Settings.date_format; | |
2629 break; | |
2630 case 0x34: | |
2631 data[0] = 7; // gain should be always 7 as far as I understand the code in RTE | |
2632 break; | |
2633 case 0x35: | |
2634 data[0] = Settings.offsetPressure_mbar; | |
2635 break; | |
2636 case 0x36: | |
2637 if(Settings.safetystopDepth) | |
2638 data[0] = 1; | |
2639 else | |
2640 data[0] = 0; | |
2641 break; | |
2642 case 0x37: | |
2643 data[0] = 0; // calibration gas %O2 -> 0 no gas :-) | |
2644 break; | |
2645 case 0x38: | |
2646 data[0] = Settings.fallbackToFixedSetpoint; | |
2647 break; | |
2648 case 0x39: | |
2649 data[0] = 0; // flip screen | |
2650 break; | |
2651 case 0x3A: | |
2652 data[0] = Settings.ButtonResponsiveness[3]; | |
2653 break; | |
2654 case 0x3B: | |
2655 data[0] = buttonBalanceTranslateArrayOutHex(settingsGetPointer()->buttonBalance); | |
2656 break; | |
2657 case 0x3C: | |
2658 data[0] = Settings.gasConsumption_bottom_l_min; | |
2659 break; | |
2660 case 0x3D: | |
2661 data[0] = Settings.gasConsumption_deco_l_min; | |
2662 break; | |
2663 case 0x3E: | |
2664 data[0] = Settings.gasConsumption_travel_l_min; | |
2665 break; | |
2666 case 0x3F: | |
2667 data[0] = 0; // fixed ascend rate 10 m/min | |
2668 break; | |
2669 case 0x40: | |
2670 data[0] = 1; // graphical speed indicator | |
2671 break; | |
2672 case 0x41: | |
2673 data[0] = Settings.alwaysShowPPO2; | |
2674 break; | |
2675 case 0x42: | |
2676 data[0] = Settings.offsetTemperature_centigrad; | |
2677 break; | |
2678 case 0x43: | |
2679 if(Settings.safetystopDuration > 4) | |
2680 data[0] = 255; // seconds | |
2681 else | |
2682 data[0] = 60 * Settings.safetystopDuration; | |
2683 break; | |
2684 case 0x44: | |
2685 data[0] = Settings.safetystopDepth * 10; // cbar instead of meter | |
2686 break; | |
2687 case 0x45: | |
2688 if(Settings.safetystopDepth == 3) | |
2689 data[0] = 20; // cbar | |
2690 else | |
2691 data[0] = 30; // cbar | |
2692 break; | |
2693 case 0x46: | |
2694 data[0] = 10; // reset at 10 meter as far as I understood | |
2695 break; | |
2696 case 0x47: | |
2697 data[0] = Settings.logbookOffset & 0xFF; | |
2698 data[1] = Settings.logbookOffset / 0xFF; | |
2699 break; | |
2700 case 0x70: | |
2701 data[0] = Settings.showDebugInfo; | |
2702 break; | |
2703 case 0x71: | |
2704 data[0] = Settings.extraDisplay; | |
2705 break; | |
2706 case 0x72: | |
2707 data[0] = Settings.tX_customViewPrimary; | |
2708 break; | |
2709 case 0x73: | |
2710 data[0] = Settings.tX_customViewTimeout; | |
2711 break; | |
2712 case 0x74: | |
2713 data[0] = Settings.tX_userselectedLeftLowerCornerPrimary; | |
2714 break; | |
2715 case 0x75: | |
2716 data[0] = Settings.tX_userselectedLeftLowerCornerTimeout; | |
2717 break; | |
2718 } | |
2719 return 0x4D; | |
2720 } | |
2721 | |
2722 | |
2723 uint8_t RTEminimum_required_high(void) | |
2724 { | |
2725 return RTErequiredHigh; | |
2726 } | |
2727 uint8_t RTEminimum_required_low(void) | |
2728 { | |
2729 return RTErequiredLow; | |
2730 } | |
2731 | |
2732 uint8_t FONTminimum_required_high(void) | |
2733 { | |
2734 return FONTrequiredHigh; | |
2735 } | |
2736 uint8_t FONTminimum_required_low(void) | |
2737 { | |
2738 return FONTrequiredLow; | |
2739 } | |
2740 | |
2741 | |
2742 void setActualRTEversion(uint8_t high, uint8_t low) | |
2743 { | |
2744 RTEactualHigh = high; | |
2745 RTEactualLow = low; | |
2746 } | |
2747 | |
2748 | |
2749 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow) | |
2750 { | |
2751 if(RTEhigh && RTElow) | |
2752 { | |
2753 *RTEhigh = RTEactualHigh; | |
2754 *RTElow = RTEactualLow; | |
2755 } | |
2756 if(FONThigh && FONTlow) | |
2757 { | |
2758 *FONThigh = *(uint8_t *)0x08132000; | |
2759 *FONTlow = *(uint8_t *)0x08132001; | |
2760 } | |
2761 } | |
2762 | |
2763 | |
2764 uint8_t getLicence(void) | |
2765 { | |
2766 return hardwareDataGetPointer()->primaryLicence; | |
2767 } | |
2768 | |
2769 | |
2770 void firmwareGetDate(RTC_DateTypeDef *SdateOutput) | |
2771 { | |
2772 SdateOutput->Year = firmwareDataGetPointer()->release_year; | |
2773 SdateOutput->Month = firmwareDataGetPointer()->release_month; | |
2774 SdateOutput->Date = firmwareDataGetPointer()->release_day; | |
2775 } | |
2776 | |
2777 | |
2778 // this should use device specific values stored in OTPROG ROM soon | |
2779 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray) | |
2780 { | |
2781 *basePercentage = settingsGetPointerStandard()->ButtonResponsiveness[3]; | |
2782 | |
2783 for(int i=0;i<3;i++) | |
2784 { | |
2785 buttonBalanceArray[i] = settingsGetPointerStandard()->buttonBalance[i]; | |
2786 } | |
2787 } | |
2788 | |
2789 | |
2790 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray) | |
2791 { | |
2792 if(hexValue > 127) | |
2793 return 0; | |
2794 // internal order: 0 = right, 1 = center, 2 = left | |
2795 // external order: Factory,left,center,right | |
2796 outputArray[0] = 2 + (hexValue & 0x03); | |
2797 hexValue /= 4; | |
2798 outputArray[1] = 2 + (hexValue & 0x03); | |
2799 hexValue /= 4; | |
2800 outputArray[2] = 2 + (hexValue & 0x03); | |
2801 | |
2802 return 1; | |
2803 } | |
2804 | |
2805 | |
2806 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray) | |
2807 { | |
2808 uint8_t hexValue = 0; | |
2809 | |
2810 if(inputArray[2] > 2) | |
2811 { | |
2812 hexValue += inputArray[2] - 2; | |
2813 } | |
2814 hexValue *= 4; | |
2815 | |
2816 if(inputArray[1] > 2) | |
2817 { | |
2818 hexValue += inputArray[1] - 2; | |
2819 } | |
2820 hexValue *= 4; | |
2821 if(inputArray[0] > 2) | |
2822 { | |
2823 hexValue += inputArray[0] - 2; | |
2824 } | |
2825 return hexValue; | |
2826 } | |
2827 | |
2828 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray) | |
2829 { | |
2830 if((inputValueRaw >= 70) && (inputValueRaw <= 110)) | |
2831 { | |
2832 Settings.FactoryButtonBase = inputValueRaw; | |
2833 } | |
2834 for(int i=0;i<3;i++) | |
2835 { | |
2836 if((inputBalanceArray[i] >= 2) && (inputBalanceArray[i] <= 5)) | |
2837 { | |
2838 Settings.FactoryButtonBalance[i] = inputBalanceArray[i]; | |
2839 } | |
2840 } | |
2841 } | |
2842 | |
2843 | |
2844 /** | |
2845 ****************************************************************************** | |
2846 * @brief settingsHelperButtonSens. / make 32 bit input to three buttons + storage value in [3] | |
2847 * @author heinrichs weikamp gmbh | |
2848 * @version V 01 | |
2849 * @date 19-Sept-2016 | |
2850 ****************************************************************************** | |
2851 * | |
2852 * @param inputValueRaw: | |
2853 * @param outArray4Values: [0] is right, [1] is center, [2] is left, [3] is original value with zero balance | |
2854 * @retval None | |
2855 */ | |
2856 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values) | |
2857 { | |
2858 uint32_t newSensitivity; | |
2859 | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2860 if(inputValueRaw > MAX_BUTTONRESPONSIVENESS) |
38 | 2861 { |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2862 inputValueRaw = MAX_BUTTONRESPONSIVENESS; |
38 | 2863 } |
2864 else | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2865 if(inputValueRaw < MIN_BUTTONRESPONSIVENESS) |
38 | 2866 { |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2867 inputValueRaw = MIN_BUTTONRESPONSIVENESS; |
38 | 2868 } |
2869 | |
2870 // the unbalanced value | |
2871 outArray4Values[3] = inputValueRaw; | |
2872 | |
2873 // the balanced values | |
2874 for(int i=0;i<3;i++) | |
2875 { | |
2876 newSensitivity = inputValueRaw; | |
2877 switch(settingsGetPointer()->buttonBalance[i]) | |
2878 { | |
2879 case 1: // should not be an option hw 170508 | |
2880 newSensitivity -= 20; | |
2881 break; | |
2882 case 2: | |
2883 newSensitivity -= 10; | |
2884 break; | |
2885 default: | |
2886 break; | |
2887 case 4: | |
2888 newSensitivity += 10; | |
2889 break; | |
2890 case 5: | |
2891 newSensitivity += 20; | |
2892 break; | |
2893 } | |
2894 | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2895 if(newSensitivity > MAX_BUTTONRESPONSIVENESS) |
38 | 2896 { |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
2897 newSensitivity = MAX_BUTTONRESPONSIVENESS; |
38 | 2898 } |
2899 outArray4Values[i] = newSensitivity; | |
2900 } | |
2901 } | |
2902 | |
2903 | |
2904 /** | |
2905 ****************************************************************************** | |
2906 * @brief settingsHelperButtonSens_translate_to_hwOS_values. / make 32 bit input to three buttons + storage value in [3] | |
2907 * @author heinrichs weikamp gmbh | |
2908 * @version V 01 | |
2909 * @date 19-Sept-2016 | |
2910 ****************************************************************************** | |
2911 * | |
2912 * @param inputValueRaw: | |
2913 * @param outArray4Values: [0] is right, [1] is center, [2] is left, [3] is original value with zero balance | |
2914 * @retval None | |
2915 */ | |
2916 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values) | |
2917 { | |
2918 uint32_t newSensitivity; | |
2919 | |
2920 for(int i=0;i<3;i++) | |
2921 { | |
2922 newSensitivity = inputValueRaw; | |
2923 switch(settingsGetPointer()->buttonBalance[i]) | |
2924 { | |
2925 case 1: | |
2926 newSensitivity -= 20; | |
2927 break; | |
2928 case 2: | |
2929 newSensitivity -= 10; | |
2930 break; | |
2931 default: | |
2932 break; | |
2933 case 4: | |
2934 newSensitivity += 10; | |
2935 break; | |
2936 case 5: | |
2937 newSensitivity += 20; | |
2938 break; | |
2939 } | |
2940 | |
2941 if(newSensitivity > 100) | |
2942 { | |
2943 if(newSensitivity <= 105) | |
2944 newSensitivity = 10; | |
2945 else | |
2946 newSensitivity = 7; | |
2947 } | |
2948 else | |
2949 { | |
2950 newSensitivity *= 24; | |
2951 newSensitivity = 2400 - newSensitivity; | |
2952 newSensitivity /= 10; | |
2953 | |
2954 newSensitivity += 15; | |
2955 if(newSensitivity > 255) | |
2956 newSensitivity = 255; | |
2957 } | |
2958 outArray4Values[i] = newSensitivity; | |
2959 } | |
2960 | |
2961 // the unbalanced value | |
2962 newSensitivity = inputValueRaw; | |
2963 if(newSensitivity > 100) | |
2964 { | |
2965 if(newSensitivity <= 105) | |
2966 newSensitivity = 10; | |
2967 else | |
2968 newSensitivity = 7; | |
2969 } | |
2970 else | |
2971 { | |
2972 newSensitivity *= 24; | |
2973 newSensitivity = 2400 - newSensitivity; | |
2974 newSensitivity /= 10; | |
2975 | |
2976 newSensitivity += 15; | |
2977 if(newSensitivity > 255) | |
2978 newSensitivity = 255; | |
2979 } | |
2980 outArray4Values[3] = newSensitivity; | |
2981 } | |
2982 | |
2983 | |
2984 /** | |
2985 ****************************************************************************** | |
2986 * @brief settingsHelperButtonSens_translate_percentage_to_hwOS_values. | |
2987 * @author heinrichs weikamp gmbh | |
2988 * @version V 01 | |
2989 * @date 6-March-2017 | |
2990 ****************************************************************************** | |
2991 * | |
2992 * @param inputValuePercentage with buttonBalance included | |
2993 * @retval PIC compatible value | |
2994 */ | |
2995 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage) | |
2996 { | |
2997 uint32_t newSensitivity = inputValuePercentage; | |
2998 | |
2999 if(newSensitivity > 100) | |
3000 { | |
3001 if(newSensitivity <= 105) | |
3002 newSensitivity = 10; | |
3003 else | |
3004 newSensitivity = 7; | |
3005 } | |
3006 else | |
3007 { | |
3008 newSensitivity *= 24; | |
3009 newSensitivity = 2400 - newSensitivity; | |
3010 newSensitivity /= 10; | |
3011 | |
3012 newSensitivity += 15; | |
3013 if(newSensitivity > 255) | |
3014 newSensitivity = 255; | |
3015 } | |
3016 return (uint8_t)newSensitivity; | |
3017 } | |
3018 | |
3019 | |
3020 /** | |
3021 ****************************************************************************** | |
3022 * @brief settingsHelperButtonSens_translate_hwOS_values_to_percentage. | |
3023 * @author heinrichs weikamp gmbh | |
3024 * @version V 01 | |
3025 * @date 6-March-2017 | |
3026 ****************************************************************************** | |
3027 * | |
3028 * @param PIC compatible value | |
3029 * @retval Percentage | |
3030 */ | |
3031 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC) | |
3032 { | |
3033 if(inputValuePIC >= 15) | |
3034 { | |
3035 return(uint8_t)((25500 - (inputValuePIC)*100) / 240); | |
3036 } | |
3037 else | |
3038 { | |
3039 if(inputValuePIC >= 10) | |
3040 { | |
3041 return 105; | |
3042 } | |
3043 else | |
3044 { | |
3045 return 110; | |
3046 } | |
3047 } | |
3048 } | |
662 | 3049 |
3050 void reset_SettingWarning() | |
3051 { | |
3052 settingsWarning = 0; | |
3053 } | |
3054 inline uint8_t isSettingsWarning() | |
3055 { | |
3056 return settingsWarning; | |
3057 } | |
3058 |