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