Mercurial > public > ostc4
annotate Discovery/Src/settings.c @ 1014:8c0134a287da GasConsumption
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
is decremented. The event contains a 12 bit signed integer for the remaining scrubber duration, and two
flags for scrubber warning (0x2000, <= 30 minutes remaining) and scrubber error (0x4000, <= 0 minutes remaining).
(mikeller)
| author | heinrichsweikamp |
|---|---|
| date | Sun, 11 May 2025 16:18:20 +0200 |
| parents | 085e9c04b76b |
| children | 5924a2d1d3ba |
| 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; |
|
1011
085e9c04b76b
make sure version number is increased after releases
heinrichsweikamp
parents:
1001
diff
changeset
|
50 const uint8_t RTErequiredLow = 6; |
| 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, |
|
1011
085e9c04b76b
make sure version number is increased after releases
heinrichsweikamp
parents:
1001
diff
changeset
|
69 .versionThird = 2, |
| 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, | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
333 .scrubTimerMode = SCRUB_TIMER_MINUTES, |
| 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; |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
504 pSettings->cv_configuration &= ~(1 << CVIEW_sensors | 1 << CVIEW_sensors_mV | 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; |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
512 pSettings->cv_config_BigScreen &= 1 << (CVIEW_T3_Navigation + LEGACY_T3_START_ID_PRE_TIMER); |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
513 pSettings->cv_config_BigScreen &= 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; |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
518 pSettings->cv_config_BigScreen &= 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; | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
537 pSettings->scrubTimerMode = SCRUB_TIMER_MINUTES; |
| 662 | 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: |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
550 pSettings->scrubberActiveId = 0; |
| 710 | 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 */ |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1770 if (Settings.scrubberActiveId > 0x03) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1771 /* scrubber active is used as bitfield => two timer => 2 bits in use */ |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1772 Settings.scrubberActiveId = 0x00; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1773 corrections++; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
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 } |
|
1001
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
997
diff
changeset
|
1784 parameterId++; /* 93 */ |
| 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 */ |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1793 if (Settings.scrubTimerMode == INVALID_SCRUB_TIMER_OFF || Settings.scrubTimerMode > SCRUB_TIMER_END) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1794 Settings.scrubTimerMode = SCRUB_TIMER_MINUTES; |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1795 corrections++; |
| 820 | 1796 setFirstCorrection(parameterId); |
|
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
1797 } |
| 997 | 1798 parameterId++; /* 95 */ |
| 662 | 1799 if((Settings.pscr_lung_ratio > PSCR_MAX_LUNG_RATIO) || (Settings.pscr_lung_ratio < PSCR_MIN_LUNG_RATIO)) |
| 1800 { | |
| 1801 Settings.pscr_lung_ratio = 10; | |
| 1802 corrections++; | |
| 820 | 1803 setFirstCorrection(parameterId); |
| 662 | 1804 } |
| 997 | 1805 parameterId++; /* 96 */ |
| 662 | 1806 if(Settings.pscr_o2_drop > PSCR_MAX_O2_DROP) |
| 1807 { | |
| 1808 Settings.pscr_o2_drop = 4; | |
| 1809 corrections++; | |
| 820 | 1810 setFirstCorrection(parameterId); |
| 662 | 1811 } |
| 997 | 1812 parameterId++; /* 97 */ |
| 662 | 1813 if(Settings.co2_sensor_active > 1) |
| 1814 { | |
| 1815 Settings.co2_sensor_active = 0; | |
| 1816 corrections++; | |
| 820 | 1817 setFirstCorrection(parameterId); |
| 662 | 1818 } |
| 997 | 1819 parameterId++; /* 98 */ |
| 710 | 1820 if(Settings.ext_uart_protocol > UART_MAX_PROTOCOL) |
| 687 | 1821 { |
| 1822 Settings.ext_uart_protocol = 0; | |
| 1823 corrections++; | |
| 820 | 1824 setFirstCorrection(parameterId); |
| 687 | 1825 } |
| 997 | 1826 parameterId++; /* 99 */ |
|
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1827 if((Settings.ext_sensor_map[0] >= SENSOR_END) |
|
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1828 || (Settings.ext_sensor_map[1] >= SENSOR_END) |
|
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1829 || (Settings.ext_sensor_map[2] >= SENSOR_END) |
|
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1830 || (Settings.ext_sensor_map[3] >= SENSOR_END) |
| 796 | 1831 || (Settings.ext_sensor_map[4] >= SENSOR_END) |
| 1832 || (Settings.ext_sensor_map[5] >= SENSOR_END) | |
| 1833 || (Settings.ext_sensor_map[6] >= SENSOR_END) | |
| 1834 || (Settings.ext_sensor_map[7] >= SENSOR_END)) | |
|
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1835 { |
| 733 | 1836 Settings.ext_sensor_map[0] = SENSOR_OPTIC; |
| 1837 Settings.ext_sensor_map[1] = SENSOR_OPTIC; | |
| 1838 Settings.ext_sensor_map[2] = SENSOR_OPTIC; | |
|
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1839 Settings.ext_sensor_map[3] = SENSOR_NONE; |
|
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1840 Settings.ext_sensor_map[4] = SENSOR_NONE; |
| 796 | 1841 Settings.ext_sensor_map[5] = SENSOR_NONE; |
| 1842 Settings.ext_sensor_map[6] = SENSOR_NONE; | |
| 1843 Settings.ext_sensor_map[7] = SENSOR_NONE; | |
|
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1844 corrections++; |
| 820 | 1845 setFirstCorrection(parameterId); |
|
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
715
diff
changeset
|
1846 } |
| 997 | 1847 parameterId++; /* 100 */ |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1848 if(Settings.buttonLockActive > 1) |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1849 { |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1850 Settings.buttonLockActive = 1; |
|
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1851 corrections++; |
| 820 | 1852 setFirstCorrection(parameterId); |
|
740
5078da3845c0
Added button lock after wakeup in surface mode:
Ideenmodellierer
parents:
733
diff
changeset
|
1853 } |
| 997 | 1854 parameterId++; /* 101 */ |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
1855 if (Settings.compassDeclinationDeg > MAX_COMPASS_DECLINATION_DEG) { |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
1856 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
|
1857 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
768
diff
changeset
|
1858 corrections++; |
| 820 | 1859 setFirstCorrection(parameterId); |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
1860 } else if (Settings.compassDeclinationDeg < -MAX_COMPASS_DECLINATION_DEG) { |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
1861 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
|
1862 |
|
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
768
diff
changeset
|
1863 corrections++; |
| 820 | 1864 setFirstCorrection(parameterId); |
|
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
768
diff
changeset
|
1865 } |
| 997 | 1866 parameterId++; /* 102 */ |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
801
diff
changeset
|
1867 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
|
1868 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 |
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
801
diff
changeset
|
1870 corrections++; |
| 820 | 1871 setFirstCorrection(parameterId); |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
801
diff
changeset
|
1872 } 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
|
1873 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 |
|
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
801
diff
changeset
|
1875 corrections++; |
| 820 | 1876 setFirstCorrection(parameterId); |
|
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
801
diff
changeset
|
1877 } |
| 997 | 1878 parameterId++; /* 103 */ |
|
834
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
830
diff
changeset
|
1879 if(Settings.cvAutofocus > 1) |
|
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
830
diff
changeset
|
1880 { |
|
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
830
diff
changeset
|
1881 corrections++; |
|
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
830
diff
changeset
|
1882 Settings.cvAutofocus = 0; |
|
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
830
diff
changeset
|
1883 } |
| 997 | 1884 parameterId++; /* 104 */ |
| 949 | 1885 if((Settings.timeZone.hours > 14) |
| 1886 || (Settings.timeZone.hours < -12) | |
| 1887 || (Settings.timeZone.minutes > 45)) | |
| 1888 { | |
| 1889 Settings.timeZone.hours = 0; | |
| 1890 Settings.timeZone.minutes = 0; | |
| 1891 corrections++; | |
| 1892 } | |
| 997 | 1893 parameterId++; /* 105 */ |
| 662 | 1894 if(corrections) |
| 1895 { | |
| 1896 settingsWarning = 1; | |
| 1897 } | |
| 1898 else | |
| 1899 | |
| 38 | 1900 if(corrections > 255) |
| 662 | 1901 { |
| 1902 corrections = 255; | |
| 1903 } | |
| 1904 | |
| 820 | 1905 SettingsStatus.Corrections = corrections; |
| 662 | 1906 return (uint8_t)corrections; |
| 38 | 1907 } |
| 1908 | |
| 870 | 1909 #ifndef BOOTLOADER_STANDALONE |
| 38 | 1910 /* always at 0x8080000, do not move -> bootloader access */ |
| 1911 const SFirmwareData* firmwareDataGetPointer(void) | |
| 1912 { | |
| 1913 return &firmware_FirmwareData; | |
| 1914 } | |
| 1915 | |
| 1916 | |
| 1917 #ifndef SPECIALPROGRAMM | |
| 1918 const SHardwareData* hardwareDataGetPointer(void) | |
| 1919 { | |
| 1920 return (SHardwareData *)HARDWAREDATA_ADDRESS; | |
| 1921 } | |
| 1922 #endif | |
| 870 | 1923 #endif |
| 38 | 1924 const SSettings* settingsGetPointerStandard(void) |
| 1925 { | |
| 1926 return &SettingsStandard; | |
| 1927 } | |
| 1928 | |
| 1929 | |
| 1930 void hardwareBatchCode(uint8_t *high, uint8_t *low) | |
| 1931 { | |
| 1932 if(high) | |
| 1933 { | |
| 1934 *high = (uint8_t)((hardwareDataGetPointer()->production_year - 16) * 16); | |
| 1935 *high += hardwareDataGetPointer()->production_month; | |
| 1936 if(low) | |
| 1937 { | |
| 1938 *low = (uint8_t)(hardwareDataGetPointer()->production_day * 8); | |
| 1939 } | |
| 1940 } | |
| 1941 } | |
| 1942 | |
| 1943 | |
| 1944 uint8_t firmwareVersion_16bit_high(void) | |
| 1945 { | |
|
319
d8e86af78474
bugfix: correct packed main version number in dive header
Jan Mulder <jlmulder@xs4all.nl>
parents:
286
diff
changeset
|
1946 return ((firmware_FirmwareData.versionFirst & 0x1F) << 3) + ((firmware_FirmwareData.versionSecond & 0x1C) >> 2); |
| 38 | 1947 } |
| 1948 | |
| 1949 uint8_t firmwareVersion_16bit_low(void) | |
| 1950 { | |
| 1951 return ((firmware_FirmwareData.versionSecond & 0x03) << 6) + ((firmware_FirmwareData.versionThird & 0x1F) << 1) + (firmware_FirmwareData.versionBeta & 0x01); | |
| 1952 } | |
| 1953 | |
|
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
|
1954 inline SSettings* settingsGetPointer(void) |
| 38 | 1955 { |
| 1956 return &Settings; | |
| 1957 } | |
| 1958 | |
| 1959 | |
| 1960 // =============================================================================== | |
| 1961 // set_settings_to_Standard | |
| 1962 /// @brief This function overwrites the current settings of the system | |
| 1963 /// with the EXCEPTION of the personalDiveCount | |
| 1964 /// | |
| 1965 /// It additionally calls set_new_settings_missing_in_ext_flash() and | |
| 1966 /// check_and_correct_settings(), even so this shouldn't be necessary. | |
| 1967 /// It is called on every start and from Reset All. | |
| 1968 /// | |
| 1969 /// 160622 added lastDiveLogIdBackup | |
| 1970 /// | |
| 1971 // =============================================================================== | |
| 1972 void set_settings_to_Standard(void) | |
| 1973 { | |
| 1974 SSettings *pSettings; | |
| 1975 const SSettings *pSettingsStandard; | |
| 1976 uint16_t personalDiveCountBackup; | |
| 1977 uint8_t lastDiveLogIdBackup; | |
| 997 | 1978 uint32_t sampleStartBackup; |
| 38 | 1979 pSettings = settingsGetPointer(); |
| 1980 pSettingsStandard = settingsGetPointerStandard(); | |
| 1981 | |
| 1982 personalDiveCountBackup = pSettings->personalDiveCount; | |
| 1983 lastDiveLogIdBackup = pSettings->lastDiveLogId; | |
| 997 | 1984 sampleStartBackup = pSettings->logFlashNextSampleStartAddress; |
| 1985 | |
| 38 | 1986 memcpy(pSettings,pSettingsStandard,sizeof(*pSettings)); |
| 1987 pSettings->personalDiveCount = personalDiveCountBackup; | |
| 1988 pSettings->lastDiveLogId = lastDiveLogIdBackup; | |
| 997 | 1989 pSettings->logFlashNextSampleStartAddress = sampleStartBackup; |
| 38 | 1990 |
| 1991 pSettings->firmwareVersion[0] = firmware_FirmwareData.versionFirst; | |
| 1992 pSettings->firmwareVersion[1] = firmware_FirmwareData.versionSecond; | |
| 1993 pSettings->firmwareVersion[2] = firmware_FirmwareData.versionThird; | |
| 1994 pSettings->firmwareVersion[3] = firmware_FirmwareData.versionBeta; | |
| 1995 | |
| 997 | 1996 memset(pSettings->customtext,0,60); |
| 1997 sprintf(pSettings->customtext," <your name>\n <address>"); | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
1998 pSettings->cv_configuration &= ~(1 << CVIEW_sensors | 1 << CVIEW_sensors_mV | 1 << CVIEW_Timer); |
| 997 | 1999 |
| 38 | 2000 set_new_settings_missing_in_ext_flash(); |
| 2001 check_and_correct_settings(); | |
| 2002 // has to be called too: createDiveSettings(); | |
| 2003 } | |
| 2004 | |
| 2005 | |
| 2006 // =============================================================================== | |
| 2007 // mod_settings_for_first_start_with_empty_ext_flash | |
| 2008 /// @brief This function overwrites some settings of the system | |
| 2009 /// It is called on every start. | |
| 2010 /// Those settings will be overwriten by ext_flash_read_settings() | |
| 2011 /// Will be kept if ext_flash_read_settings() is invalid because | |
| 2012 /// it is still empty. | |
| 2013 /// | |
| 2014 // =============================================================================== | |
| 2015 void mod_settings_for_first_start_with_empty_ext_flash(void) | |
| 2016 { | |
| 2017 settingsGetPointer()->debugModeOnStart = 1; // | |
| 2018 } | |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 // =============================================================================== | |
| 2023 // hwOS4_to_hwOS_GasType | |
| 2024 /// @brief Helper for get gas / diluent | |
| 2025 /// | |
| 2026 // =============================================================================== | |
| 2027 uint8_t hwOS4_to_hwOS_GasType(uint8_t inOSTC4style) | |
| 2028 { | |
| 2029 switch(inOSTC4style) | |
| 2030 { | |
| 2031 case (1+2): // first | |
| 2032 case (2): // first | |
| 2033 return 1; // hwOS style first | |
| 2034 case (1+4): // deco | |
| 2035 case (4): // deco | |
| 2036 return 3; // hwOS style deco | |
| 2037 case (1+8): // travel | |
| 2038 case (8): // travel | |
| 2039 return 2; // hwOS style travel | |
| 2040 default: | |
| 2041 return 0; // hwOS style Disabled | |
| 2042 } | |
| 2043 } | |
| 2044 | |
| 2045 | |
| 2046 // =============================================================================== | |
| 2047 // hwOS_to_hwOS4_GasType | |
| 2048 /// @brief Helper for set gas / diluent | |
| 2049 /// | |
| 2050 // =============================================================================== | |
| 2051 uint8_t hwOS_to_hwOS4_GasType(uint8_t inOSTC4style) | |
| 2052 { | |
| 2053 switch(inOSTC4style) | |
| 2054 { | |
| 2055 case (1): // first | |
| 2056 return 1+2; // hwOS4 style first | |
| 2057 case (2): // travel (normal for diluent) | |
| 2058 return 1+8; // hwOS4 style travel | |
| 2059 case (3): // deco | |
| 2060 return 1+4; // hwOS4 style deco | |
| 2061 default: | |
| 2062 return 0; // hwOS4 style inactive | |
| 2063 } | |
| 2064 } | |
| 2065 | |
| 2066 | |
| 2067 | |
| 2068 // =============================================================================== | |
| 2069 // setGas | |
| 2070 /// @brief This function overwrites one gas, including mode and deco depth, | |
| 2071 /// it returns 0x4D prompt which is not used by writeData() that calls it. | |
| 2072 /// | |
| 2073 /// @param i the gas id from 1 to 5 for OC and 6 to 10 for CCR, 0 is the extra gas | |
| 2074 /// @param *data 5 bytes with the first the command to call setGas and the four | |
| 2075 /// following bytes to define oxygen, helium, mode and deco depth | |
| 2076 /// | |
| 2077 /// @return 0x4D (prompt that is not used) | |
| 2078 // =============================================================================== | |
| 2079 uint8_t setGas(int i,uint8_t * data) | |
| 2080 { | |
| 2081 if(!checkValue(data[1],4,100)) | |
| 2082 return ERROR_; | |
| 2083 if(!checkValue(data[4],0,250)) | |
| 2084 return ERROR_; | |
| 2085 | |
| 2086 Settings.gas[i].oxygen_percentage = data[1]; | |
| 2087 Settings.gas[i].helium_percentage = data[2]; | |
| 2088 Settings.gas[i].note.uw = hwOS_to_hwOS4_GasType(data[3]); | |
| 2089 Settings.gas[i].depth_meter = data[4]; | |
| 2090 return 0x4d; | |
| 2091 } | |
| 2092 | |
| 2093 | |
| 2094 uint8_t getGas(int i,uint8_t * data) | |
| 2095 { | |
| 2096 data[0] = Settings.gas[i].oxygen_percentage; | |
| 2097 data[1] = Settings.gas[i].helium_percentage; | |
| 2098 data[2] = hwOS4_to_hwOS_GasType(Settings.gas[i].note.uw); | |
| 2099 data[3] = Settings.gas[i].depth_meter; | |
| 2100 return 0x4d; | |
| 2101 } | |
| 2102 | |
| 2103 uint8_t setDiluent(int i,uint8_t * data) | |
| 2104 { | |
| 2105 if(!checkValue(data[1],4,100)) | |
| 2106 return ERROR_; | |
| 2107 if(!checkValue(data[4],0,250)) | |
| 2108 return ERROR_; | |
| 2109 | |
| 2110 Settings.gas[NUM_OFFSET_DILUENT + i].oxygen_percentage = data[1]; | |
| 2111 Settings.gas[NUM_OFFSET_DILUENT + i].helium_percentage = data[2]; | |
| 2112 Settings.gas[NUM_OFFSET_DILUENT + i].note.uw = hwOS_to_hwOS4_GasType(data[3]); | |
| 2113 Settings.gas[NUM_OFFSET_DILUENT + i].depth_meter = data[4]; | |
| 2114 return 0x4d; | |
| 2115 } | |
| 2116 | |
| 2117 uint8_t getDiluent(int i,uint8_t * data) | |
| 2118 { | |
| 2119 data[0] = Settings.gas[NUM_OFFSET_DILUENT + i].oxygen_percentage; | |
| 2120 data[1] = Settings.gas[NUM_OFFSET_DILUENT + i].helium_percentage; | |
| 2121 data[2] = hwOS4_to_hwOS_GasType(Settings.gas[NUM_OFFSET_DILUENT + i].note.uw); | |
| 2122 data[3] = Settings.gas[NUM_OFFSET_DILUENT + i].depth_meter; | |
| 2123 return 0x4d; | |
| 2124 } | |
| 2125 | |
| 2126 uint8_t setSetpoint(int i,uint8_t * data) | |
| 2127 { | |
| 2128 if(!checkValue(data[1],50,160)) | |
| 2129 return ERROR_; | |
| 2130 if(!checkValue(data[2],0,250)) | |
| 2131 return ERROR_; | |
| 2132 | |
| 2133 Settings.setpoint[i].setpoint_cbar = data[1]; | |
| 2134 Settings.setpoint[i].depth_meter = data[2]; | |
| 2135 return 0x4d; | |
| 2136 } | |
| 2137 | |
| 2138 uint8_t getSetpoint(int i,uint8_t * data) | |
| 2139 { | |
| 2140 data[0] = Settings.setpoint[i].setpoint_cbar; | |
| 2141 data[1] = Settings.setpoint[i].depth_meter; | |
| 2142 return 0x4d; | |
| 2143 } | |
| 2144 | |
| 2145 uint8_t checkValue(uint8_t value,uint8_t from, uint8_t to) | |
| 2146 { | |
| 2147 if(value >= from && value <= to) | |
| 2148 return 1; | |
| 2149 return 0; | |
| 2150 } | |
| 2151 | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2152 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
|
2153 { |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2154 if(value >= from && value <= to) |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2155 return true; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2156 return false; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2157 } |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2158 |
| 38 | 2159 uint8_t writeData(uint8_t * data) |
| 2160 { | |
| 2161 uint32_t newSensitivity; | |
| 2162 uint16_t newDuration, newOffset; | |
| 2163 uint8_t newStopDepth; | |
| 2164 | |
| 2165 switch(data[0]) | |
| 2166 { | |
| 2167 case 0x10: | |
| 2168 return setGas(1,data); | |
| 2169 case 0x11: | |
| 2170 return setGas(2,data); | |
| 2171 case 0x12: | |
| 2172 return setGas(3,data); | |
| 2173 case 0x13: | |
| 2174 return setGas(4,data); | |
| 2175 case 0x14: | |
| 2176 return setGas(5,data); | |
| 2177 case 0x15: | |
| 2178 return setDiluent(1,data); | |
| 2179 case 0x16: | |
| 2180 return setDiluent(2,data); | |
| 2181 case 0x17: | |
| 2182 return setDiluent(3,data); | |
| 2183 case 0x18: | |
| 2184 return setDiluent(4,data); | |
| 2185 case 0x19: | |
| 2186 return setDiluent(5,data); | |
| 2187 case 0x1A: | |
| 2188 return setSetpoint(1,data); | |
| 2189 case 0x1B: | |
| 2190 return setSetpoint(2,data); | |
| 2191 case 0x1C: | |
| 2192 return setSetpoint(3,data); | |
| 2193 case 0x1D: | |
| 2194 return setSetpoint(4,data); | |
| 2195 case 0x1E: | |
| 2196 return setSetpoint(5,data); | |
| 2197 case 0x1F: | |
| 2198 if(!checkValue(data[2],0,1)) | |
| 2199 return ERROR_; | |
| 2200 Settings.CCR_Mode = data[1]; | |
| 2201 break; | |
| 2202 case 0x20: | |
| 2203 if(!checkValue(data[1],0,3)) | |
| 2204 return ERROR_; | |
| 2205 Settings.dive_mode = data[1]; | |
| 2206 break; | |
| 2207 case 0x21: | |
| 2208 if(!checkValue(data[1],1,2)) | |
| 2209 return ERROR_; | |
| 2210 Settings.deco_type.ub.standard = data[1] & 0x0F; | |
| 2211 //Settings.deco_type.ub.alternative = (data[1] & 0xF0) >> 4; | |
| 2212 break; | |
| 2213 case 0x22: | |
| 2214 if(!checkValue(data[1],100,190)) | |
| 2215 return ERROR_; | |
| 2216 Settings.ppO2_max_std = data[1]; | |
| 2217 break; | |
| 2218 case 0x23: | |
| 2219 if(!checkValue(data[1],15,15)) | |
| 2220 return ERROR_; | |
| 2221 Settings.ppO2_min = data[1]; | |
| 2222 break; | |
| 2223 case 0x24: | |
| 2224 if(!checkValue(data[1],0,15)) | |
| 2225 return ERROR_; | |
| 2226 Settings.future_TTS = data[1]; | |
| 2227 break; | |
| 2228 case 0x25: | |
| 2229 if(!checkValue(data[1],10,99)) | |
| 2230 return ERROR_; | |
| 2231 Settings.GF_low = data[1]; | |
| 2232 break; | |
| 2233 case 0x26: | |
| 2234 if(!checkValue(data[1],45,99)) | |
| 2235 return ERROR_; | |
| 2236 Settings.GF_high = data[1]; | |
| 2237 break; | |
| 2238 case 0x27: | |
| 2239 if(!checkValue(data[1],10,99)) | |
| 2240 return ERROR_; | |
| 2241 Settings.aGF_low = data[1]; | |
| 2242 break; | |
| 2243 case 0x28: | |
| 2244 if(!checkValue(data[1],45,99)) | |
| 2245 return ERROR_; | |
| 2246 Settings.aGF_high = data[1]; | |
| 2247 break; | |
| 2248 case 0x29: | |
| 2249 if(!checkValue(data[1],0,5)) | |
| 2250 return ERROR_; | |
| 2251 Settings.VPM_conservatism.ub.standard = data[1]; | |
| 2252 break; | |
| 2253 case 0x2A: | |
| 2254 case 0x2B: | |
| 2255 return ERROR_; | |
| 2256 case 0x2C: | |
| 2257 if(!checkValue(data[1],3,9)) | |
| 2258 return ERROR_; | |
| 2259 Settings.last_stop_depth_meter = data[1]; | |
| 2260 break; | |
| 2261 case 0x2D: | |
| 2262 if(!checkValue(data[1],0,4)) | |
| 2263 return ERROR_; | |
| 2264 Settings.brightness = data[1]; | |
| 2265 break; | |
| 2266 case 0x2E: | |
| 2267 if(!checkValue(data[1],0,1)) | |
| 2268 return ERROR_; | |
| 2269 Settings.nonMetricalSystem = data[1]; | |
| 2270 break; | |
| 2271 case 0x2F: | |
| 2272 return ERROR_; | |
| 2273 case 0x30: | |
| 2274 if(!checkValue(data[1],0,4)) | |
| 2275 return ERROR_; | |
| 2276 Settings.salinity = data[1]; | |
| 2277 break; | |
| 2278 case 0x31: | |
| 2279 if(!checkValue(data[1],0,3)) | |
| 2280 return ERROR_; | |
| 2281 Settings.tX_colorscheme = data[1]; | |
| 2282 GFX_use_colorscheme(Settings.tX_colorscheme); | |
| 2283 break; | |
| 2284 case 0x32: | |
| 2285 if(!checkValue(data[1],0,4)) | |
| 2286 return ERROR_; | |
| 2287 Settings.selected_language = data[1]; | |
| 2288 break; | |
| 2289 case 0x33: | |
| 2290 if(!checkValue(data[1],0,2)) | |
| 2291 return ERROR_; | |
| 2292 Settings.date_format = data[1]; | |
| 2293 break; | |
| 2294 case 0x34: | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2295 if (!checkValueSigned(data[1], -MAX_COMPASS_DECLINATION_DEG, MAX_COMPASS_DECLINATION_DEG)) |
| 38 | 2296 return ERROR_; |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2297 Settings.compassDeclinationDeg = (int8_t)data[1]; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2298 |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2299 break; |
| 38 | 2300 case 0x35: |
| 2301 if(data[1] & 0x80) | |
| 2302 { | |
| 2303 data[1] = ~(data[1]); | |
|
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2304 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
| 38 | 2305 return ERROR_; |
| 2306 Settings.offsetPressure_mbar = 0 - data[1]; | |
| 2307 } | |
| 2308 else | |
| 2309 { | |
|
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2310 if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR)) |
| 38 | 2311 return ERROR_; |
| 2312 Settings.offsetPressure_mbar = data[1]; | |
| 2313 } | |
| 2314 break; | |
| 2315 case 0x36: | |
| 2316 if(!checkValue(data[1],0,1)) | |
| 2317 return ERROR_; | |
| 2318 if(data[1]) | |
| 2319 Settings.safetystopDuration = settingsGetPointerStandard()->safetystopDuration; | |
| 2320 else | |
| 2321 Settings.safetystopDuration = 0; | |
| 2322 break; | |
| 2323 case 0x37: | |
| 2324 return ERROR_; | |
| 2325 case 0x38: | |
| 2326 if(!checkValue(data[1],0,1)) | |
| 2327 return ERROR_; | |
| 2328 Settings.fallbackToFixedSetpoint = data[1]; | |
| 2329 break; | |
| 2330 case 0x39: | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2331 if (!checkValue(data[1], 0, 1)) |
| 38 | 2332 return ERROR_; |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2333 setFlipDisplay(data[1]); |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2334 |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2335 break; |
| 38 | 2336 case 0x3A: |
| 2337 if(!checkValue(data[1],70,110)) | |
| 2338 return ERROR_; | |
| 2339 newSensitivity = data[1]; | |
| 2340 settingsHelperButtonSens_keepPercentageValues(newSensitivity, settingsGetPointer()->ButtonResponsiveness); | |
| 2341 setButtonResponsiveness(Settings.ButtonResponsiveness); | |
| 2342 break; | |
| 2343 case 0x3B: | |
| 2344 // value between 0 and 127 | |
| 2345 if(buttonBalanceTranslatorHexToArray(data[1], settingsGetPointer()->buttonBalance)) | |
| 2346 { | |
| 2347 settingsHelperButtonSens_keepPercentageValues(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->ButtonResponsiveness); | |
| 2348 } | |
| 2349 else // value >= 128 (bit 7 set) factory reset | |
| 2350 { | |
| 2351 getButtonFactorDefaults(&settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
| 2352 settingsHelperButtonSens_keepPercentageValues(settingsGetPointerStandard()->ButtonResponsiveness[3], settingsGetPointer()->ButtonResponsiveness); | |
| 2353 } | |
| 2354 // valid for both: | |
| 2355 setButtonResponsiveness(Settings.ButtonResponsiveness); | |
| 2356 break; | |
| 2357 case 0x3C: | |
| 2358 if(!checkValue(data[1],5,50)) | |
| 2359 return ERROR_; | |
| 2360 Settings.gasConsumption_bottom_l_min = data[1]; | |
| 2361 break; | |
| 2362 case 0x3D: | |
| 2363 if(!checkValue(data[1],5,50)) | |
| 2364 return ERROR_; | |
| 2365 Settings.gasConsumption_deco_l_min = data[1]; | |
| 2366 break; | |
| 2367 case 0x3E: | |
| 2368 if(!checkValue(data[1],5,50)) | |
| 2369 return ERROR_; | |
| 2370 Settings.gasConsumption_travel_l_min = data[1]; | |
| 2371 break; | |
| 2372 case 0x3F: | |
| 2373 case 0x40: | |
| 2374 return ERROR_; | |
| 2375 case 0x41: | |
| 2376 if(!checkValue(data[1],0,1)) | |
| 2377 return ERROR_; | |
| 2378 Settings.alwaysShowPPO2 = data[1]; | |
| 2379 break; | |
| 2380 case 0x42: | |
| 2381 if(data[1] & 0x80) | |
| 2382 { | |
| 2383 data[1] = ~(data[1]); | |
| 2384 if(!checkValue(data[1],0,20)) | |
| 2385 return ERROR_; | |
| 2386 Settings.offsetTemperature_centigrad = 0 - data[1]; | |
| 2387 } | |
| 2388 else | |
| 2389 { | |
| 2390 if(!checkValue(data[1],0,20)) | |
| 2391 return ERROR_; | |
| 2392 Settings.offsetTemperature_centigrad = data[1]; | |
| 2393 } | |
| 2394 break; | |
| 2395 case 0x43: | |
| 2396 if(!checkValue(data[1],60,255)) | |
| 2397 return ERROR_; | |
| 2398 newDuration = (uint16_t)data[1] + 59; | |
| 2399 newDuration /= 60; | |
| 2400 Settings.safetystopDuration = (uint8_t)newDuration; | |
| 2401 break; | |
| 2402 case 0x44: | |
| 2403 if(!checkValue(data[1],21,61)) | |
| 2404 return ERROR_; | |
| 2405 newStopDepth = data[1] + 9; | |
| 2406 if(newStopDepth > 60) | |
| 2407 newStopDepth = 60; | |
| 2408 newStopDepth /= 10; | |
| 2409 Settings.safetystopDepth = newStopDepth; | |
| 2410 break; | |
| 2411 case 0x45: | |
| 2412 case 0x46: | |
| 2413 return ERROR_; | |
| 2414 case 0x47: | |
| 2415 newOffset = data[2] * 256; | |
| 2416 newOffset += data[1]; | |
| 2417 if(newOffset > 9000) | |
| 2418 return ERROR_; | |
| 2419 Settings.logbookOffset = newOffset; | |
| 2420 break; | |
| 2421 case 0x70: | |
| 2422 if(!checkValue(data[1],0,1)) | |
| 2423 return ERROR_; | |
| 2424 Settings.showDebugInfo = data[1]; | |
| 2425 break; | |
| 2426 case 0x71: | |
| 2427 if(!checkValue(data[1],0,(EXTRADISPLAY_END - 1))) | |
| 2428 return ERROR_; | |
| 2429 Settings.extraDisplay = data[1]; | |
| 2430 break; | |
| 2431 case 0x72: | |
| 2432 if(!checkValue(data[1],0,8)) | |
| 2433 return ERROR_; | |
| 2434 Settings.tX_customViewPrimary = data[1]; | |
| 2435 break; | |
| 2436 case 0x73: | |
| 2437 if(!checkValue(data[1],0,20)) | |
| 2438 return ERROR_; | |
| 2439 Settings.tX_customViewTimeout = data[1]; | |
| 2440 break; | |
| 2441 case 0x74: | |
| 2442 if(!checkValue(data[1],1,7)) | |
| 2443 return ERROR_; | |
| 2444 Settings.tX_userselectedLeftLowerCornerPrimary = data[1]; | |
| 2445 break; | |
| 2446 case 0x75: | |
| 2447 if(!checkValue(data[1],0,20)) | |
| 2448 return ERROR_; | |
| 2449 Settings.tX_userselectedLeftLowerCornerTimeout = data[1]; | |
| 2450 break; | |
| 2451 } | |
| 2452 return 0; | |
| 2453 } | |
| 2454 | |
| 2455 | |
| 2456 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data) | |
| 2457 { | |
| 2458 enum JeanDoParameterType { | |
| 2459 PARAM_UNKNOWN = 0, | |
| 2460 PARAM_INT15 = 1, | |
| 2461 PARAM_INT8, | |
| 2462 PARAM_DECI, | |
| 2463 PARAM_CENTI, | |
| 2464 PARAM_MILI, | |
| 2465 PARAM_PERCENT, | |
| 2466 PARAM_SEC, | |
| 2467 PARAM_COLOR, | |
| 2468 PARAM_BOOL, | |
| 2469 PARAM_ENUM, | |
| 2470 PARAM_SIGNED = 128, | |
| 2471 PARAM_SDECI = PARAM_SIGNED|PARAM_DECI, | |
| 2472 PARAM_SSEC = PARAM_SIGNED|PARAM_SEC, | |
| 2473 PARAM_SINT = PARAM_SIGNED|PARAM_INT8 | |
| 2474 }; | |
| 2475 | |
| 2476 // uint32_t buttonSensitivity; | |
| 2477 uint16_t newDuration; | |
| 2478 | |
| 2479 uint8_t datacounter = 0; | |
| 2480 | |
| 2481 data[0] = 0; | |
| 2482 data[1] = 0; | |
| 2483 data[2] = 0; | |
| 2484 data[3] = 0; | |
| 2485 datacounter = 0; | |
| 2486 | |
| 2487 switch(what) | |
| 2488 { | |
| 2489 case 0x10: | |
| 2490 case 0x11: | |
| 2491 case 0x12: | |
| 2492 case 0x13: | |
| 2493 case 0x14: | |
| 2494 data[datacounter++] = PARAM_INT8; | |
| 2495 data[datacounter++] = 4; | |
| 2496 data[datacounter++] = settingsGetPointerStandard()->gas[1].oxygen_percentage; | |
| 2497 data[datacounter++] = 100; | |
| 2498 break; | |
| 2499 | |
| 2500 case 0x15: | |
| 2501 case 0x16: | |
| 2502 case 0x17: | |
| 2503 case 0x18: | |
| 2504 case 0x19: | |
| 2505 data[datacounter++] = PARAM_INT8; | |
| 2506 data[datacounter++] = 4; | |
| 2507 data[datacounter++] = settingsGetPointerStandard()->gas[1].oxygen_percentage; | |
| 2508 data[datacounter++] = 100; | |
| 2509 break; | |
| 2510 | |
| 2511 case 0x1A: | |
| 2512 case 0x1B: | |
| 2513 case 0x1C: | |
| 2514 case 0x1D: | |
| 2515 case 0x1E: | |
| 2516 data[datacounter++] = PARAM_CENTI; | |
| 2517 data[datacounter++] = 50; | |
| 2518 data[datacounter++] = settingsGetPointerStandard()->setpoint[1].setpoint_cbar; | |
| 2519 data[datacounter++] = 160; | |
| 2520 break; | |
| 2521 | |
| 2522 case 0x1F: | |
| 2523 data[datacounter++] = PARAM_ENUM; | |
| 2524 data[datacounter++] = 0; | |
| 2525 data[datacounter++] = settingsGetPointerStandard()->CCR_Mode; | |
| 2526 data[datacounter++] = 1; | |
| 2527 break; | |
| 2528 | |
| 2529 case 0x20: | |
| 2530 data[datacounter++] = PARAM_ENUM; | |
| 2531 data[datacounter++] = 0; | |
| 2532 data[datacounter++] = settingsGetPointerStandard()->dive_mode; | |
| 2533 data[datacounter++] = 3; | |
| 2534 break; | |
| 2535 | |
| 2536 case 0x21: | |
| 2537 data[datacounter++] = PARAM_ENUM; | |
| 2538 data[datacounter++] = 1; | |
| 2539 data[datacounter++] = settingsGetPointerStandard()->deco_type.ub.standard; | |
| 2540 data[datacounter++] = 2; | |
| 2541 break; | |
| 2542 | |
| 2543 case 0x22: | |
| 2544 data[datacounter++] = PARAM_CENTI; | |
| 2545 data[datacounter++] = 100; | |
| 2546 data[datacounter++] = settingsGetPointerStandard()->ppO2_max_std; | |
| 2547 data[datacounter++] = 190; | |
| 2548 break; | |
| 2549 | |
| 2550 case 0x23: | |
| 2551 data[datacounter++] = PARAM_CENTI; | |
| 2552 data[datacounter++] = 15; | |
| 2553 data[datacounter++] = settingsGetPointerStandard()->ppO2_min; | |
| 2554 data[datacounter++] = 15; | |
| 2555 break; | |
| 2556 | |
| 2557 case 0x24: | |
| 2558 data[datacounter++] = PARAM_INT8; // minutes | |
| 2559 data[datacounter++] = 0; | |
| 2560 data[datacounter++] = settingsGetPointerStandard()->future_TTS; | |
| 2561 data[datacounter++] = 15; | |
| 2562 break; | |
| 2563 | |
| 2564 case 0x25: | |
| 2565 data[datacounter++] = PARAM_PERCENT; | |
| 2566 data[datacounter++] = 10; | |
| 2567 data[datacounter++] = settingsGetPointerStandard()->GF_low; | |
| 2568 data[datacounter++] = 99; | |
| 2569 break; | |
| 2570 | |
| 2571 case 0x26: | |
| 2572 data[datacounter++] = PARAM_PERCENT; | |
| 2573 data[datacounter++] = 45; | |
| 2574 data[datacounter++] = settingsGetPointerStandard()->GF_high; | |
| 2575 data[datacounter++] = 99; | |
| 2576 break; | |
| 2577 | |
| 2578 case 0x27: | |
| 2579 data[datacounter++] = PARAM_PERCENT; | |
| 2580 data[datacounter++] = 10; | |
| 2581 data[datacounter++] = settingsGetPointerStandard()->aGF_low; | |
| 2582 data[datacounter++] = 99; | |
| 2583 break; | |
| 2584 | |
| 2585 case 0x28: | |
| 2586 data[datacounter++] = PARAM_PERCENT; | |
| 2587 data[datacounter++] = 45; | |
| 2588 data[datacounter++] = settingsGetPointerStandard()->aGF_high; | |
| 2589 data[datacounter++] = 99; | |
| 2590 break; | |
| 2591 | |
| 2592 case 0x29: | |
| 2593 data[datacounter++] = PARAM_INT8; // conservatism +0 .. +5 | |
| 2594 data[datacounter++] = 0; | |
| 2595 data[datacounter++] = settingsGetPointerStandard()->VPM_conservatism.ub.standard; | |
| 2596 data[datacounter++] = 5; | |
| 2597 break; | |
| 2598 | |
| 2599 case 0x2A: | |
| 2600 case 0x2B: | |
| 2601 data[datacounter++] = PARAM_PERCENT; | |
| 2602 data[datacounter++] = 100; | |
| 2603 data[datacounter++] = 100;// saturation, desaturation, settingsGetPointerStandard()->; | |
| 2604 data[datacounter++] = 100; | |
| 2605 break; | |
| 2606 | |
| 2607 case 0x2C: | |
| 2608 data[datacounter++] = PARAM_INT8; | |
| 2609 data[datacounter++] = 3; | |
| 2610 data[datacounter++] = settingsGetPointerStandard()->last_stop_depth_meter; | |
| 2611 data[datacounter++] = 9; | |
| 2612 break; | |
| 2613 | |
| 2614 case 0x2D: | |
| 2615 data[datacounter++] = PARAM_ENUM; | |
| 2616 data[datacounter++] = 0; | |
| 2617 data[datacounter++] = settingsGetPointerStandard()->brightness; | |
| 2618 data[datacounter++] = 4; | |
| 2619 break; | |
| 2620 | |
| 2621 case 0x2E: | |
| 2622 data[datacounter++] = PARAM_ENUM; | |
| 2623 data[datacounter++] = 0; | |
| 2624 data[datacounter++] = settingsGetPointerStandard()->nonMetricalSystem; | |
| 2625 data[datacounter++] = 1; | |
| 2626 break; | |
| 2627 | |
| 2628 case 0x2F: | |
| 2629 data[datacounter++] = PARAM_INT8; // Sampling rate logbook | |
| 2630 data[datacounter++] = 2; | |
| 2631 data[datacounter++] = 2; | |
| 2632 data[datacounter++] = 2; | |
| 2633 break; | |
| 2634 | |
| 2635 case 0x30: | |
| 2636 data[datacounter++] = PARAM_PERCENT; | |
| 2637 data[datacounter++] = 0; | |
| 2638 data[datacounter++] = settingsGetPointerStandard()->salinity; | |
| 2639 data[datacounter++] = 4; | |
| 2640 break; | |
| 2641 | |
| 2642 case 0x31: | |
| 2643 data[datacounter++] = PARAM_INT8; | |
| 2644 data[datacounter++] = 0; | |
| 2645 data[datacounter++] = settingsGetPointerStandard()->tX_colorscheme; | |
| 2646 data[datacounter++] = 3; | |
| 2647 break; | |
| 2648 | |
| 2649 case 0x32: | |
| 2650 data[datacounter++] = PARAM_ENUM; | |
| 2651 data[datacounter++] = 0; | |
| 2652 data[datacounter++] = settingsGetPointerStandard()->selected_language; | |
| 2653 data[datacounter++] = 1; | |
| 2654 break; | |
| 2655 | |
| 2656 case 0x33: | |
| 2657 data[datacounter++] = PARAM_ENUM; | |
| 2658 data[datacounter++] = 0; | |
| 2659 data[datacounter++] = settingsGetPointerStandard()->date_format; | |
| 2660 data[datacounter++] = 2; | |
| 2661 break; | |
| 2662 | |
| 2663 case 0x34: | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2664 data[datacounter++] = PARAM_SINT; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2665 data[datacounter++] = (uint8_t)-MAX_COMPASS_DECLINATION_DEG; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2666 data[datacounter++] = (uint8_t)settingsGetPointerStandard()->compassDeclinationDeg; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2667 data[datacounter++] = MAX_COMPASS_DECLINATION_DEG; |
| 38 | 2668 break; |
| 2669 | |
| 2670 case 0x35: | |
| 2671 data[datacounter++] = PARAM_SINT; | |
|
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2672 data[datacounter++] = (uint8_t)(256 - PRESSURE_OFFSET_LIMIT_MBAR); // == -20 |
| 38 | 2673 if(settingsGetPointerStandard()->offsetPressure_mbar < 0) |
| 2674 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetPressure_mbar); | |
| 2675 else | |
| 2676 data[datacounter++] = settingsGetPointerStandard()->offsetPressure_mbar; | |
|
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
334
diff
changeset
|
2677 data[datacounter++] = PRESSURE_OFFSET_LIMIT_MBAR; |
| 38 | 2678 break; |
| 2679 | |
| 2680 case 0x36: | |
| 2681 data[datacounter++] = PARAM_BOOL; | |
| 2682 data[datacounter++] = 0; | |
| 2683 if(settingsGetPointerStandard()->safetystopDuration) | |
| 2684 data[datacounter++] = 1; | |
| 2685 else | |
| 2686 data[datacounter++] = 0; | |
| 2687 data[datacounter++] = 1; | |
| 2688 break; | |
| 2689 | |
| 2690 case 0x37: | |
| 2691 data[datacounter++] = PARAM_UNKNOWN ; | |
| 2692 data[datacounter++] = 0; | |
| 2693 data[datacounter++] = 0; // Set calibration gas, not possible with optical | |
| 2694 data[datacounter++] = 0; | |
| 2695 break; | |
| 2696 | |
| 2697 case 0x38: | |
| 2698 data[datacounter++] = PARAM_BOOL; | |
| 2699 data[datacounter++] = 0; | |
| 2700 data[datacounter++] = settingsGetPointerStandard()->fallbackToFixedSetpoint; | |
| 2701 data[datacounter++] = 1; | |
| 2702 break; | |
| 2703 | |
| 2704 case 0x39: | |
| 2705 data[datacounter++] = PARAM_BOOL; | |
| 2706 data[datacounter++] = 0; | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2707 data[datacounter++] = settingsGetPointerStandard()->FlipDisplay; |
|
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2708 data[datacounter++] = 1; |
| 38 | 2709 break; |
| 2710 | |
| 2711 case 0x3A: | |
| 2712 data[datacounter++] = PARAM_PERCENT; | |
| 2713 data[datacounter++] = 70; | |
| 2714 data[datacounter++] = settingsGetPointerStandard()->ButtonResponsiveness[3]; | |
| 2715 data[datacounter++] = 110; | |
| 2716 break; | |
| 2717 | |
| 2718 case 0x3B: | |
| 2719 data[datacounter++] = PARAM_UNKNOWN; | |
| 2720 data[datacounter++] = 0; | |
| 2721 data[datacounter++] = buttonBalanceTranslateArrayOutHex(settingsGetPointerStandard()->buttonBalance); | |
| 2722 data[datacounter++] = 128; | |
| 2723 break; | |
| 2724 | |
| 2725 case 0x3C: | |
| 2726 data[datacounter++] = PARAM_INT8; | |
| 2727 data[datacounter++] = 5; | |
| 2728 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_bottom_l_min; | |
| 2729 data[datacounter++] = 50; | |
| 2730 break; | |
| 2731 | |
| 2732 case 0x3D: | |
| 2733 data[datacounter++] = PARAM_INT8; | |
| 2734 data[datacounter++] = 5; | |
| 2735 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_deco_l_min; | |
| 2736 data[datacounter++] = 50; | |
| 2737 break; | |
| 2738 | |
| 2739 case 0x3E: | |
| 2740 data[datacounter++] = PARAM_INT8; | |
| 2741 data[datacounter++] = 5; | |
| 2742 data[datacounter++] = settingsGetPointerStandard()->gasConsumption_travel_l_min; | |
| 2743 data[datacounter++] = 50; | |
| 2744 break; | |
| 2745 | |
| 2746 case 0x3F: | |
| 2747 data[datacounter++] = PARAM_UNKNOWN; | |
| 2748 data[datacounter++] = 0; | |
| 2749 data[datacounter++] = 0; // Dynamic ascend rate, not yet :-) settingsGetPointerStandard()->; | |
| 2750 data[datacounter++] = 0; | |
| 2751 break; | |
| 2752 | |
| 2753 case 0x40: | |
| 2754 data[datacounter++] = PARAM_BOOL; | |
| 2755 data[datacounter++] = 1; | |
| 2756 data[datacounter++] = 1; // Graphical speed indicator; | |
| 2757 data[datacounter++] = 1; | |
| 2758 break; | |
| 2759 | |
| 2760 case 0x41: | |
| 2761 data[datacounter++] = PARAM_BOOL; | |
| 2762 data[datacounter++] = 0; | |
| 2763 data[datacounter++] = settingsGetPointerStandard()->alwaysShowPPO2; | |
| 2764 data[datacounter++] = 1; | |
| 2765 break; | |
| 2766 | |
| 2767 case 0x42: | |
| 2768 data[datacounter++] = PARAM_SIGNED|PARAM_CENTI; | |
| 2769 data[datacounter++] = (uint8_t)(256 - 20); // == -20 | |
| 2770 if(settingsGetPointerStandard()->offsetTemperature_centigrad < 0) | |
| 2771 data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetTemperature_centigrad); | |
| 2772 else | |
| 2773 data[datacounter++] = settingsGetPointerStandard()->offsetTemperature_centigrad; | |
| 2774 data[datacounter++] = 20; | |
| 2775 break; | |
| 2776 | |
| 2777 case 0x43: | |
| 2778 newDuration = settingsGetPointerStandard()->safetystopDuration; | |
| 2779 newDuration *= 60; | |
| 2780 if(newDuration > 255) | |
| 2781 newDuration = 255; | |
| 2782 data[datacounter++] = PARAM_INT8; | |
| 2783 data[datacounter++] = 60; // coud be 1 minute instead | |
| 2784 data[datacounter++] = (uint8_t)newDuration; | |
| 2785 data[datacounter++] = 255; // could be 5 minutes instead | |
| 2786 break; | |
| 2787 | |
| 2788 case 0x44: | |
| 2789 data[datacounter++] = PARAM_INT8; | |
| 2790 data[datacounter++] = 30; // coud be 3 meter instead | |
| 2791 data[datacounter++] = settingsGetPointerStandard()->safetystopDepth * 10; | |
| 2792 data[datacounter++] = 60; // could be 6 meter instead | |
| 2793 break; | |
| 2794 | |
| 2795 case 0x45: | |
| 2796 case 0x46: | |
| 2797 data[datacounter++] = PARAM_UNKNOWN; | |
| 2798 data[datacounter++] = 0; | |
| 2799 data[datacounter++] = 0; // SafetyStop End Depth and SafetyStop Reset Depth | |
| 2800 data[datacounter++] = 0; | |
| 2801 break; | |
| 2802 | |
| 2803 case 0x47: | |
| 2804 data[datacounter++] = PARAM_INT15; | |
| 2805 data[datacounter++] = 0; | |
| 2806 data[datacounter++] = 0; | |
| 2807 data[datacounter++] = settingsGetPointerStandard()->logbookOffset & 0xFF; | |
| 2808 data[datacounter++] = settingsGetPointerStandard()->logbookOffset / 0xFF; | |
| 2809 data[datacounter++] = 9000 & 0xFF; | |
| 2810 data[datacounter++] = 9000 / 0xFF; | |
| 2811 break; | |
| 2812 | |
| 2813 case 0x70: | |
| 2814 data[datacounter++] = PARAM_BOOL; | |
| 2815 data[datacounter++] = 0; | |
| 2816 data[datacounter++] = settingsGetPointerStandard()->showDebugInfo; | |
| 2817 data[datacounter++] = 1; | |
| 2818 break; | |
| 2819 | |
| 2820 case 0x71: | |
| 2821 data[datacounter++] = PARAM_ENUM; | |
| 2822 data[datacounter++] = 0; | |
| 2823 data[datacounter++] = settingsGetPointerStandard()->extraDisplay; | |
| 2824 data[datacounter++] = (EXTRADISPLAY_END - 1); | |
| 2825 break; | |
| 2826 | |
| 2827 case 0x72: | |
| 2828 data[datacounter++] = PARAM_ENUM; | |
| 2829 data[datacounter++] = 0; | |
| 2830 data[datacounter++] = settingsGetPointerStandard()->tX_customViewPrimary; | |
| 2831 data[datacounter++] = 8; | |
| 2832 break; | |
| 2833 | |
| 2834 case 0x73: | |
| 2835 data[datacounter++] = PARAM_INT8; | |
| 2836 data[datacounter++] = 0; | |
| 2837 data[datacounter++] = settingsGetPointerStandard()->tX_customViewTimeout; | |
| 2838 data[datacounter++] = 60; | |
| 2839 break; | |
| 2840 | |
| 2841 case 0x74: | |
| 2842 data[datacounter++] = PARAM_ENUM; | |
| 2843 data[datacounter++] = 1; | |
| 2844 data[datacounter++] = settingsGetPointerStandard()->tX_userselectedLeftLowerCornerPrimary; | |
| 2845 data[datacounter++] = 7; | |
| 2846 break; | |
| 2847 | |
| 2848 case 0x75: | |
| 2849 data[datacounter++] = PARAM_INT8; | |
| 2850 data[datacounter++] = 0; | |
| 2851 data[datacounter++] = settingsGetPointerStandard()->tX_userselectedLeftLowerCornerTimeout; | |
| 2852 data[datacounter++] = 60; | |
| 2853 break; | |
| 2854 } | |
| 2855 | |
| 2856 if(datacounter == 0) | |
| 2857 { | |
| 2858 data[datacounter++] = PARAM_UNKNOWN; | |
| 2859 data[datacounter++] = 0; | |
| 2860 data[datacounter++] = 0; // SafetyStop End Depth and SafetyStop Reset Depth | |
| 2861 data[datacounter++] = 0; | |
| 2862 } | |
| 2863 | |
| 2864 return datacounter; | |
| 2865 } | |
| 2866 | |
| 2867 | |
| 2868 uint8_t readData(uint8_t what, uint8_t * data) | |
| 2869 { | |
| 2870 data[0] = 0; | |
| 2871 data[1] = 0; | |
| 2872 data[2] = 0; | |
| 2873 data[3] = 0; | |
| 2874 switch(what) | |
| 2875 { | |
| 2876 case 0x10: | |
| 2877 return getGas(1,data); | |
| 2878 case 0x11: | |
| 2879 return getGas(2,data); | |
| 2880 case 0x12: | |
| 2881 return getGas(3,data); | |
| 2882 case 0x13: | |
| 2883 return getGas(4,data); | |
| 2884 case 0x14: | |
| 2885 return getGas(5,data); | |
| 2886 case 0x15: | |
| 2887 return getDiluent(1,data); | |
| 2888 case 0x16: | |
| 2889 return getDiluent(2,data); | |
| 2890 case 0x17: | |
| 2891 return getDiluent(3,data); | |
| 2892 case 0x18: | |
| 2893 return getDiluent(4,data); | |
| 2894 case 0x19: | |
| 2895 return getDiluent(5,data); | |
| 2896 case 0x1A: | |
| 2897 return getSetpoint(1,data); | |
| 2898 case 0x1B: | |
| 2899 return getSetpoint(2,data); | |
| 2900 case 0x1C: | |
| 2901 return getSetpoint(3,data); | |
| 2902 case 0x1D: | |
| 2903 return getSetpoint(4,data); | |
| 2904 case 0x1E: | |
| 2905 return getSetpoint(5,data); | |
| 2906 case 0x1F: | |
| 2907 data[0] = Settings.CCR_Mode; | |
| 2908 break; | |
| 2909 case 0x20: | |
| 2910 data[0] = Settings.dive_mode; | |
| 2911 break; | |
| 2912 case 0x21: | |
| 2913 data[0] = Settings.deco_type.ub.standard; | |
| 2914 break; | |
| 2915 case 0x22: | |
| 2916 data[0] = Settings.ppO2_max_std; | |
| 2917 break; | |
| 2918 case 0x23: | |
| 2919 data[0] = Settings.ppO2_min; | |
| 2920 break; | |
| 2921 case 0x24: | |
| 2922 data[0] = Settings.future_TTS; | |
| 2923 break; | |
| 2924 case 0x25: | |
| 2925 data[0] = Settings.GF_low; | |
| 2926 break; | |
| 2927 case 0x26: | |
| 2928 data[0] = Settings.GF_high; | |
| 2929 break; | |
| 2930 case 0x27: | |
| 2931 data[0] = Settings.aGF_low; | |
| 2932 break; | |
| 2933 case 0x28: | |
| 2934 data[0] = Settings.aGF_high; | |
| 2935 break; | |
| 2936 case 0x29: | |
| 2937 data[0] = Settings.VPM_conservatism.ub.standard; | |
| 2938 break; | |
| 2939 case 0x2A: | |
| 2940 case 0x2B: | |
| 2941 data[0] = 100; | |
| 2942 break; | |
| 2943 case 0x2C: | |
| 2944 data[0] = Settings.last_stop_depth_meter; | |
| 2945 break; | |
| 2946 case 0x2D: | |
| 2947 data[0] = Settings.brightness; | |
| 2948 break; | |
| 2949 case 0x2E: | |
| 2950 data[0] = Settings.nonMetricalSystem; | |
| 2951 break; | |
| 2952 case 0x2F: | |
| 2953 data[0] = 0; // 0 == 2 sec sampling rate | |
| 2954 break; | |
| 2955 case 0x30: | |
| 2956 data[0] = Settings.salinity; | |
| 2957 break; | |
| 2958 case 0x31: | |
| 2959 data[0] = Settings.tX_colorscheme; | |
| 2960 break; | |
| 2961 case 0x32: | |
| 2962 data[0] = Settings.selected_language; | |
| 2963 break; | |
| 2964 case 0x33: | |
| 2965 data[0] = Settings.date_format; | |
| 2966 break; | |
| 2967 case 0x34: | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2968 data[0] = (uint8_t)Settings.compassDeclinationDeg; |
| 38 | 2969 break; |
| 2970 case 0x35: | |
| 2971 data[0] = Settings.offsetPressure_mbar; | |
| 2972 break; | |
| 2973 case 0x36: | |
| 2974 if(Settings.safetystopDepth) | |
| 2975 data[0] = 1; | |
| 2976 else | |
| 2977 data[0] = 0; | |
| 2978 break; | |
| 2979 case 0x37: | |
| 2980 data[0] = 0; // calibration gas %O2 -> 0 no gas :-) | |
| 2981 break; | |
| 2982 case 0x38: | |
| 2983 data[0] = Settings.fallbackToFixedSetpoint; | |
| 2984 break; | |
| 2985 case 0x39: | |
|
993
df052f0347fb
Add settings that have been missing in the bluetooth API:
heinrichsweikamp
parents:
990
diff
changeset
|
2986 data[0] = Settings.FlipDisplay; |
| 38 | 2987 break; |
| 2988 case 0x3A: | |
| 2989 data[0] = Settings.ButtonResponsiveness[3]; | |
| 2990 break; | |
| 2991 case 0x3B: | |
| 2992 data[0] = buttonBalanceTranslateArrayOutHex(settingsGetPointer()->buttonBalance); | |
| 2993 break; | |
| 2994 case 0x3C: | |
| 2995 data[0] = Settings.gasConsumption_bottom_l_min; | |
| 2996 break; | |
| 2997 case 0x3D: | |
| 2998 data[0] = Settings.gasConsumption_deco_l_min; | |
| 2999 break; | |
| 3000 case 0x3E: | |
| 3001 data[0] = Settings.gasConsumption_travel_l_min; | |
| 3002 break; | |
| 3003 case 0x3F: | |
| 3004 data[0] = 0; // fixed ascend rate 10 m/min | |
| 3005 break; | |
| 3006 case 0x40: | |
| 3007 data[0] = 1; // graphical speed indicator | |
| 3008 break; | |
| 3009 case 0x41: | |
| 3010 data[0] = Settings.alwaysShowPPO2; | |
| 3011 break; | |
| 3012 case 0x42: | |
| 3013 data[0] = Settings.offsetTemperature_centigrad; | |
| 3014 break; | |
| 3015 case 0x43: | |
| 3016 if(Settings.safetystopDuration > 4) | |
| 3017 data[0] = 255; // seconds | |
| 3018 else | |
| 3019 data[0] = 60 * Settings.safetystopDuration; | |
| 3020 break; | |
| 3021 case 0x44: | |
| 3022 data[0] = Settings.safetystopDepth * 10; // cbar instead of meter | |
| 3023 break; | |
| 3024 case 0x45: | |
| 3025 if(Settings.safetystopDepth == 3) | |
| 3026 data[0] = 20; // cbar | |
| 3027 else | |
| 3028 data[0] = 30; // cbar | |
| 3029 break; | |
| 3030 case 0x46: | |
| 3031 data[0] = 10; // reset at 10 meter as far as I understood | |
| 3032 break; | |
| 3033 case 0x47: | |
| 3034 data[0] = Settings.logbookOffset & 0xFF; | |
| 3035 data[1] = Settings.logbookOffset / 0xFF; | |
| 3036 break; | |
| 3037 case 0x70: | |
| 3038 data[0] = Settings.showDebugInfo; | |
| 3039 break; | |
| 3040 case 0x71: | |
| 3041 data[0] = Settings.extraDisplay; | |
| 3042 break; | |
| 3043 case 0x72: | |
| 3044 data[0] = Settings.tX_customViewPrimary; | |
| 3045 break; | |
| 3046 case 0x73: | |
| 3047 data[0] = Settings.tX_customViewTimeout; | |
| 3048 break; | |
| 3049 case 0x74: | |
| 3050 data[0] = Settings.tX_userselectedLeftLowerCornerPrimary; | |
| 3051 break; | |
| 3052 case 0x75: | |
| 3053 data[0] = Settings.tX_userselectedLeftLowerCornerTimeout; | |
| 3054 break; | |
| 3055 } | |
| 3056 return 0x4D; | |
| 3057 } | |
| 3058 | |
| 3059 | |
| 3060 uint8_t RTEminimum_required_high(void) | |
| 3061 { | |
| 3062 return RTErequiredHigh; | |
| 3063 } | |
| 3064 uint8_t RTEminimum_required_low(void) | |
| 3065 { | |
| 3066 return RTErequiredLow; | |
| 3067 } | |
| 3068 | |
| 3069 uint8_t FONTminimum_required_high(void) | |
| 3070 { | |
| 3071 return FONTrequiredHigh; | |
| 3072 } | |
| 3073 uint8_t FONTminimum_required_low(void) | |
| 3074 { | |
| 3075 return FONTrequiredLow; | |
| 3076 } | |
| 3077 | |
| 3078 | |
| 3079 void setActualRTEversion(uint8_t high, uint8_t low) | |
| 3080 { | |
| 3081 RTEactualHigh = high; | |
| 3082 RTEactualLow = low; | |
| 3083 } | |
| 3084 | |
| 870 | 3085 #ifndef BOOTLOADER_STANDALONE |
| 38 | 3086 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow) |
| 3087 { | |
| 3088 if(RTEhigh && RTElow) | |
| 3089 { | |
| 3090 *RTEhigh = RTEactualHigh; | |
| 3091 *RTElow = RTEactualLow; | |
| 3092 } | |
| 3093 if(FONThigh && FONTlow) | |
| 3094 { | |
| 3095 *FONThigh = *(uint8_t *)0x08132000; | |
| 3096 *FONTlow = *(uint8_t *)0x08132001; | |
| 3097 } | |
| 3098 } | |
| 3099 | |
| 3100 | |
| 3101 uint8_t getLicence(void) | |
| 3102 { | |
| 3103 return hardwareDataGetPointer()->primaryLicence; | |
| 3104 } | |
| 870 | 3105 #endif |
| 38 | 3106 |
| 3107 void firmwareGetDate(RTC_DateTypeDef *SdateOutput) | |
| 3108 { | |
| 3109 SdateOutput->Year = firmwareDataGetPointer()->release_year; | |
| 3110 SdateOutput->Month = firmwareDataGetPointer()->release_month; | |
| 3111 SdateOutput->Date = firmwareDataGetPointer()->release_day; | |
| 3112 } | |
| 3113 | |
| 3114 | |
| 3115 // this should use device specific values stored in OTPROG ROM soon | |
| 3116 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray) | |
| 3117 { | |
| 3118 *basePercentage = settingsGetPointerStandard()->ButtonResponsiveness[3]; | |
| 3119 | |
| 3120 for(int i=0;i<3;i++) | |
| 3121 { | |
| 3122 buttonBalanceArray[i] = settingsGetPointerStandard()->buttonBalance[i]; | |
| 3123 } | |
| 3124 } | |
| 3125 | |
| 3126 | |
| 3127 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray) | |
| 3128 { | |
| 3129 if(hexValue > 127) | |
| 3130 return 0; | |
| 3131 // internal order: 0 = right, 1 = center, 2 = left | |
| 3132 // external order: Factory,left,center,right | |
| 3133 outputArray[0] = 2 + (hexValue & 0x03); | |
| 3134 hexValue /= 4; | |
| 3135 outputArray[1] = 2 + (hexValue & 0x03); | |
| 3136 hexValue /= 4; | |
| 3137 outputArray[2] = 2 + (hexValue & 0x03); | |
| 3138 | |
| 3139 return 1; | |
| 3140 } | |
| 3141 | |
| 3142 | |
| 3143 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray) | |
| 3144 { | |
| 3145 uint8_t hexValue = 0; | |
| 3146 | |
| 3147 if(inputArray[2] > 2) | |
| 3148 { | |
| 3149 hexValue += inputArray[2] - 2; | |
| 3150 } | |
| 3151 hexValue *= 4; | |
| 3152 | |
| 3153 if(inputArray[1] > 2) | |
| 3154 { | |
| 3155 hexValue += inputArray[1] - 2; | |
| 3156 } | |
| 3157 hexValue *= 4; | |
| 3158 if(inputArray[0] > 2) | |
| 3159 { | |
| 3160 hexValue += inputArray[0] - 2; | |
| 3161 } | |
| 3162 return hexValue; | |
| 3163 } | |
| 3164 | |
| 3165 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray) | |
| 3166 { | |
| 3167 if((inputValueRaw >= 70) && (inputValueRaw <= 110)) | |
| 3168 { | |
| 3169 Settings.FactoryButtonBase = inputValueRaw; | |
| 3170 } | |
| 3171 for(int i=0;i<3;i++) | |
| 3172 { | |
| 3173 if((inputBalanceArray[i] >= 2) && (inputBalanceArray[i] <= 5)) | |
| 3174 { | |
| 3175 Settings.FactoryButtonBalance[i] = inputBalanceArray[i]; | |
| 3176 } | |
| 3177 } | |
| 3178 } | |
| 3179 | |
| 3180 | |
| 3181 /** | |
| 3182 ****************************************************************************** | |
| 3183 * @brief settingsHelperButtonSens. / make 32 bit input to three buttons + storage value in [3] | |
| 3184 * @author heinrichs weikamp gmbh | |
| 3185 * @version V 01 | |
| 3186 * @date 19-Sept-2016 | |
| 3187 ****************************************************************************** | |
| 3188 * | |
| 3189 * @param inputValueRaw: | |
| 3190 * @param outArray4Values: [0] is right, [1] is center, [2] is left, [3] is original value with zero balance | |
| 3191 * @retval None | |
| 3192 */ | |
| 3193 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values) | |
| 3194 { | |
| 3195 uint32_t newSensitivity; | |
| 3196 | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3197 if(inputValueRaw > MAX_BUTTONRESPONSIVENESS) |
| 38 | 3198 { |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3199 inputValueRaw = MAX_BUTTONRESPONSIVENESS; |
| 38 | 3200 } |
| 3201 else | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3202 if(inputValueRaw < MIN_BUTTONRESPONSIVENESS) |
| 38 | 3203 { |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3204 inputValueRaw = MIN_BUTTONRESPONSIVENESS; |
| 38 | 3205 } |
| 3206 | |
| 3207 // the unbalanced value | |
| 3208 outArray4Values[3] = inputValueRaw; | |
| 3209 | |
| 3210 // the balanced values | |
| 3211 for(int i=0;i<3;i++) | |
| 3212 { | |
| 3213 newSensitivity = inputValueRaw; | |
| 3214 switch(settingsGetPointer()->buttonBalance[i]) | |
| 3215 { | |
| 3216 case 1: // should not be an option hw 170508 | |
| 3217 newSensitivity -= 20; | |
| 3218 break; | |
| 3219 case 2: | |
| 3220 newSensitivity -= 10; | |
| 3221 break; | |
| 3222 default: | |
| 3223 break; | |
| 3224 case 4: | |
| 3225 newSensitivity += 10; | |
| 3226 break; | |
| 3227 case 5: | |
| 3228 newSensitivity += 20; | |
| 3229 break; | |
| 3230 } | |
| 3231 | |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3232 if(newSensitivity > MAX_BUTTONRESPONSIVENESS) |
| 38 | 3233 { |
|
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
91
diff
changeset
|
3234 newSensitivity = MAX_BUTTONRESPONSIVENESS; |
| 38 | 3235 } |
| 3236 outArray4Values[i] = newSensitivity; | |
| 3237 } | |
| 3238 } | |
| 3239 | |
| 3240 | |
| 3241 /** | |
| 3242 ****************************************************************************** | |
| 3243 * @brief settingsHelperButtonSens_translate_to_hwOS_values. / make 32 bit input to three buttons + storage value in [3] | |
| 3244 * @author heinrichs weikamp gmbh | |
| 3245 * @version V 01 | |
| 3246 * @date 19-Sept-2016 | |
| 3247 ****************************************************************************** | |
| 3248 * | |
| 3249 * @param inputValueRaw: | |
| 3250 * @param outArray4Values: [0] is right, [1] is center, [2] is left, [3] is original value with zero balance | |
| 3251 * @retval None | |
| 3252 */ | |
| 3253 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values) | |
| 3254 { | |
| 3255 uint32_t newSensitivity; | |
| 3256 | |
| 3257 for(int i=0;i<3;i++) | |
| 3258 { | |
| 3259 newSensitivity = inputValueRaw; | |
| 3260 switch(settingsGetPointer()->buttonBalance[i]) | |
| 3261 { | |
| 3262 case 1: | |
| 3263 newSensitivity -= 20; | |
| 3264 break; | |
| 3265 case 2: | |
| 3266 newSensitivity -= 10; | |
| 3267 break; | |
| 3268 default: | |
| 3269 break; | |
| 3270 case 4: | |
| 3271 newSensitivity += 10; | |
| 3272 break; | |
| 3273 case 5: | |
| 3274 newSensitivity += 20; | |
| 3275 break; | |
| 3276 } | |
| 3277 | |
| 3278 if(newSensitivity > 100) | |
| 3279 { | |
| 3280 if(newSensitivity <= 105) | |
| 3281 newSensitivity = 10; | |
| 3282 else | |
| 3283 newSensitivity = 7; | |
| 3284 } | |
| 3285 else | |
| 3286 { | |
| 3287 newSensitivity *= 24; | |
| 3288 newSensitivity = 2400 - newSensitivity; | |
| 3289 newSensitivity /= 10; | |
| 3290 | |
| 3291 newSensitivity += 15; | |
| 3292 if(newSensitivity > 255) | |
| 3293 newSensitivity = 255; | |
| 3294 } | |
| 3295 outArray4Values[i] = newSensitivity; | |
| 3296 } | |
| 3297 | |
| 3298 // the unbalanced value | |
| 3299 newSensitivity = inputValueRaw; | |
| 3300 if(newSensitivity > 100) | |
| 3301 { | |
| 3302 if(newSensitivity <= 105) | |
| 3303 newSensitivity = 10; | |
| 3304 else | |
| 3305 newSensitivity = 7; | |
| 3306 } | |
| 3307 else | |
| 3308 { | |
| 3309 newSensitivity *= 24; | |
| 3310 newSensitivity = 2400 - newSensitivity; | |
| 3311 newSensitivity /= 10; | |
| 3312 | |
| 3313 newSensitivity += 15; | |
| 3314 if(newSensitivity > 255) | |
| 3315 newSensitivity = 255; | |
| 3316 } | |
| 3317 outArray4Values[3] = newSensitivity; | |
| 3318 } | |
| 3319 | |
| 3320 | |
| 3321 /** | |
| 3322 ****************************************************************************** | |
| 3323 * @brief settingsHelperButtonSens_translate_percentage_to_hwOS_values. | |
| 3324 * @author heinrichs weikamp gmbh | |
| 3325 * @version V 01 | |
| 3326 * @date 6-March-2017 | |
| 3327 ****************************************************************************** | |
| 3328 * | |
| 3329 * @param inputValuePercentage with buttonBalance included | |
| 3330 * @retval PIC compatible value | |
| 3331 */ | |
| 3332 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage) | |
| 3333 { | |
| 3334 uint32_t newSensitivity = inputValuePercentage; | |
| 3335 | |
| 3336 if(newSensitivity > 100) | |
| 3337 { | |
| 3338 if(newSensitivity <= 105) | |
| 3339 newSensitivity = 10; | |
| 3340 else | |
| 3341 newSensitivity = 7; | |
| 3342 } | |
| 3343 else | |
| 3344 { | |
| 3345 newSensitivity *= 24; | |
| 3346 newSensitivity = 2400 - newSensitivity; | |
| 3347 newSensitivity /= 10; | |
| 3348 | |
| 3349 newSensitivity += 15; | |
| 3350 if(newSensitivity > 255) | |
| 3351 newSensitivity = 255; | |
| 3352 } | |
| 3353 return (uint8_t)newSensitivity; | |
| 3354 } | |
| 3355 | |
| 3356 | |
| 3357 /** | |
| 3358 ****************************************************************************** | |
| 3359 * @brief settingsHelperButtonSens_translate_hwOS_values_to_percentage. | |
| 3360 * @author heinrichs weikamp gmbh | |
| 3361 * @version V 01 | |
| 3362 * @date 6-March-2017 | |
| 3363 ****************************************************************************** | |
| 3364 * | |
| 3365 * @param PIC compatible value | |
| 3366 * @retval Percentage | |
| 3367 */ | |
| 3368 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC) | |
| 3369 { | |
| 3370 if(inputValuePIC >= 15) | |
| 3371 { | |
| 3372 return(uint8_t)((25500 - (inputValuePIC)*100) / 240); | |
| 3373 } | |
| 3374 else | |
| 3375 { | |
| 3376 if(inputValuePIC >= 10) | |
| 3377 { | |
| 3378 return 105; | |
| 3379 } | |
| 3380 else | |
| 3381 { | |
| 3382 return 110; | |
| 3383 } | |
| 3384 } | |
| 3385 } | |
| 662 | 3386 |
| 3387 void reset_SettingWarning() | |
| 3388 { | |
| 3389 settingsWarning = 0; | |
| 3390 } | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3391 |
| 662 | 3392 inline uint8_t isSettingsWarning() |
| 3393 { | |
| 3394 return settingsWarning; | |
| 3395 } | |
|
1014
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3396 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3397 bool isScrubberError(const SScrubberData *scrubberData) |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3398 { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3399 if (scrubberData->TimerCur <= SCRUBBER_ERROR_TIME) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3400 return true; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3401 } |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3402 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3403 return false; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3404 } |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3405 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3406 bool isScrubberWarning(const SScrubberData *scrubberData) |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3407 { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3408 if (scrubberData->TimerCur <= SCRUBBER_WARNING_TIME) { |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3409 return true; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3410 } |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3411 |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3412 return false; |
|
8c0134a287da
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
heinrichsweikamp
parents:
1011
diff
changeset
|
3413 } |
