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