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