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