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