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