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