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