Mercurial > public > ostc4
annotate Common/Inc/settings.h @ 677:1953cd9145b3 Betatest
Move include file to common to ...
... get things compiled. The configuration.h file is also used from the RTE
code, so it should be in the Common tree.
Signed-off-by: Jan Mulder <jan@jlmulder.nl>
author | Jan Mulder <jan@jlmulder.nl> |
---|---|
date | Wed, 20 Apr 2022 20:25:04 +0200 |
parents | c855753af9a6 |
children | 52d68cf9994c |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Common/Inc/settings.h | |
5 /// \brief | |
6 /// \author Heinrichs Weikamp | |
7 /// \date 2018 | |
8 /// | |
9 /// $Id$ | |
10 /////////////////////////////////////////////////////////////////////////////// | |
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
12 /// | |
13 /// This program is free software: you can redistribute it and/or modify | |
14 /// it under the terms of the GNU General Public License as published by | |
15 /// the Free Software Foundation, either version 3 of the License, or | |
16 /// (at your option) any later version. | |
17 /// | |
18 /// This program is distributed in the hope that it will be useful, | |
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 /// GNU General Public License for more details. | |
22 /// | |
23 /// You should have received a copy of the GNU General Public License | |
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 ////////////////////////////////////////////////////////////////////////////// | |
26 | |
27 #ifndef SETTINGS_H | |
28 #define SETTINGS_H | |
29 | |
30 // From Common/Inc: | |
31 #include "FirmwareData.h" | |
32 | |
33 //#include "data_central.h" | |
34 | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
35 #include "global_constants.h" |
38 | 36 // From Common/Drivers/ |
37 #include "stm32f4xx_hal.h" | |
38 | |
39 #include <stdint.h> | |
40 | |
92
be35821a4974
Stable to test. button sensitiveness fix. + global_constants.
Dmitry Romanov <kitt@bk.ru>
parents:
38
diff
changeset
|
41 |
38 | 42 #define NUM_GASES 5 |
43 #define NUM_OFFSET_DILUENT 5 | |
44 #define SPECIAL_GAS_ID 0 | |
45 | |
46 #define ERROR_ 0xFF | |
47 | |
48 #define CCRMODE_FixedSetpoint 0 | |
49 #define CCRMODE_Sensors 1 | |
662 | 50 #define CCRMODE_Simulation 2 |
38 | 51 |
52 #define DIVEMODE_OC 0 | |
53 #define DIVEMODE_CCR 1 | |
54 #define DIVEMODE_Gauge 2 | |
55 #define DIVEMODE_Apnea 3 | |
662 | 56 #define DIVEMODE_PSCR 4 |
38 | 57 |
58 #define GF_MODE 1 | |
59 #define VPM_MODE 2 | |
60 | |
61 #define VPM_FROM_FORTRAN 0 | |
62 #define VPM_BACHELORWORK 1 | |
63 | |
64 #define BUEHLMANN_OSTC4 0 | |
65 #define BUEHLMANN_hwOS 1 | |
66 | |
67 #define MMDDYY 0 | |
68 #define DDMMYY 1 | |
69 #define YYMMDD 2 | |
70 | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
210
diff
changeset
|
71 #define PRESSURE_OFFSET_LIMIT_MBAR 50 |
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
210
diff
changeset
|
72 |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
73 #define MAX_COMPASS_COMP (2u) |
640 | 74 #define MAX_VIEWPORT_MODE (0x7F) |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
75 |
676 | 76 #define MAX_SCRUBBER_TIME (999u) |
652 | 77 #define MIN_PPO2_SP_CBAR (40u) |
650 | 78 |
662 | 79 #define PSCR_MAX_O2_DROP (15u) |
80 #define PSCR_MIN_LUNG_RATIO (5u) | |
81 #define PSCR_MAX_LUNG_RATIO (20u) | |
82 | |
83 #define FUTURE_SPARE_SIZE (29u) /* Applied for reuse of old, not used, scooter block (was 32 bytes)*/ | |
84 | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
85 typedef enum |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
86 { |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
87 O2_SENSOR_SOURCE_OPTIC = 0, |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
88 O2_SENSOR_SOURCE_ANALOG, |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
89 O2_SENSOR_SOURCE_MAX |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
90 } SensorSource; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
91 #define MAX_O2_SENSOR_SOURCE (2u) |
546 | 92 |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
93 typedef enum |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
94 { |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
95 SCRUB_TIMER_OFF = 0, |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
96 SCRUB_TIMER_MINUTES, |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
97 SCRUB_TIMER_PERCENT, |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
98 SCRUB_TIMER_END |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
99 } ScrubTimerMode_e; |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
100 |
38 | 101 /* 2015 Jan 30, hw, deco and travel added for MenuEditGas |
102 * can be used for buehlmann, vpm, etc. later but be carefull | |
103 * with current implemenation */ | |
104 typedef struct{ | |
105 uint8_t active:1; | |
106 uint8_t first:1; | |
107 uint8_t deco:1; | |
108 uint8_t travel:1; | |
526
88c626d01ee5
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
505
diff
changeset
|
109 uint8_t off:1; |
88c626d01ee5
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
505
diff
changeset
|
110 uint8_t spare:3; |
38 | 111 } gasubit8_t; |
112 | |
113 typedef union{ | |
114 gasubit8_t ub; | |
115 uint8_t uw; | |
116 } gasbit8_Type; | |
117 | |
118 typedef struct{ | |
119 uint8_t standard:4; | |
120 uint8_t alternative:4; | |
121 } ubit2x4_t; | |
122 | |
123 typedef union{ | |
124 ubit2x4_t ub; | |
125 uint8_t uw; | |
126 } split2x4_Type; | |
127 | |
128 typedef union{ | |
129 uint8_t u8[4]; | |
130 uint32_t u32; | |
131 } general32to8_Type; | |
132 | |
133 typedef struct | |
134 { | |
135 uint8_t oxygen_percentage; | |
136 uint8_t helium_percentage; | |
137 gasbit8_Type note; | |
138 uint8_t depth_meter; | |
139 uint8_t depth_meter_travel; | |
140 uint8_t bottle_size_liter; | |
141 // uint8_t bottle_wireless_status; | |
142 uint16_t bottle_wireless_id; | |
143 } SGasLine; | |
144 | |
145 typedef struct | |
146 { | |
147 uint8_t setpoint_cbar; | |
148 uint8_t depth_meter; | |
149 gasbit8_Type note; | |
150 } SSetpointLine; | |
151 | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
152 |
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
153 |
38 | 154 /* SSettings |
155 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
156 */ | |
157 typedef struct | |
158 { | |
159 uint32_t header; | |
160 uint8_t warning_blink_dsec; | |
161 uint8_t lastDiveLogId; | |
162 uint32_t logFlashNextSampleStartAddress; | |
163 SGasLine gas[1 + (2*NUM_GASES)]; | |
164 SSetpointLine setpoint[1 + NUM_GASES]; | |
165 uint8_t CCR_Mode; | |
166 uint8_t dive_mode; | |
167 split2x4_Type deco_type; | |
168 uint8_t ppO2_max_deco; | |
169 uint8_t ppO2_max_std; | |
170 uint8_t ppO2_min; | |
171 uint8_t CNS_max; | |
172 uint8_t ascent_MeterPerMinute_max; | |
173 uint8_t ascent_MeterPerMinute_showGraph; | |
174 uint8_t future_TTS; | |
175 uint8_t GF_high; | |
176 uint8_t GF_low; | |
177 uint8_t aGF_high; | |
178 uint8_t aGF_low; | |
179 split2x4_Type VPM_conservatism; | |
180 uint8_t safetystopDuration; | |
181 uint8_t AtemMinutenVolumenLiter; | |
182 uint8_t ReserveFractionDenominator; | |
183 uint8_t salinity; | |
184 uint8_t last_stop_depth_meter; | |
185 uint8_t stop_increment_depth_meter; | |
186 uint8_t brightness; | |
187 uint8_t date_format; | |
188 uint8_t selected_language; | |
189 char customtext[60]; | |
190 uint16_t timeoutSurfacemode; | |
191 uint8_t timeoutMenuSurface; | |
192 uint8_t timeoutMenuDive; | |
193 uint8_t timeoutMenuEdit; | |
194 uint8_t timeoutInfo; | |
195 uint8_t timeoutInfoCompass; | |
196 uint8_t design; | |
197 uint16_t timeoutDiveReachedZeroDepth; | |
198 uint16_t divetimeToCreateLogbook; | |
199 uint8_t serialHigh; | |
200 uint8_t serialLow; | |
201 // SUFirmware firmwareVersion16to32bit; | |
202 uint32_t backup_localtime_rtc_tr; | |
203 uint32_t backup_localtime_rtc_dr; | |
204 uint16_t totalDiveCounter; | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
205 uint16_t personalDiveCount; |
38 | 206 uint8_t showDebugInfo; |
207 uint8_t ButtonResponsiveness[4];// changed content in 0xFFFF0016 | |
208 uint8_t nonMetricalSystem; | |
209 uint8_t fallbackToFixedSetpoint; | |
210 uint8_t bluetoothActive; /* will be set to zero on each startup at the moment */ | |
211 uint8_t safetystopDepth; | |
212 uint32_t updateSettingsAllowedFromHeader; | |
662 | 213 uint8_t pscr_lung_ratio; /* redefined in 0xFFFF0020 */ |
214 uint8_t pscr_o2_drop; /* redefined in 0xFFFF0020 */ | |
215 uint8_t co2_sensor_active; /* redefined in 0xFFFF0021 */ | |
216 uint8_t Future_SPARE[FUTURE_SPARE_SIZE]; /* redefined in 0xFFFF0020 (old scooter Block was 32 byte)*/ | |
38 | 217 // new in 0xFFFF0006 |
218 uint8_t ppo2sensors_deactivated; | |
219 uint8_t tX_colorscheme; | |
220 uint8_t tX_userselectedLeftLowerCornerPrimary; | |
221 uint8_t tX_userselectedLeftLowerCornerTimeout; | |
222 uint8_t tX_customViewPrimary; | |
223 uint8_t tX_customViewTimeout; | |
224 uint8_t timeoutEnterButtonSelectDive; | |
225 uint16_t logbookOffset; | |
226 uint8_t alwaysShowPPO2; | |
227 uint8_t extraDisplay; | |
228 uint16_t display_toogle_desc; | |
229 int8_t offsetPressure_mbar; | |
230 int8_t offsetTemperature_centigrad; | |
231 uint8_t gasConsumption_travel_l_min; | |
232 uint8_t gasConsumption_bottom_l_min; | |
233 uint8_t gasConsumption_deco_l_min; | |
234 uint8_t debugModeOnStart; | |
235 uint8_t IAmStolenPleaseKillMe; | |
236 int16_t compassBearing; | |
237 uint8_t lastKnownBatteryPercentage; | |
238 uint8_t buttonBalance[3]; // 0 = right, 1 = center, 2 = left | |
239 uint8_t firmwareVersion[4]; | |
240 uint16_t timeoutSurfacemodeWithSensors; | |
241 // new in 0xFFFF0016 | |
242 uint8_t VPM_model; | |
243 uint8_t GF_model; | |
244 // new in 0xFFFF0017 | |
245 uint8_t FactoryButtonBase; | |
246 uint8_t FactoryButtonBalance[3]; | |
112
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
247 /* new in 0xFFFF0018 */ |
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
248 uint8_t FlipDisplay; |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
249 /* new in 0xFFFF0019 */ |
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
250 uint32_t cv_configuration; |
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:
210
diff
changeset
|
251 /* new in 0xFFFF001A */ |
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:
210
diff
changeset
|
252 uint8_t MotionDetection; |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
372
diff
changeset
|
253 /* new in 0xFFFF001B */ |
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
372
diff
changeset
|
254 uint32_t cv_config_BigScreen; |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
526
diff
changeset
|
255 /* new in 0xFFFF001C */ |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
526
diff
changeset
|
256 uint8_t compassInertia; |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
539
diff
changeset
|
257 uint8_t tX_customViewPrimaryBF; |
546 | 258 /* new in 0xFFFF001D */ |
626
3e1a0e267f38
Added option to select sensitivity of focus detection:
Ideenmodellierer
parents:
567
diff
changeset
|
259 uint8_t viewPortMode; /* 7-Reserve| 6..5 - Focus spot size | 4-Focusframe | 3-Reserve | 2..0-BacklightBoost */ |
546 | 260 uint16_t viewRoll; |
261 uint16_t viewPitch; | |
262 uint16_t viewYaw; | |
560
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
263 /* new in 0xFFFF001E */ |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
264 uint8_t ppo2sensors_source; |
5d80bb8d22cb
Added O2 sensor source and calibration parameters to setting structure
Ideenmodellierer
parents:
550
diff
changeset
|
265 float ppo2sensors_calibCoeff[3]; |
567 | 266 uint8_t amPMTime; |
650 | 267 /* new in 0xFFFF001F */ |
268 uint8_t autoSetpoint; | |
269 uint16_t scrubTimerMax; | |
270 uint16_t scrubTimerCur; | |
654
890440ab993a
Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents:
652
diff
changeset
|
271 uint8_t scrubTimerMode; |
38 | 272 } SSettings; |
273 | |
274 typedef struct | |
275 { | |
276 // 8 bytes | |
277 uint16_t primarySerial; | |
278 uint8_t primaryLicence; | |
279 uint8_t revision8bit; | |
280 uint8_t production_year; | |
281 uint8_t production_month; | |
282 uint8_t production_day; | |
283 uint8_t production_bluetooth_name_set; | |
284 | |
285 // 44 bytes | |
286 char production_info[44]; | |
287 | |
288 // 8 bytes | |
289 uint16_t secondarySerial; | |
290 uint8_t secondaryLicence; | |
291 uint8_t secondaryReason8bit; | |
292 uint8_t secondary_year; | |
293 uint8_t secondary_month; | |
294 uint8_t secondary_day; | |
295 uint8_t secondary_bluetooth_name_set; | |
296 | |
297 // 4 bytes | |
298 char secondary_info[4]; | |
299 } SHardwareData; | |
300 | |
301 uint8_t writeData(uint8_t *); | |
302 uint8_t readData(uint8_t what,uint8_t *); | |
303 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data); | |
304 | |
305 uint8_t getPPO2Max(void); | |
306 uint8_t getPPO2Min(void); | |
307 uint8_t getDiveMode(void); | |
308 uint8_t getCCRMode(void); | |
309 uint8_t getDecoType(void); | |
310 uint8_t getFutureTTS(void); | |
311 | |
312 SSettings* settingsGetPointer(void); | |
313 const SSettings* settingsGetPointerStandard(void); | |
314 void set_settings_to_Standard(void); | |
315 void mod_settings_for_first_start_with_empty_ext_flash(void); | |
316 const SFirmwareData* firmwareDataGetPointer(void); | |
317 const SHardwareData* hardwareDataGetPointer(void); | |
318 uint8_t firmwareVersion_16bit_high(void); | |
319 uint8_t firmwareVersion_16bit_low(void); | |
320 void hardwareBatchCode(uint8_t *high, uint8_t *low); | |
321 | |
322 uint8_t RTEminimum_required_high(void); | |
323 uint8_t RTEminimum_required_low(void); | |
324 uint8_t FONTminimum_required_high(void); | |
325 uint8_t FONTminimum_required_low(void); | |
326 | |
327 void setActualRTEversion(uint8_t high, uint8_t low); | |
328 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow); | |
329 | |
330 void set_new_settings_missing_in_ext_flash(void); | |
331 uint8_t check_and_correct_settings(void); | |
332 uint8_t newFirmwareVersionCheckViaSettings(void); | |
333 void set_settings_button_to_standard_with_individual_buttonBalance(void); | |
334 uint8_t getLicence(void); | |
335 void firmwareGetDate(RTC_DateTypeDef *SdateOutput); | |
336 | |
337 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values); | |
338 | |
339 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray); | |
340 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray); | |
341 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray); | |
342 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray); | |
343 | |
344 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values); | |
345 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage); | |
346 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC); | |
347 | |
662 | 348 void reset_SettingWarning(); |
349 uint8_t isSettingsWarning(); | |
350 | |
38 | 351 #endif // SETTINGS_H |