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