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