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