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