Mercurial > public > ostc4
annotate Common/Inc/settings.h @ 180:9ecc2e60418d Cleanup_Compass_Wireless
Removed not used compass code
Code was prepared for usage of LSM303DLHCTR but at the end the OSTC4 was never equipped with this chip
author | ideenmodellierer |
---|---|
date | Wed, 13 Mar 2019 21:49:25 +0100 |
parents | cc9c18075e00 |
children | b2a9e9b02df0 |
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 | |
69 /* 2015 Jan 30, hw, deco and travel added for MenuEditGas | |
70 * can be used for buehlmann, vpm, etc. later but be carefull | |
71 * with current implemenation */ | |
72 typedef struct{ | |
73 uint8_t active:1; | |
74 uint8_t first:1; | |
75 uint8_t deco:1; | |
76 uint8_t travel:1; | |
77 uint8_t senderCode:4; | |
78 } gasubit8_t; | |
79 | |
80 typedef union{ | |
81 gasubit8_t ub; | |
82 uint8_t uw; | |
83 } gasbit8_Type; | |
84 | |
85 typedef struct{ | |
86 uint8_t standard:4; | |
87 uint8_t alternative:4; | |
88 } ubit2x4_t; | |
89 | |
90 typedef union{ | |
91 ubit2x4_t ub; | |
92 uint8_t uw; | |
93 } split2x4_Type; | |
94 | |
95 typedef union{ | |
96 uint8_t u8[4]; | |
97 uint32_t u32; | |
98 } general32to8_Type; | |
99 | |
100 typedef struct | |
101 { | |
102 uint8_t oxygen_percentage; | |
103 uint8_t helium_percentage; | |
104 gasbit8_Type note; | |
105 uint8_t depth_meter; | |
106 uint8_t depth_meter_travel; | |
107 uint8_t bottle_size_liter; | |
108 // uint8_t bottle_wireless_status; | |
109 uint16_t bottle_wireless_id; | |
110 } SGasLine; | |
111 | |
112 typedef struct | |
113 { | |
114 uint8_t setpoint_cbar; | |
115 uint8_t depth_meter; | |
116 gasbit8_Type note; | |
117 } SSetpointLine; | |
118 | |
119 /* SSettings | |
120 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
121 */ | |
122 typedef struct | |
123 { | |
124 uint32_t header; | |
125 uint8_t warning_blink_dsec; | |
126 uint8_t lastDiveLogId; | |
127 uint32_t logFlashNextSampleStartAddress; | |
128 SGasLine gas[1 + (2*NUM_GASES)]; | |
129 SSetpointLine setpoint[1 + NUM_GASES]; | |
130 uint8_t CCR_Mode; | |
131 uint8_t dive_mode; | |
132 split2x4_Type deco_type; | |
133 uint8_t ppO2_max_deco; | |
134 uint8_t ppO2_max_std; | |
135 uint8_t ppO2_min; | |
136 uint8_t CNS_max; | |
137 uint8_t ascent_MeterPerMinute_max; | |
138 uint8_t ascent_MeterPerMinute_showGraph; | |
139 uint8_t future_TTS; | |
140 uint8_t GF_high; | |
141 uint8_t GF_low; | |
142 uint8_t aGF_high; | |
143 uint8_t aGF_low; | |
144 split2x4_Type VPM_conservatism; | |
145 uint8_t safetystopDuration; | |
146 uint8_t AtemMinutenVolumenLiter; | |
147 uint8_t ReserveFractionDenominator; | |
148 uint8_t salinity; | |
149 uint8_t last_stop_depth_meter; | |
150 uint8_t stop_increment_depth_meter; | |
151 uint8_t brightness; | |
152 uint8_t date_format; | |
153 uint8_t selected_language; | |
154 char customtext[60]; | |
155 uint16_t timeoutSurfacemode; | |
156 uint8_t timeoutMenuSurface; | |
157 uint8_t timeoutMenuDive; | |
158 uint8_t timeoutMenuEdit; | |
159 uint8_t timeoutInfo; | |
160 uint8_t timeoutInfoCompass; | |
161 uint8_t design; | |
162 uint16_t timeoutDiveReachedZeroDepth; | |
163 uint16_t divetimeToCreateLogbook; | |
164 uint8_t serialHigh; | |
165 uint8_t serialLow; | |
166 // SUFirmware firmwareVersion16to32bit; | |
167 uint32_t backup_localtime_rtc_tr; | |
168 uint32_t backup_localtime_rtc_dr; | |
169 uint16_t totalDiveCounter; | |
170 uint16_t personalDiveCount; | |
171 uint8_t showDebugInfo; | |
172 uint8_t ButtonResponsiveness[4];// changed content in 0xFFFF0016 | |
173 uint8_t nonMetricalSystem; | |
174 uint8_t fallbackToFixedSetpoint; | |
175 uint8_t bluetoothActive; /* will be set to zero on each startup at the moment */ | |
176 uint8_t safetystopDepth; | |
177 uint32_t updateSettingsAllowedFromHeader; | |
178 uint8_t scooterControl; | |
179 uint8_t scooterDrag; | |
180 uint8_t scooterLoad; | |
181 uint8_t scooterNumberOfBatteries; | |
182 uint16_t scooterBattSize; | |
183 uint8_t scooterSPARE1[7]; | |
184 uint8_t scooterSPARE2[19]; | |
185 // new in 0xFFFF0006 | |
186 uint8_t ppo2sensors_deactivated; | |
187 uint8_t tX_colorscheme; | |
188 uint8_t tX_userselectedLeftLowerCornerPrimary; | |
189 uint8_t tX_userselectedLeftLowerCornerTimeout; | |
190 uint8_t tX_customViewPrimary; | |
191 uint8_t tX_customViewTimeout; | |
192 uint8_t timeoutEnterButtonSelectDive; | |
193 uint16_t logbookOffset; | |
194 uint8_t alwaysShowPPO2; | |
195 uint8_t extraDisplay; | |
196 uint16_t display_toogle_desc; | |
197 int8_t offsetPressure_mbar; | |
198 int8_t offsetTemperature_centigrad; | |
199 uint8_t gasConsumption_travel_l_min; | |
200 uint8_t gasConsumption_bottom_l_min; | |
201 uint8_t gasConsumption_deco_l_min; | |
202 uint8_t debugModeOnStart; | |
203 uint8_t IAmStolenPleaseKillMe; | |
204 int16_t compassBearing; | |
205 uint8_t lastKnownBatteryPercentage; | |
206 uint8_t buttonBalance[3]; // 0 = right, 1 = center, 2 = left | |
207 uint8_t firmwareVersion[4]; | |
208 uint16_t timeoutSurfacemodeWithSensors; | |
209 // new in 0xFFFF0016 | |
210 uint8_t VPM_model; | |
211 uint8_t GF_model; | |
212 // new in 0xFFFF0017 | |
213 uint8_t FactoryButtonBase; | |
214 uint8_t FactoryButtonBalance[3]; | |
215 | |
112
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
216 /* new in 0xFFFF0018 */ |
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
217 uint8_t FlipDisplay; |
fdf0272e9213
Added new nvm parameter"FlipDisplay" indicating the screen orientation
Ideenmodellierer
parents:
38
diff
changeset
|
218 |
38 | 219 //to be continued |
220 } SSettings; | |
221 | |
222 typedef struct | |
223 { | |
224 // 8 bytes | |
225 uint16_t primarySerial; | |
226 uint8_t primaryLicence; | |
227 uint8_t revision8bit; | |
228 uint8_t production_year; | |
229 uint8_t production_month; | |
230 uint8_t production_day; | |
231 uint8_t production_bluetooth_name_set; | |
232 | |
233 // 44 bytes | |
234 char production_info[44]; | |
235 | |
236 // 8 bytes | |
237 uint16_t secondarySerial; | |
238 uint8_t secondaryLicence; | |
239 uint8_t secondaryReason8bit; | |
240 uint8_t secondary_year; | |
241 uint8_t secondary_month; | |
242 uint8_t secondary_day; | |
243 uint8_t secondary_bluetooth_name_set; | |
244 | |
245 // 4 bytes | |
246 char secondary_info[4]; | |
247 } SHardwareData; | |
248 | |
249 uint8_t writeData(uint8_t *); | |
250 uint8_t readData(uint8_t what,uint8_t *); | |
251 uint8_t readDataLimits__8and16BitValues_4and7BytesOutput(uint8_t what, uint8_t * data); | |
252 | |
253 uint8_t getPPO2Max(void); | |
254 uint8_t getPPO2Min(void); | |
255 uint8_t getDiveMode(void); | |
256 uint8_t getCCRMode(void); | |
257 uint8_t getDecoType(void); | |
258 uint8_t getFutureTTS(void); | |
259 | |
260 SSettings* settingsGetPointer(void); | |
261 const SSettings* settingsGetPointerStandard(void); | |
262 void set_settings_to_Standard(void); | |
263 void mod_settings_for_first_start_with_empty_ext_flash(void); | |
264 const SFirmwareData* firmwareDataGetPointer(void); | |
265 const SHardwareData* hardwareDataGetPointer(void); | |
266 uint8_t firmwareVersion_16bit_high(void); | |
267 uint8_t firmwareVersion_16bit_low(void); | |
268 void hardwareBatchCode(uint8_t *high, uint8_t *low); | |
269 | |
270 uint8_t RTEminimum_required_high(void); | |
271 uint8_t RTEminimum_required_low(void); | |
272 uint8_t FONTminimum_required_high(void); | |
273 uint8_t FONTminimum_required_low(void); | |
274 | |
275 void setActualRTEversion(uint8_t high, uint8_t low); | |
276 void getActualRTEandFONTversion(uint8_t *RTEhigh, uint8_t *RTElow, uint8_t *FONThigh, uint8_t *FONTlow); | |
277 | |
278 void set_new_settings_missing_in_ext_flash(void); | |
279 uint8_t check_and_correct_settings(void); | |
280 uint8_t newFirmwareVersionCheckViaSettings(void); | |
281 void set_settings_button_to_standard_with_individual_buttonBalance(void); | |
282 uint8_t getLicence(void); | |
283 void firmwareGetDate(RTC_DateTypeDef *SdateOutput); | |
284 | |
285 void settingsHelperButtonSens_original_translate_to_hwOS_values(const uint32_t inputValueRaw, uint8_t *outArray4Values); | |
286 | |
287 uint8_t buttonBalanceTranslatorHexToArray(uint8_t hexValue, uint8_t* outputArray); | |
288 uint8_t buttonBalanceTranslateArrayOutHex(const uint8_t* inputArray); | |
289 void getButtonFactorDefaults(uint8_t* basePercentage, uint8_t* buttonBalanceArray); | |
290 void settingsWriteFactoryDefaults(uint8_t inputValueRaw, uint8_t *inputBalanceArray); | |
291 | |
292 void settingsHelperButtonSens_keepPercentageValues(uint32_t inputValueRaw, uint8_t *outArray4Values); | |
293 uint8_t settingsHelperButtonSens_translate_percentage_to_hwOS_values(uint8_t inputValuePercentage); | |
294 uint8_t settingsHelperButtonSens_translate_hwOS_values_to_percentage(uint8_t inputValuePIC); | |
295 | |
296 #endif // SETTINGS_H |