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