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