comparison Common/Inc/settings.h @ 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)
author heinrichsweikamp
date Tue, 04 Jul 2023 14:39:06 +0200
parents 45b8f3c2acce
children 75ace7af8212
comparison
equal deleted inserted replaced
787:aeb72882f30a 788:4abfb8a2a435
25 ////////////////////////////////////////////////////////////////////////////// 25 //////////////////////////////////////////////////////////////////////////////
26 26
27 #ifndef SETTINGS_H 27 #ifndef SETTINGS_H
28 #define SETTINGS_H 28 #define SETTINGS_H
29 29
30 #include <stdint.h>
31 #include <stdbool.h>
32
30 // From Common/Inc: 33 // From Common/Inc:
31 #include "FirmwareData.h" 34 #include "FirmwareData.h"
32 35
33 //#include "data_central.h" 36 //#include "data_central.h"
34 37
36 // From Common/Drivers/ 39 // From Common/Drivers/
37 #include "stm32f4xx_hal.h" 40 #include "stm32f4xx_hal.h"
38 #include "stm32f4xx_hal_rtc.h" 41 #include "stm32f4xx_hal_rtc.h"
39 42
40 #include "configuration.h" 43 #include "configuration.h"
41
42 #include <stdint.h>
43 44
44 45
45 #define NUM_GASES 5 46 #define NUM_GASES 5
46 #define NUM_OFFSET_DILUENT 5 47 #define NUM_OFFSET_DILUENT 5
47 #define SPECIAL_GAS_ID 0 48 #define SPECIAL_GAS_ID 0
84 #define PSCR_MIN_LUNG_RATIO (5u) 85 #define PSCR_MIN_LUNG_RATIO (5u)
85 #define PSCR_MAX_LUNG_RATIO (20u) 86 #define PSCR_MAX_LUNG_RATIO (20u)
86 87
87 #define UART_MAX_PROTOCOL (2u) 88 #define UART_MAX_PROTOCOL (2u)
88 89
89 #define FUTURE_SPARE_SIZE (3u) /* Applied for reuse of old, not used, scooter block (was 32 bytes)*/ 90 #define FUTURE_SPARE_SIZE (2u) /* Applied for reuse of old, not used, scooter block (was 32 bytes)*/
90 91
91 typedef enum 92 typedef enum
92 { 93 {
93 O2_SENSOR_SOURCE_OPTIC = 0, 94 O2_SENSOR_SOURCE_OPTIC = 0,
94 O2_SENSOR_SOURCE_ANALOG, 95 O2_SENSOR_SOURCE_ANALOG,
165 { 166 {
166 uint16_t TimerMax; 167 uint16_t TimerMax;
167 int16_t TimerCur; 168 int16_t TimerCur;
168 RTC_DateTypeDef lastDive; 169 RTC_DateTypeDef lastDive;
169 } SScrubberData; 170 } SScrubberData;
171
172 enum {
173 SETPOINT_INDEX_CUSTOM = 0,
174 SETPOINT_INDEX_AUTO_LOW,
175 SETPOINT_INDEX_AUTO_HIGH,
176 SETPOINT_INDEX_AUTO_DECO,
177 };
170 178
171 179
172 /* SSettings 180 /* SSettings
173 * gas[0] and setpoint[0] are the special ones configurable during the dive 181 * gas[0] and setpoint[0] are the special ones configurable during the dive
174 */ 182 */
235 243
236 uint8_t scubberActiveId; /* redefined in 0xFFFF0023 */ 244 uint8_t scubberActiveId; /* redefined in 0xFFFF0023 */
237 SScrubberData scrubberData[2]; 245 SScrubberData scrubberData[2];
238 uint8_t ext_sensor_map[5]; 246 uint8_t ext_sensor_map[5];
239 uint8_t buttonLockActive; /* redefined in 0xFFFF0025 */ 247 uint8_t buttonLockActive; /* redefined in 0xFFFF0025 */
240 int8_t compassDeclinationDeg; /* redefined in 0xFFFF0026 */ 248 int8_t compassDeclinationDeg;
249 uint8_t delaySetpointLow; /* redefined in 0xFFFF0026 */
241 uint8_t Future_SPARE[FUTURE_SPARE_SIZE]; /* redefined in 0xFFFF0020 (old scooter Block was 32 byte)*/ 250 uint8_t Future_SPARE[FUTURE_SPARE_SIZE]; /* redefined in 0xFFFF0020 (old scooter Block was 32 byte)*/
242 // new in 0xFFFF0006 251 // new in 0xFFFF0006
243 uint8_t ppo2sensors_deactivated; 252 uint8_t ppo2sensors_deactivated;
244 uint8_t tX_colorscheme; 253 uint8_t tX_colorscheme;
245 uint8_t tX_userselectedLeftLowerCornerPrimary; 254 uint8_t tX_userselectedLeftLowerCornerPrimary;
371 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC); 380 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC);
372 381
373 void reset_SettingWarning(); 382 void reset_SettingWarning();
374 uint8_t isSettingsWarning(); 383 uint8_t isSettingsWarning();
375 384
385 bool checkAndFixSetpointSettings(void);
376 #endif // SETTINGS_H 386 #endif // SETTINGS_H