Mercurial > public > ostc4
annotate Common/Inc/settings.h @ 555:573a2bc796c8
Added HW_Info to Discovery <=> RTE data exchange:
The information if an external ADC is supported and the type of the compass is forwarded to the Firmware software. This is especially needed to enable the menu structure to support calibration of external sensors
author | Ideenmodellierer |
---|---|
date | Thu, 12 Nov 2020 19:48:28 +0100 |
parents | af1c3e3abd5f |
children | 5d80bb8d22cb |
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 |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
526
diff
changeset
|
71 #define MAX_COMPASS_COMP (2u) |
550
af1c3e3abd5f
Make sure motion detection settings are set to default values:
Ideenmodellierer
parents:
546
diff
changeset
|
72 #define MAX_VIEWPORT_MODE (0x1F) |
546 | 73 |
38 | 74 /* 2015 Jan 30, hw, deco and travel added for MenuEditGas |
75 * can be used for buehlmann, vpm, etc. later but be carefull | |
76 * with current implemenation */ | |
77 typedef struct{ | |
78 uint8_t active:1; | |
79 uint8_t first:1; | |
80 uint8_t deco:1; | |
81 uint8_t travel:1; | |
526
88c626d01ee5
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
505
diff
changeset
|
82 uint8_t off:1; |
88c626d01ee5
Added new option to gas configuration: "Off":
Ideenmodellierer
parents:
505
diff
changeset
|
83 uint8_t spare:3; |
38 | 84 } gasubit8_t; |
85 | |
86 typedef union{ | |
87 gasubit8_t ub; | |
88 uint8_t uw; | |
89 } gasbit8_Type; | |
90 | |
91 typedef struct{ | |
92 uint8_t standard:4; | |
93 uint8_t alternative:4; | |
94 } ubit2x4_t; | |
95 | |
96 typedef union{ | |
97 ubit2x4_t ub; | |
98 uint8_t uw; | |
99 } split2x4_Type; | |
100 | |
101 typedef union{ | |
102 uint8_t u8[4]; | |
103 uint32_t u32; | |
104 } general32to8_Type; | |
105 | |
106 typedef struct | |
107 { | |
108 uint8_t oxygen_percentage; | |
109 uint8_t helium_percentage; | |
110 gasbit8_Type note; | |
111 uint8_t depth_meter; | |
112 uint8_t depth_meter_travel; | |
113 uint8_t bottle_size_liter; | |
114 // uint8_t bottle_wireless_status; | |
115 uint16_t bottle_wireless_id; | |
116 } SGasLine; | |
117 | |
118 typedef struct | |
119 { | |
120 uint8_t setpoint_cbar; | |
121 uint8_t depth_meter; | |
122 gasbit8_Type note; | |
123 } SSetpointLine; | |
124 | |
125 /* SSettings | |
126 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
127 */ | |
128 typedef struct | |
129 { | |
130 uint32_t header; | |
131 uint8_t warning_blink_dsec; | |
132 uint8_t lastDiveLogId; | |
133 uint32_t logFlashNextSampleStartAddress; | |
134 SGasLine gas[1 + (2*NUM_GASES)]; | |
135 SSetpointLine setpoint[1 + NUM_GASES]; | |
136 uint8_t CCR_Mode; | |
137 uint8_t dive_mode; | |
138 split2x4_Type deco_type; | |
139 uint8_t ppO2_max_deco; | |
140 uint8_t ppO2_max_std; | |
141 uint8_t ppO2_min; | |
142 uint8_t CNS_max; | |
143 uint8_t ascent_MeterPerMinute_max; | |
144 uint8_t ascent_MeterPerMinute_showGraph; | |
145 uint8_t future_TTS; | |
146 uint8_t GF_high; | |
147 uint8_t GF_low; | |
148 uint8_t aGF_high; | |
149 uint8_t aGF_low; | |
150 split2x4_Type VPM_conservatism; | |
151 uint8_t safetystopDuration; | |
152 uint8_t AtemMinutenVolumenLiter; | |
153 uint8_t ReserveFractionDenominator; | |
154 uint8_t salinity; | |
155 uint8_t last_stop_depth_meter; | |
156 uint8_t stop_increment_depth_meter; | |
157 uint8_t brightness; | |
158 uint8_t date_format; | |
159 uint8_t selected_language; | |
160 char customtext[60]; | |
161 uint16_t timeoutSurfacemode; | |
162 uint8_t timeoutMenuSurface; | |
163 uint8_t timeoutMenuDive; | |
164 uint8_t timeoutMenuEdit; | |
165 uint8_t timeoutInfo; | |
166 uint8_t timeoutInfoCompass; | |
167 uint8_t design; | |
168 uint16_t timeoutDiveReachedZeroDepth; | |
169 uint16_t divetimeToCreateLogbook; | |
170 uint8_t serialHigh; | |
171 uint8_t serialLow; | |
172 // SUFirmware firmwareVersion16to32bit; | |
173 uint32_t backup_localtime_rtc_tr; | |
174 uint32_t backup_localtime_rtc_dr; | |
175 uint16_t totalDiveCounter; | |
176 uint16_t personalDiveCount; | |
177 uint8_t showDebugInfo; | |
178 uint8_t ButtonResponsiveness[4];// changed content in 0xFFFF0016 | |
179 uint8_t nonMetricalSystem; | |
180 uint8_t fallbackToFixedSetpoint; | |
181 uint8_t bluetoothActive; /* will be set to zero on each startup at the moment */ | |
182 uint8_t safetystopDepth; | |
183 uint32_t updateSettingsAllowedFromHeader; | |
184 uint8_t scooterControl; | |
185 uint8_t scooterDrag; | |
186 uint8_t scooterLoad; | |
187 uint8_t scooterNumberOfBatteries; | |
188 uint16_t scooterBattSize; | |
189 uint8_t scooterSPARE1[7]; | |
190 uint8_t scooterSPARE2[19]; | |
191 // new in 0xFFFF0006 | |
192 uint8_t ppo2sensors_deactivated; | |
193 uint8_t tX_colorscheme; | |
194 uint8_t tX_userselectedLeftLowerCornerPrimary; | |
195 uint8_t tX_userselectedLeftLowerCornerTimeout; | |
196 uint8_t tX_customViewPrimary; | |
197 uint8_t tX_customViewTimeout; | |
198 uint8_t timeoutEnterButtonSelectDive; | |
199 uint16_t logbookOffset; | |
200 uint8_t alwaysShowPPO2; | |
201 uint8_t extraDisplay; | |
202 uint16_t display_toogle_desc; | |
203 int8_t offsetPressure_mbar; | |
204 int8_t offsetTemperature_centigrad; | |
205 uint8_t gasConsumption_travel_l_min; | |
206 uint8_t gasConsumption_bottom_l_min; | |
207 uint8_t gasConsumption_deco_l_min; | |
208 uint8_t debugModeOnStart; | |
209 uint8_t IAmStolenPleaseKillMe; | |
210 int16_t compassBearing; | |
211 uint8_t lastKnownBatteryPercentage; | |
212 uint8_t buttonBalance[3]; // 0 = right, 1 = center, 2 = left | |
213 uint8_t firmwareVersion[4]; | |
214 uint16_t timeoutSurfacemodeWithSensors; | |
215 // new in 0xFFFF0016 | |
216 uint8_t VPM_model; | |
217 uint8_t GF_model; | |
218 // new in 0xFFFF0017 | |
219 uint8_t FactoryButtonBase; | |
220 uint8_t FactoryButtonBalance[3]; | |
112
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
221 /* new in 0xFFFF0018 */ |
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
222 uint8_t FlipDisplay; |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
223 /* new in 0xFFFF0019 */ |
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
224 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
|
225 /* 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
|
226 uint8_t MotionDetection; |
498
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
372
diff
changeset
|
227 /* new in 0xFFFF001B */ |
4811f3dfaa52
Added dew parameter to enable selection of customer BigFont screens to be displayed
Ideenmodellierer
parents:
372
diff
changeset
|
228 uint32_t cv_config_BigScreen; |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
526
diff
changeset
|
229 /* new in 0xFFFF001C */ |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
526
diff
changeset
|
230 uint8_t compassInertia; |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
539
diff
changeset
|
231 uint8_t tX_customViewPrimaryBF; |
546 | 232 /* new in 0xFFFF001D */ |
233 uint8_t viewPortMode; | |
234 uint16_t viewRoll; | |
235 uint16_t viewPitch; | |
236 uint16_t viewYaw; | |
38 | 237 } SSettings; |
238 | |
239 typedef struct | |
240 { | |
241 // 8 bytes | |
242 uint16_t primarySerial; | |
243 uint8_t primaryLicence; | |
244 uint8_t revision8bit; | |
245 uint8_t production_year; | |
246 uint8_t production_month; | |
247 uint8_t production_day; | |
248 uint8_t production_bluetooth_name_set; | |
249 | |
250 // 44 bytes | |
251 char production_info[44]; | |
252 | |
253 // 8 bytes | |
254 uint16_t secondarySerial; | |
255 uint8_t secondaryLicence; | |
256 uint8_t secondaryReason8bit; | |
257 uint8_t secondary_year; | |
258 uint8_t secondary_month; | |
259 uint8_t secondary_day; | |
260 uint8_t secondary_bluetooth_name_set; | |
261 | |
262 // 4 bytes | |
263 char secondary_info[4]; | |
264 } SHardwareData; | |
265 | |
266 uint8_t writeData(uint8_t *); | |
267 uint8_t readData(uint8_t what,uint8_t *); | |
268 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data); | |
269 | |
270 uint8_t getPPO2Max(void); | |
271 uint8_t getPPO2Min(void); | |
272 uint8_t getDiveMode(void); | |
273 uint8_t getCCRMode(void); | |
274 uint8_t getDecoType(void); | |
275 uint8_t getFutureTTS(void); | |
276 | |
277 SSettings* settingsGetPointer(void); | |
278 const SSettings* settingsGetPointerStandard(void); | |
279 void set_settings_to_Standard(void); | |
280 void mod_settings_for_first_start_with_empty_ext_flash(void); | |
281 const SFirmwareData* firmwareDataGetPointer(void); | |
282 const SHardwareData* hardwareDataGetPointer(void); | |
283 uint8_t firmwareVersion_16bit_high(void); | |
284 uint8_t firmwareVersion_16bit_low(void); | |
285 void hardwareBatchCode(uint8_t *high, uint8_t *low); | |
286 | |
287 uint8_t RTEminimum_required_high(void); | |
288 uint8_t RTEminimum_required_low(void); | |
289 uint8_t FONTminimum_required_high(void); | |
290 uint8_t FONTminimum_required_low(void); | |
291 | |
292 void setActualRTEversion(uint8_t high, uint8_t low); | |
293 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow); | |
294 | |
295 void set_new_settings_missing_in_ext_flash(void); | |
296 uint8_t check_and_correct_settings(void); | |
297 uint8_t newFirmwareVersionCheckViaSettings(void); | |
298 void set_settings_button_to_standard_with_individual_buttonBalance(void); | |
299 uint8_t getLicence(void); | |
300 void firmwareGetDate(RTC_DateTypeDef *SdateOutput); | |
301 | |
302 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values); | |
303 | |
304 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray); | |
305 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray); | |
306 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray); | |
307 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray); | |
308 | |
309 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values); | |
310 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage); | |
311 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC); | |
312 | |
313 #endif // SETTINGS_H |