Mercurial > public > ostc4
annotate Common/Inc/settings.h @ 453:1c0b911c367f minor_improvments
Added compile variant enabling the reset of profile sample information:
In case the sample ring has an overrun prior to the header ring then header will point to no longer available sample locations causing problems when the no longer existing samples are read. To avoid this also in earlier versions a variant has been added which enables the user to reset the invalid sample information by selecting the problematic dive in the infolog menu and pressing the middle button.
Added function which confirms consistency of dive log settings:
Meaning last dive and dive header are valid at startup. Repair and find lastDiveID are only called in case a inconsistency is detected
author | ideenmodellierer |
---|---|
date | Tue, 24 Mar 2020 21:59:38 +0100 |
parents | 75eedde05ff6 |
children | 4811f3dfaa52 |
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 | |
50 | |
51 #define DIVEMODE_OC 0 | |
52 #define DIVEMODE_CCR 1 | |
53 #define DIVEMODE_Gauge 2 | |
54 #define DIVEMODE_Apnea 3 | |
55 | |
56 #define GF_MODE 1 | |
57 #define VPM_MODE 2 | |
58 | |
59 #define VPM_FROM_FORTRAN 0 | |
60 #define VPM_BACHELORWORK 1 | |
61 | |
62 #define BUEHLMANN_OSTC4 0 | |
63 #define BUEHLMANN_hwOS 1 | |
64 | |
65 #define MMDDYY 0 | |
66 #define DDMMYY 1 | |
67 #define YYMMDD 2 | |
68 | |
337
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
210
diff
changeset
|
69 #define PRESSURE_OFFSET_LIMIT_MBAR 50 |
38367bb982b8
Set Max value for pressure offset to 50mBar (20mBar before)
ideenmodellierer
parents:
210
diff
changeset
|
70 |
38 | 71 /* 2015 Jan 30, hw, deco and travel added for MenuEditGas |
72 * can be used for buehlmann, vpm, etc. later but be carefull | |
73 * with current implemenation */ | |
74 typedef struct{ | |
75 uint8_t active:1; | |
76 uint8_t first:1; | |
77 uint8_t deco:1; | |
78 uint8_t travel:1; | |
79 uint8_t senderCode:4; | |
80 } gasubit8_t; | |
81 | |
82 typedef union{ | |
83 gasubit8_t ub; | |
84 uint8_t uw; | |
85 } gasbit8_Type; | |
86 | |
87 typedef struct{ | |
88 uint8_t standard:4; | |
89 uint8_t alternative:4; | |
90 } ubit2x4_t; | |
91 | |
92 typedef union{ | |
93 ubit2x4_t ub; | |
94 uint8_t uw; | |
95 } split2x4_Type; | |
96 | |
97 typedef union{ | |
98 uint8_t u8[4]; | |
99 uint32_t u32; | |
100 } general32to8_Type; | |
101 | |
102 typedef struct | |
103 { | |
104 uint8_t oxygen_percentage; | |
105 uint8_t helium_percentage; | |
106 gasbit8_Type note; | |
107 uint8_t depth_meter; | |
108 uint8_t depth_meter_travel; | |
109 uint8_t bottle_size_liter; | |
110 // uint8_t bottle_wireless_status; | |
111 uint16_t bottle_wireless_id; | |
112 } SGasLine; | |
113 | |
114 typedef struct | |
115 { | |
116 uint8_t setpoint_cbar; | |
117 uint8_t depth_meter; | |
118 gasbit8_Type note; | |
119 } SSetpointLine; | |
120 | |
121 /* SSettings | |
122 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
123 */ | |
124 typedef struct | |
125 { | |
126 uint32_t header; | |
127 uint8_t warning_blink_dsec; | |
128 uint8_t lastDiveLogId; | |
129 uint32_t logFlashNextSampleStartAddress; | |
130 SGasLine gas[1 + (2*NUM_GASES)]; | |
131 SSetpointLine setpoint[1 + NUM_GASES]; | |
132 uint8_t CCR_Mode; | |
133 uint8_t dive_mode; | |
134 split2x4_Type deco_type; | |
135 uint8_t ppO2_max_deco; | |
136 uint8_t ppO2_max_std; | |
137 uint8_t ppO2_min; | |
138 uint8_t CNS_max; | |
139 uint8_t ascent_MeterPerMinute_max; | |
140 uint8_t ascent_MeterPerMinute_showGraph; | |
141 uint8_t future_TTS; | |
142 uint8_t GF_high; | |
143 uint8_t GF_low; | |
144 uint8_t aGF_high; | |
145 uint8_t aGF_low; | |
146 split2x4_Type VPM_conservatism; | |
147 uint8_t safetystopDuration; | |
148 uint8_t AtemMinutenVolumenLiter; | |
149 uint8_t ReserveFractionDenominator; | |
150 uint8_t salinity; | |
151 uint8_t last_stop_depth_meter; | |
152 uint8_t stop_increment_depth_meter; | |
153 uint8_t brightness; | |
154 uint8_t date_format; | |
155 uint8_t selected_language; | |
156 char customtext[60]; | |
157 uint16_t timeoutSurfacemode; | |
158 uint8_t timeoutMenuSurface; | |
159 uint8_t timeoutMenuDive; | |
160 uint8_t timeoutMenuEdit; | |
161 uint8_t timeoutInfo; | |
162 uint8_t timeoutInfoCompass; | |
163 uint8_t design; | |
164 uint16_t timeoutDiveReachedZeroDepth; | |
165 uint16_t divetimeToCreateLogbook; | |
166 uint8_t serialHigh; | |
167 uint8_t serialLow; | |
168 // SUFirmware firmwareVersion16to32bit; | |
169 uint32_t backup_localtime_rtc_tr; | |
170 uint32_t backup_localtime_rtc_dr; | |
171 uint16_t totalDiveCounter; | |
172 uint16_t personalDiveCount; | |
173 uint8_t showDebugInfo; | |
174 uint8_t ButtonResponsiveness[4];// changed content in 0xFFFF0016 | |
175 uint8_t nonMetricalSystem; | |
176 uint8_t fallbackToFixedSetpoint; | |
177 uint8_t bluetoothActive; /* will be set to zero on each startup at the moment */ | |
178 uint8_t safetystopDepth; | |
179 uint32_t updateSettingsAllowedFromHeader; | |
180 uint8_t scooterControl; | |
181 uint8_t scooterDrag; | |
182 uint8_t scooterLoad; | |
183 uint8_t scooterNumberOfBatteries; | |
184 uint16_t scooterBattSize; | |
185 uint8_t scooterSPARE1[7]; | |
186 uint8_t scooterSPARE2[19]; | |
187 // new in 0xFFFF0006 | |
188 uint8_t ppo2sensors_deactivated; | |
189 uint8_t tX_colorscheme; | |
190 uint8_t tX_userselectedLeftLowerCornerPrimary; | |
191 uint8_t tX_userselectedLeftLowerCornerTimeout; | |
192 uint8_t tX_customViewPrimary; | |
193 uint8_t tX_customViewTimeout; | |
194 uint8_t timeoutEnterButtonSelectDive; | |
195 uint16_t logbookOffset; | |
196 uint8_t alwaysShowPPO2; | |
197 uint8_t extraDisplay; | |
198 uint16_t display_toogle_desc; | |
199 int8_t offsetPressure_mbar; | |
200 int8_t offsetTemperature_centigrad; | |
201 uint8_t gasConsumption_travel_l_min; | |
202 uint8_t gasConsumption_bottom_l_min; | |
203 uint8_t gasConsumption_deco_l_min; | |
204 uint8_t debugModeOnStart; | |
205 uint8_t IAmStolenPleaseKillMe; | |
206 int16_t compassBearing; | |
207 uint8_t lastKnownBatteryPercentage; | |
208 uint8_t buttonBalance[3]; // 0 = right, 1 = center, 2 = left | |
209 uint8_t firmwareVersion[4]; | |
210 uint16_t timeoutSurfacemodeWithSensors; | |
211 // new in 0xFFFF0016 | |
212 uint8_t VPM_model; | |
213 uint8_t GF_model; | |
214 // new in 0xFFFF0017 | |
215 uint8_t FactoryButtonBase; | |
216 uint8_t FactoryButtonBalance[3]; | |
112
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
217 /* new in 0xFFFF0018 */ |
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
218 uint8_t FlipDisplay; |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
219 /* new in 0xFFFF0019 */ |
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
220 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
|
221 /* 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
|
222 uint8_t MotionDetection; |
112
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
223 |
38 | 224 } SSettings; |
225 | |
226 typedef struct | |
227 { | |
228 // 8 bytes | |
229 uint16_t primarySerial; | |
230 uint8_t primaryLicence; | |
231 uint8_t revision8bit; | |
232 uint8_t production_year; | |
233 uint8_t production_month; | |
234 uint8_t production_day; | |
235 uint8_t production_bluetooth_name_set; | |
236 | |
237 // 44 bytes | |
238 char production_info[44]; | |
239 | |
240 // 8 bytes | |
241 uint16_t secondarySerial; | |
242 uint8_t secondaryLicence; | |
243 uint8_t secondaryReason8bit; | |
244 uint8_t secondary_year; | |
245 uint8_t secondary_month; | |
246 uint8_t secondary_day; | |
247 uint8_t secondary_bluetooth_name_set; | |
248 | |
249 // 4 bytes | |
250 char secondary_info[4]; | |
251 } SHardwareData; | |
252 | |
253 uint8_t writeData(uint8_t *); | |
254 uint8_t readData(uint8_t what,uint8_t *); | |
255 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data); | |
256 | |
257 uint8_t getPPO2Max(void); | |
258 uint8_t getPPO2Min(void); | |
259 uint8_t getDiveMode(void); | |
260 uint8_t getCCRMode(void); | |
261 uint8_t getDecoType(void); | |
262 uint8_t getFutureTTS(void); | |
263 | |
264 SSettings* settingsGetPointer(void); | |
265 const SSettings* settingsGetPointerStandard(void); | |
266 void set_settings_to_Standard(void); | |
267 void mod_settings_for_first_start_with_empty_ext_flash(void); | |
268 const SFirmwareData* firmwareDataGetPointer(void); | |
269 const SHardwareData* hardwareDataGetPointer(void); | |
270 uint8_t firmwareVersion_16bit_high(void); | |
271 uint8_t firmwareVersion_16bit_low(void); | |
272 void hardwareBatchCode(uint8_t *high, uint8_t *low); | |
273 | |
274 uint8_t RTEminimum_required_high(void); | |
275 uint8_t RTEminimum_required_low(void); | |
276 uint8_t FONTminimum_required_high(void); | |
277 uint8_t FONTminimum_required_low(void); | |
278 | |
279 void setActualRTEversion(uint8_t high, uint8_t low); | |
280 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow); | |
281 | |
282 void set_new_settings_missing_in_ext_flash(void); | |
283 uint8_t check_and_correct_settings(void); | |
284 uint8_t newFirmwareVersionCheckViaSettings(void); | |
285 void set_settings_button_to_standard_with_individual_buttonBalance(void); | |
286 uint8_t getLicence(void); | |
287 void firmwareGetDate(RTC_DateTypeDef *SdateOutput); | |
288 | |
289 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values); | |
290 | |
291 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray); | |
292 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray); | |
293 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray); | |
294 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray); | |
295 | |
296 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values); | |
297 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage); | |
298 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC); | |
299 | |
300 #endif // SETTINGS_H |