Mercurial > public > ostc4
annotate Common/Inc/data_central.h @ 949:c6b858f2e025 Evo_2_23
GNSS UTC in Date-Time menu:
The UTC time provided by the gnss module is not shown in the date-time settings menu. If a valid time signal is available then the OSTC RTC may be set to it by selecting the UTC menu entry. The time zone has to be selected manually. This is possible using a separate edit line.
author | Ideenmodellierer |
---|---|
date | Sun, 22 Dec 2024 21:19:21 +0100 |
parents | aad1a6b9aaec |
children | e9c37071933b |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Common/Inc/data_central.h | |
5 /// \brief Common Dadatypes Declarations | |
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 DATA_CENTRAL_H | |
28 #define DATA_CENTRAL_H | |
29 | |
30 #include <stdint.h> | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
31 #include <stdbool.h> |
38 | 32 |
33 #include "settings.h" | |
34 #include "stm32f4xx_hal.h" | |
672 | 35 #include "configuration.h" |
38 | 36 |
37 #define BUEHLMANN_STRUCT_MAX_GASES 11 | |
38 #define BUEHLMANN_STRUCT_MAX_ASCENDRATES 3 | |
39 #define DECOINFO_STRUCT_MAX_STOPS 50 | |
40 | |
41 #define false 0 | |
42 #define true 1 | |
43 | |
796 | 44 #define EXT_INTERFACE_SENSOR_CNT (8u) /* 1 MUX + 7 sensors may be connected to the external interface (1 MUX + 3 ADC + 4 UART) */ |
45 #define EXT_INTERFACE_MUX_OFFSET (3u) /* the sensor struct starts with 3 ADC sensors */ | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
46 |
38 | 47 /* Helper structs ------------------------------------------------------------*/ |
48 | |
49 //struct SGas | |
50 //contains gasinfos of single gas for deco calculation | |
51 typedef struct | |
52 { | |
53 uint8_t nitrogen_percentage; | |
54 uint8_t helium_percentage; | |
55 uint8_t setPoint_cbar; | |
56 uint8_t change_during_ascent_depth_meter_otherwise_zero; | |
57 uint8_t GasIdInSettings; | |
662 | 58 uint8_t AppliedDiveMode; |
59 float pscr_factor; | |
38 | 60 } SGas; |
61 | |
62 typedef struct | |
63 { | |
64 float use_from_depth_bar; | |
65 float rate_bar_per_minute; | |
66 } SAscentrate; | |
67 | |
68 | |
69 typedef struct{ | |
70 uint32_t date_rtc_dr; | |
71 uint32_t time_rtc_tr; | |
72 int32_t value_int32; | |
73 } SDeviceLine; | |
74 | |
75 | |
76 typedef struct | |
77 { | |
78 uint16_t ageInMilliSeconds; | |
79 uint8_t numberOfBytes; | |
80 uint8_t status; | |
81 uint8_t data[12]; | |
82 } SDataWireless; | |
83 | |
662 | 84 |
85 typedef struct | |
86 { | |
748 | 87 uint32_t CO2_ppm; |
662 | 88 uint16_t signalStrength; |
89 } SCO2Sensor; | |
90 | |
38 | 91 /* Main structs -------------------------------------------------------------*/ |
92 | |
93 | |
94 //struct SDecoinfo | |
95 //contains result of deco calculation | |
96 typedef struct | |
97 { | |
98 unsigned short output_stop_length_seconds[DECOINFO_STRUCT_MAX_STOPS]; | |
99 int output_time_to_surface_seconds; | |
100 int output_ndl_seconds; | |
101 float output_ceiling_meter; | |
247
3949781096d4
feature: Relative GF to Saturation renames
Jan Mulder <jlmulder@xs4all.nl>
parents:
225
diff
changeset
|
102 float super_saturation; |
38 | 103 uint32_t tickstamp; |
104 } SDecoinfo; | |
105 | |
106 | |
107 typedef struct | |
108 { | |
109 //crushing pressure | |
110 //in/out | |
111 float max_crushing_pressure_he[16]; | |
112 float max_crushing_pressure_n2[16]; | |
113 // | |
114 float run_time_start_of_deco_zone_save; | |
115 float depth_start_of_deco_zone_save; | |
116 float max_first_stop_depth_save; | |
117 short decomode_vpm_plus_conservatism_last_dive; | |
118 _Bool deco_zone_reached; | |
119 //State variables for repetetive dives | |
120 _Bool repetitive_variables_not_valid; | |
121 float adjusted_crushing_pressure_he[16]; | |
122 float adjusted_crushing_pressure_n2[16]; | |
123 float adjusted_critical_radius_he[16]; | |
124 float adjusted_critical_radius_n2[16]; | |
125 float initial_allowable_gradient_he[16]; | |
126 float initial_allowable_gradient_n2[16]; | |
127 float max_actual_gradient[16]; | |
128 } SVpm; | |
129 | |
130 typedef struct | |
131 { | |
132 _Bool repetitive_variables_not_valid; | |
133 _Bool is_data_from_RTE_CPU; | |
134 _Bool spare2; | |
135 _Bool spare3; | |
136 float adjusted_crushing_pressure_he[16]; | |
137 float adjusted_crushing_pressure_n2[16]; | |
138 float adjusted_critical_radius_he[16]; | |
139 float adjusted_critical_radius_n2[16]; | |
140 float initial_allowable_gradient_he[16]; | |
141 float initial_allowable_gradient_n2[16]; | |
142 float max_actual_gradient[16]; | |
143 } SVpmRepetitiveData; | |
144 | |
145 //struct SDevice | |
146 //contains information about usage | |
147 typedef struct | |
148 { | |
149 SDeviceLine batteryChargeCycles; | |
150 SDeviceLine batteryChargeCompleteCycles; | |
151 SDeviceLine temperatureMinimum; | |
152 SDeviceLine temperatureMaximum; | |
153 SDeviceLine depthMaximum; | |
154 SDeviceLine diveCycles; | |
155 SDeviceLine voltageMinimum; | |
156 SDeviceLine hoursOfOperation; | |
157 SDeviceLine diveAccident; | |
158 } SDevice; | |
159 | |
160 /* | |
161 typedef struct | |
162 { | |
163 SDevice device; | |
164 SVpmRepetitiveData vpm; | |
165 } SDeviceState; | |
166 */ | |
167 | |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
168 typedef struct |
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
169 { |
931 | 170 float fLat; |
171 float fLon; | |
941 | 172 }SGnssCoord; |
173 | |
949 | 174 |
175 typedef struct | |
176 { | |
177 uint8_t year; | |
178 uint8_t month; | |
179 uint8_t day; | |
180 uint8_t hour; | |
181 uint8_t min; | |
182 uint8_t sec; | |
183 }SDateTime; | |
184 | |
941 | 185 typedef struct |
186 { | |
187 SGnssCoord coord; | |
940 | 188 uint8_t alive; |
931 | 189 uint8_t fixType; |
190 uint8_t numSat; /* number of available satellites */ | |
191 uint8_t signalQual[4]; /* signal quality indicator for x sats */ | |
949 | 192 SDateTime DateTime; /* UTC time information */ |
931 | 193 } SGnssInfo; |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
194 |
945 | 195 typedef enum |
196 { | |
197 SE_INIT = 0, | |
198 SE_REINIT, | |
199 SE_ACTIVE, | |
200 SE_END | |
201 } SSlowExitState; | |
202 | |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
203 |
38 | 204 /* struct SLifeData |
205 * contains data all actual data (pressure, stuturation, etc. as received from second ship | |
206 * and has actualGas to be send to Small CPU (second chip) | |
207 * contains data calculated from actual data after receiption from Small CPU | |
208 */ | |
209 typedef struct | |
210 { | |
211 /* from Small CPU */ | |
780 | 212 uint8_t extIf_sensor_data[3][32]; /* The external sensor may contain a 64 bit ID. It has been placed at the beginning of the structure to avoid problems in alignment */ |
752
4f19336a3f21
Dev Bugfix: Alignment problem in lifedata structure:
Ideenmodellierer
parents:
748
diff
changeset
|
213 uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT]; |
4f19336a3f21
Dev Bugfix: Alignment problem in lifedata structure:
Ideenmodellierer
parents:
748
diff
changeset
|
214 |
38 | 215 int32_t dive_time_seconds; |
216 int32_t dive_time_seconds_without_surface_time; | |
217 uint32_t surface_time_seconds; | |
218 float pressure_ambient_bar; | |
219 float pressure_surface_bar; | |
220 float tissue_nitrogen_bar[16]; | |
221 float tissue_helium_bar[16]; | |
222 float cns; | |
223 float otu; | |
224 uint16_t desaturation_time_minutes; | |
225 uint16_t no_fly_time_minutes; | |
226 float temperature_celsius; | |
227 float compass_heading; | |
228 float compass_roll; | |
229 float compass_pitch; | |
230 int16_t compass_DX_f; | |
231 int16_t compass_DY_f; | |
232 int16_t compass_DZ_f; | |
233 uint16_t counterSecondsShallowDepth; | |
234 float ascent_rate_meter_per_min; | |
235 uint32_t timeBinaryFormat; | |
236 uint32_t dateBinaryFormat; | |
237 float battery_voltage; | |
238 float battery_charge; | |
239 uint16_t ambient_light_level; | |
240 SDataWireless wireless_data[4]; | |
241 uint8_t buttonPICdata[4]; | |
662 | 242 SCO2Sensor CO2_data; |
714
045ff7800501
Added customizable data area for specific sensor data:
Ideenmodellierer
parents:
672
diff
changeset
|
243 uint8_t extIf_sensor_Id; |
38 | 244 |
245 /* by create DiveSettings() and by setActualGas() | |
246 * is send to Small CPU2 for nitrogen calculation | |
247 * includes setpoint information | |
248 */ | |
249 SGas actualGas; | |
771
29d9b5bc7946
Revised automatic setpoint change. The proposed approach is essentially the approach used by most controllers of eCCR ('upshift' on descent, 'downshift' on ascent), so that the OSTC4 when used as a backup computer for eCCR will make the changes at the same time as the eCCR itself.
heinrichsweikamp
parents:
752
diff
changeset
|
250 |
38 | 251 uint8_t lastDiluent_GasIdInSettings; |
771
29d9b5bc7946
Revised automatic setpoint change. The proposed approach is essentially the approach used by most controllers of eCCR ('upshift' on descent, 'downshift' on ascent), so that the OSTC4 when used as a backup computer for eCCR will make the changes at the same time as the eCCR itself.
heinrichsweikamp
parents:
752
diff
changeset
|
252 float lastSetpointChangeDepthM; |
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)
heinrichsweikamp
parents:
780
diff
changeset
|
253 bool setpointDecoActivated; |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
780
diff
changeset
|
254 bool setpointLowDelayed; |
38 | 255 |
256 /* calculated by DataEX_copy_to_LifeData() | |
257 bottle_bar array size is made like this to have multiples of 32bit | |
258 */ | |
259 float ppO2; | |
260 float depth_meter; | |
261 float max_depth_meter; | |
262 float average_depth_meter; | |
263 float apnea_total_max_depth_meter; | |
264 float apnea_last_max_depth_meter; | |
265 int32_t apnea_last_dive_time_seconds; | |
266 uint16_t bottle_bar[2 * NUM_GASES +1]; | |
267 uint16_t bottle_bar_age_MilliSeconds[2 * NUM_GASES + 1]; | |
268 uint16_t apnea_total_counter; | |
269 | |
270 /* control of DataEX_copy_to_LifeData() | |
271 */ | |
272 uint8_t boolResetAverageDepth; | |
273 uint8_t bool_temp1; | |
274 uint8_t bool_temp2; | |
275 | |
276 /* from local sensor or direct HUD communication */ | |
277 //pp O2 Sensor | |
278 float ppO2Sensor_bar[3]; | |
279 float sensorVoltage_mV[3]; | |
280 float HUD_battery_voltage_V; | |
662 | 281 |
282 /* for PSCR Mode */ | |
283 float ppo2Simulated_bar; | |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
284 /* GNSS data */ |
931 | 285 SGnssInfo gnssData; |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
286 |
38 | 287 } SLifeData; |
288 | |
289 | |
290 typedef struct | |
291 { | |
292 uint16_t tissue_nitrogen_desaturation_time_minutes[16]; | |
293 uint16_t tissue_helium_desaturation_time_minutes[16]; | |
294 } SLifeData2; | |
295 | |
296 | |
297 typedef struct | |
298 { | |
299 //warnings | |
300 int8_t decoMissed; | |
301 int8_t aGf; | |
302 int8_t ascentRateHigh; | |
303 int8_t ppO2Low; | |
304 int8_t ppO2High; | |
305 int8_t cnsHigh; | |
306 int8_t slowWarning; | |
307 int8_t lowBattery; | |
308 int8_t numWarnings; | |
309 int8_t sensorLinkLost; | |
310 int8_t sensorOutOfBounds[3]; | |
311 int8_t betterGas; | |
312 int8_t fallback; | |
313 int8_t betterSetpoint; | |
752
4f19336a3f21
Dev Bugfix: Alignment problem in lifedata structure:
Ideenmodellierer
parents:
748
diff
changeset
|
314 int8_t co2High; |
478
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
309
diff
changeset
|
315 #ifdef ENABLE_BOTTLE_SENSOR |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
309
diff
changeset
|
316 int8_t newPressure; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
309
diff
changeset
|
317 #endif |
857 | 318 #ifdef HAVE_DEBUG_WARNINGS |
319 int8_t debug; | |
320 #endif | |
38 | 321 } SWarnings; |
322 | |
323 | |
324 typedef struct | |
325 { | |
326 //Events logbook only | |
327 int16_t manualMarker; | |
328 int16_t gasChange; | |
329 int16_t info_GasChange; | |
330 int16_t setpointChange; | |
331 int16_t info_SetpointChange; | |
281 | 332 int16_t manualGasSet; |
333 int16_t info_manualGasSetHe; | |
334 int16_t info_manualGasSetO2; | |
38 | 335 int16_t bailout; |
336 int16_t info_bailoutHe; | |
337 int16_t info_bailoutO2; | |
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
925
diff
changeset
|
338 int16_t compassHeadingUpdate; |
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
925
diff
changeset
|
339 uint16_t info_compassHeadingUpdate; |
941 | 340 int16_t gnssPositionUpdate; |
341 SGnssCoord info_gnssPosition; | |
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
925
diff
changeset
|
342 } SEvents; |
38 | 343 |
344 | |
345 | |
346 //struct SDiveSettings | |
347 //contains settings necessary for deco calculation | |
348 typedef struct | |
349 { | |
350 float last_stop_depth_bar; | |
351 float input_next_stop_increment_depth_bar; | |
352 float input_second_to_last_stop_depth_bar; | |
353 float ascentRate_meterperminute; | |
354 uint8_t diveMode; /* OC, CC, .. */ | |
355 uint8_t CCR_Mode; | |
356 uint8_t future_TTS_minutes; | |
357 | |
358 /* If beginning of dive is CCR than ccrOption is set true | |
359 * true allows returning from bailout (OC) back to CCR | |
360 * true activates CC gas and setpoint pages in dive menu | |
361 */ | |
362 uint8_t ccrOption; | |
363 uint8_t fallbackOption; | |
364 uint8_t ppo2sensors_deactivated; | |
365 | |
366 split2x4_Type deco_type; /* GF or VPM for standard and alternative seperate */ | |
367 | |
368 /* VPM conservatism, do not change during dive!!! | |
369 * do not change in between dives otherwise repetitve dive is not possible | |
370 */ | |
371 uint8_t vpm_conservatism; | |
372 | |
902 | 373 /* VPM table mode, do not change during dive!!! |
374 */ | |
375 uint8_t vpm_tableMode; | |
376 | |
38 | 377 /* B�hlmann GF |
378 * and a variable that is used by Buehlmann during the dive | |
379 * to remember the position of GF low during ascend | |
380 */ | |
381 uint8_t gf_high; | |
382 uint8_t gf_low; | |
383 | |
384 /* copy of the Settings GasList and SetpintList | |
385 * that can be modified during the dive | |
386 * especially gases can be actived and deactivated | |
387 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
388 */ | |
389 SGasLine gas[1 + (2*NUM_GASES)]; | |
390 SSetpointLine setpoint[1 + NUM_GASES]; | |
391 | |
392 /* List of GasChanges in the actual order | |
393 * this is necessary for VPM and Buehlmann and will be created on start of each calculation | |
394 */ | |
395 SGas decogaslist[BUEHLMANN_STRUCT_MAX_GASES]; // unused filled with 0xFF | |
396 | |
397 /* | |
398 */ | |
399 float internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero; | |
400 uint16_t compassHeading; | |
662 | 401 |
402 uint8_t pscr_o2_drop; | |
403 uint8_t pscr_lung_ratio; | |
834
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
805
diff
changeset
|
404 |
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
805
diff
changeset
|
405 uint32_t activeAFViews; |
38 | 406 } SDiveSettings; |
407 | |
408 enum CHARGE_STATUS{ | |
409 CHARGER_off = 0, | |
410 CHARGER_running, | |
411 CHARGER_complete, | |
412 CHARGER_lostConnection | |
413 }; | |
414 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
415 typedef enum { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
416 TIMER_STATE_OFF = 0, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
417 TIMER_STATE_PRESTART, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
418 TIMER_STATE_RUNNING, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
419 TIMER_STATE_WAIT_FINISHED, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
420 TIMER_STATE_FINISHED, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
421 } timerState_e; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
422 |
38 | 423 typedef struct |
424 { | |
425 SDiveSettings diveSettings; | |
426 SLifeData lifeData; | |
427 SVpm vpm; | |
428 SEvents events; | |
429 SWarnings warnings; | |
430 SDecoinfo decolistVPM; | |
431 SDecoinfo decolistFutureVPM; | |
432 SDecoinfo decolistBuehlmann; // | |
433 SDecoinfo decolistFutureBuehlmann; | |
434 uint8_t mode; /* hw for sleep, surface, dive, .. */ | |
435 uint8_t chargeStatus; | |
436 uint8_t data_old__lost_connection_to_slave; | |
437 | |
438 uint32_t pressure_uTick_new; | |
439 uint32_t compass_uTick_new; | |
440 | |
441 uint32_t pressure_uTick_old; | |
442 uint32_t compass_uTick_old; | |
443 | |
444 uint32_t pressure_uTick_local_new; | |
445 uint32_t compass_uTick_local_new; | |
446 | |
447 uint8_t cnsHigh_at_the_end_of_dive; | |
448 uint8_t decoMissed_at_the_end_of_dive; | |
449 | |
450 uint8_t sensorErrorsRTE; | |
451 | |
452 uint8_t lastKnownBatteryPercentage; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
453 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
454 timerState_e timerState; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
455 int timerStartedS; |
925 | 456 |
457 SScrubberData scrubberDataDive[2]; | |
38 | 458 } SDiveState; |
459 | |
460 | |
461 typedef struct{ | |
462 uint8_t bit0:1; | |
463 uint8_t bit1:1; | |
464 uint8_t bit2:1; | |
465 uint8_t bit3:1; | |
466 uint8_t bit4:1; | |
467 uint8_t bit5:1; | |
468 uint8_t bit6:1; | |
469 uint8_t bit7:1; | |
470 } ubit8_t; | |
471 | |
472 typedef union{ | |
473 ubit8_t ub; | |
474 uint8_t uw; | |
475 } bit8_Type; | |
476 | |
477 extern SDiveState stateSim; | |
478 extern SDiveState stateDeco; | |
479 extern uint8_t decoLock; | |
271
1303747b5ba2
cleanup: also write gas and setpoint changes in simulator mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
270
diff
changeset
|
480 extern const SDiveState *stateUsed; |
1303747b5ba2
cleanup: also write gas and setpoint changes in simulator mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
270
diff
changeset
|
481 extern SDiveState *stateUsedWrite; |
38 | 482 |
483 enum DECO_LOCK{ | |
484 DECO_CALC_running, | |
485 DECO_CALC_ready, | |
486 DECO_CALC_FINSHED_Buehlmann, | |
487 DECO_CALC_FINSHED_vpm, | |
488 DECO_CALC_FINSHED_FutureBuehlmann, | |
489 DECO_CALC_FINSHED_Futurevpm, | |
490 DECO_CALC_init_as_is_start_of_dive, | |
491 DECO_CALC_undefined | |
492 }; | |
493 | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
494 typedef enum |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
495 { |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
496 SENSOR_NONE, |
745 | 497 SENSOR_SEARCH, |
733 | 498 SENSOR_OPTIC, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
499 SENSOR_ANALOG, |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
500 SENSOR_DIGO2, |
796 | 501 SENSOR_DIGO2M, |
745 | 502 SENSOR_SENTINEL, |
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
834
diff
changeset
|
503 SENSOR_SENTINELM, |
745 | 504 SENSOR_TYPE_O2_END, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
505 SENSOR_CO2, |
799 | 506 SENSOR_CO2M, |
920 | 507 SENSOR_GNSS, |
508 SENSOR_GNSSM, | |
780 | 509 SENSOR_MUX, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
510 SENSOR_END |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
511 } externalInterfaceSensorType; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
512 |
745 | 513 #define DVO2_FATAL_INTENSITY_LOW (0x00000001) |
514 #define DVO2_FATAL_AMBIENT_HIGH (0x00000002) | |
515 #define DVO2_FATAL_REFINT_LOW (0x00000004) | |
516 #define DVO2_FATAL_REFAMB_HIGH (0x00000008) | |
517 #define DVO2_FATAL_TEMPERATURE (0x00000010) | |
518 | |
519 #define DVO2_FATAL_ERROR (DVO2_FATAL_INTENSITY_LOW | DVO2_FATAL_AMBIENT_HIGH | DVO2_FATAL_REFINT_LOW | DVO2_FATAL_REFAMB_HIGH | DVO2_FATAL_TEMPERATURE) | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
520 |
38 | 521 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow); |
522 | |
523 void set_stateUsedToSim(void); | |
524 void set_stateUsedToReal(void); | |
525 | |
526 _Bool is_stateUsedSetToSim(void); | |
527 | |
528 const SDiveState * stateRealGetPointer(void); | |
529 const SDiveState * stateSimGetPointer(void); | |
530 SDiveState * stateRealGetPointerWrite(void); | |
531 SDiveState * stateSimGetPointerWrite(void); | |
532 const SDevice * stateDeviceGetPointer(void); | |
533 SDevice * stateDeviceGetPointerWrite(void); | |
534 const SVpmRepetitiveData * stateVpmRepetitiveDataGetPointer(void); | |
535 SVpmRepetitiveData * stateVpmRepetitiveDataGetPointerWrite(void); | |
536 | |
537 void UpdateLifeDataTest(SDiveState * diveState); | |
538 | |
539 void setSimulationValues(int _ascent_rate_meter_per_min, int _descent_rate_meter_per_min, int _max_depth, int _bottom_time ); | |
540 | |
541 void createDiveSettings(void); | |
542 void copyDiveSettingsToSim(void); | |
543 void copyVpmRepetetiveDataToSim(void); | |
544 //void fallbackToFixedSetpoints(SLifeData *lifeData); | |
545 void setActualGasFirst(SLifeData *lifeData); | |
546 void setActualGasAir(SLifeData *lifeData); | |
547 void setActualGas(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar); | |
548 void setActualGas_ExtraGas(SLifeData *lifeData, uint8_t oxygen, uint8_t helium, uint8_t setpoint_cbar); | |
549 void setActualGas_DM(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar); | |
550 void setWeekday(RTC_DateTypeDef *sDate); | |
551 void setDate(RTC_DateTypeDef Sdate); | |
552 void setTime(RTC_TimeTypeDef Stime); | |
553 void setBatteryPercentage(uint8_t newChargePercentage); | |
554 void setButtonResponsiveness(uint8_t *ButtonSensitivyList); | |
555 void calibrateCompass(void); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
478
diff
changeset
|
556 void compass_Inertia(float newHeading); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
478
diff
changeset
|
557 float compass_getCompensated(); |
38 | 558 void clearDeco(void); |
559 void translateDate(uint32_t datetmpreg, RTC_DateTypeDef *sDate); | |
560 void translateTime(uint32_t tmpreg, RTC_TimeTypeDef *sTime); | |
561 void updateSetpointStateUsed(void); | |
562 | |
563 uint8_t calc_MOD(uint8_t gasId); | |
564 uint8_t calc_MinOD(uint8_t gasId); | |
565 //float calc_ppO2(float input_ambient_pressure_bar, SGas* pGas); | |
566 int current_second(void); | |
567 _Bool vpm_crush(SDiveState* pDiveState); | |
568 _Bool deco_zone_reached(void); | |
270
2e58a4094770
feature, debug: make simulator write a logbook entry
Jan Mulder <jlmulder@xs4all.nl>
parents:
247
diff
changeset
|
569 void resetEvents(const SDiveState *pStateUsed); |
38 | 570 |
571 uint32_t crc32c_checksum(uint8_t* message, uint16_t length, uint8_t* message2, uint16_t length2); | |
572 uint32_t CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words); | |
573 uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words); | |
574 | |
575 _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData); | |
576 | |
662 | 577 uint8_t isLoopMode(uint8_t Mode); |
578 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
579 bool isCompassCalibrated(void); |
929
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
925
diff
changeset
|
580 void logCompassHeading(uint16_t heading); |
63c340abd70e
Add a line to the compass heading dive menu that shows the currently set heading to enable the
heinrichsweikamp
parents:
925
diff
changeset
|
581 void clearCompassHeading(void); |
774
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
771
diff
changeset
|
582 void setCompassHeading(uint16_t heading); |
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)
heinrichsweikamp
parents:
780
diff
changeset
|
583 |
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
780
diff
changeset
|
584 const SDecoinfo *getDecoInfo(void); |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
585 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
586 void disableTimer(void); |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
587 |
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
588 uint8_t drawingColor_from_ascentspeed(float speed); |
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
589 |
944 | 590 void convertStringOfDate_DDMMYY(char* pString, uint8_t strLen, uint8_t day, uint8_t month, uint8_t year); |
591 void getStringOfFormat_DDMMYY(char* pString, uint8_t strLen); | |
949 | 592 void convertUTCToLocal(uint8_t utcHours, uint8_t utcMinutes, uint8_t* pLocalHours, uint8_t* pLocalMinutes); |
944 | 593 |
945 | 594 uint8_t calculateSlowExit(uint16_t* pCountDownSec, float* pExitDepthMeter, uint8_t* pColor); |
944 | 595 |
38 | 596 #endif // DATA_CENTRAL_H |