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