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