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