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