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