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