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