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