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