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