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