Mercurial > public > ostc4
annotate Common/Inc/data_central.h @ 937:d461d9e89e3c Evo_2_23
Compile switch for RTE sleep debug:
there was already a compiler switch for enabling debugging while RTE is in sleep but the switches were distributed across the code => to make selection easier they are now part of the configuration.h
author | Ideenmodellierer |
---|---|
date | Tue, 10 Dec 2024 20:59:37 +0100 |
parents | 5a9bc2e6112d |
children |
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; | |
172 uint8_t fixType; | |
173 uint8_t numSat; /* number of available satellites */ | |
174 uint8_t signalQual[4]; /* signal quality indicator for x sats */ | |
175 } SGnssInfo; | |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
176 |
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
177 |
38 | 178 /* struct SLifeData |
179 * contains data all actual data (pressure, stuturation, etc. as received from second ship | |
180 * and has actualGas to be send to Small CPU (second chip) | |
181 * contains data calculated from actual data after receiption from Small CPU | |
182 */ | |
183 typedef struct | |
184 { | |
185 /* from Small CPU */ | |
780 | 186 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
|
187 uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT]; |
4f19336a3f21
Dev Bugfix: Alignment problem in lifedata structure:
Ideenmodellierer
parents:
748
diff
changeset
|
188 |
38 | 189 int32_t dive_time_seconds; |
190 int32_t dive_time_seconds_without_surface_time; | |
191 uint32_t surface_time_seconds; | |
192 float pressure_ambient_bar; | |
193 float pressure_surface_bar; | |
194 float tissue_nitrogen_bar[16]; | |
195 float tissue_helium_bar[16]; | |
196 float cns; | |
197 float otu; | |
198 uint16_t desaturation_time_minutes; | |
199 uint16_t no_fly_time_minutes; | |
200 float temperature_celsius; | |
201 float compass_heading; | |
202 float compass_roll; | |
203 float compass_pitch; | |
204 int16_t compass_DX_f; | |
205 int16_t compass_DY_f; | |
206 int16_t compass_DZ_f; | |
207 uint16_t counterSecondsShallowDepth; | |
208 float ascent_rate_meter_per_min; | |
209 uint32_t timeBinaryFormat; | |
210 uint32_t dateBinaryFormat; | |
211 float battery_voltage; | |
212 float battery_charge; | |
213 uint16_t ambient_light_level; | |
214 SDataWireless wireless_data[4]; | |
215 uint8_t buttonPICdata[4]; | |
662 | 216 SCO2Sensor CO2_data; |
714
045ff7800501
Added customizable data area for specific sensor data:
Ideenmodellierer
parents:
672
diff
changeset
|
217 uint8_t extIf_sensor_Id; |
38 | 218 |
219 /* by create DiveSettings() and by setActualGas() | |
220 * is send to Small CPU2 for nitrogen calculation | |
221 * includes setpoint information | |
222 */ | |
223 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
|
224 |
38 | 225 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
|
226 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
|
227 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
|
228 bool setpointLowDelayed; |
38 | 229 |
230 /* calculated by DataEX_copy_to_LifeData() | |
231 bottle_bar array size is made like this to have multiples of 32bit | |
232 */ | |
233 float ppO2; | |
234 float depth_meter; | |
235 float max_depth_meter; | |
236 float average_depth_meter; | |
237 float apnea_total_max_depth_meter; | |
238 float apnea_last_max_depth_meter; | |
239 int32_t apnea_last_dive_time_seconds; | |
240 uint16_t bottle_bar[2 * NUM_GASES +1]; | |
241 uint16_t bottle_bar_age_MilliSeconds[2 * NUM_GASES + 1]; | |
242 uint16_t apnea_total_counter; | |
243 | |
244 /* control of DataEX_copy_to_LifeData() | |
245 */ | |
246 uint8_t boolResetAverageDepth; | |
247 uint8_t bool_temp1; | |
248 uint8_t bool_temp2; | |
249 | |
250 /* from local sensor or direct HUD communication */ | |
251 //pp O2 Sensor | |
252 float ppO2Sensor_bar[3]; | |
253 float sensorVoltage_mV[3]; | |
254 float HUD_battery_voltage_V; | |
662 | 255 |
256 /* for PSCR Mode */ | |
257 float ppo2Simulated_bar; | |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
258 /* GNSS data */ |
931 | 259 SGnssInfo gnssData; |
899
2225c467f1e9
Added data path and visualization for position data:
Ideenmodellierer
parents:
868
diff
changeset
|
260 |
38 | 261 } SLifeData; |
262 | |
263 | |
264 typedef struct | |
265 { | |
266 uint16_t tissue_nitrogen_desaturation_time_minutes[16]; | |
267 uint16_t tissue_helium_desaturation_time_minutes[16]; | |
268 } SLifeData2; | |
269 | |
270 | |
271 typedef struct | |
272 { | |
273 //warnings | |
274 int8_t decoMissed; | |
275 int8_t aGf; | |
276 int8_t ascentRateHigh; | |
277 int8_t ppO2Low; | |
278 int8_t ppO2High; | |
279 int8_t cnsHigh; | |
280 int8_t slowWarning; | |
281 int8_t lowBattery; | |
282 int8_t numWarnings; | |
283 int8_t sensorLinkLost; | |
284 int8_t sensorOutOfBounds[3]; | |
285 int8_t betterGas; | |
286 int8_t fallback; | |
287 int8_t betterSetpoint; | |
752
4f19336a3f21
Dev Bugfix: Alignment problem in lifedata structure:
Ideenmodellierer
parents:
748
diff
changeset
|
288 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
|
289 #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
|
290 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
|
291 #endif |
857 | 292 #ifdef HAVE_DEBUG_WARNINGS |
293 int8_t debug; | |
294 #endif | |
38 | 295 } SWarnings; |
296 | |
297 | |
298 typedef struct | |
299 { | |
300 //Events logbook only | |
301 int16_t manualMarker; | |
302 int16_t gasChange; | |
303 int16_t info_GasChange; | |
304 int16_t setpointChange; | |
305 int16_t info_SetpointChange; | |
281 | 306 int16_t manualGasSet; |
307 int16_t info_manualGasSetHe; | |
308 int16_t info_manualGasSetO2; | |
38 | 309 int16_t bailout; |
310 int16_t info_bailoutHe; | |
311 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
|
312 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
|
313 uint16_t info_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
|
314 } SEvents; |
38 | 315 |
316 | |
317 | |
318 //struct SDiveSettings | |
319 //contains settings necessary for deco calculation | |
320 typedef struct | |
321 { | |
322 float last_stop_depth_bar; | |
323 float input_next_stop_increment_depth_bar; | |
324 float input_second_to_last_stop_depth_bar; | |
325 float ascentRate_meterperminute; | |
326 uint8_t diveMode; /* OC, CC, .. */ | |
327 uint8_t CCR_Mode; | |
328 uint8_t future_TTS_minutes; | |
329 | |
330 /* If beginning of dive is CCR than ccrOption is set true | |
331 * true allows returning from bailout (OC) back to CCR | |
332 * true activates CC gas and setpoint pages in dive menu | |
333 */ | |
334 uint8_t ccrOption; | |
335 uint8_t fallbackOption; | |
336 uint8_t ppo2sensors_deactivated; | |
337 | |
338 split2x4_Type deco_type; /* GF or VPM for standard and alternative seperate */ | |
339 | |
340 /* VPM conservatism, do not change during dive!!! | |
341 * do not change in between dives otherwise repetitve dive is not possible | |
342 */ | |
343 uint8_t vpm_conservatism; | |
344 | |
902 | 345 /* VPM table mode, do not change during dive!!! |
346 */ | |
347 uint8_t vpm_tableMode; | |
348 | |
38 | 349 /* B�hlmann GF |
350 * and a variable that is used by Buehlmann during the dive | |
351 * to remember the position of GF low during ascend | |
352 */ | |
353 uint8_t gf_high; | |
354 uint8_t gf_low; | |
355 | |
356 /* copy of the Settings GasList and SetpintList | |
357 * that can be modified during the dive | |
358 * especially gases can be actived and deactivated | |
359 * gas[0] and setpoint[0] are the special ones configurable during the dive | |
360 */ | |
361 SGasLine gas[1 + (2*NUM_GASES)]; | |
362 SSetpointLine setpoint[1 + NUM_GASES]; | |
363 | |
364 /* List of GasChanges in the actual order | |
365 * this is necessary for VPM and Buehlmann and will be created on start of each calculation | |
366 */ | |
367 SGas decogaslist[BUEHLMANN_STRUCT_MAX_GASES]; // unused filled with 0xFF | |
368 | |
369 /* | |
370 */ | |
371 float internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero; | |
372 uint16_t compassHeading; | |
662 | 373 |
374 uint8_t pscr_o2_drop; | |
375 uint8_t pscr_lung_ratio; | |
834
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
805
diff
changeset
|
376 |
2a8af51ab04d
Added event based display changes for big font view:
Ideenmodellierer
parents:
805
diff
changeset
|
377 uint32_t activeAFViews; |
38 | 378 } SDiveSettings; |
379 | |
380 enum CHARGE_STATUS{ | |
381 CHARGER_off = 0, | |
382 CHARGER_running, | |
383 CHARGER_complete, | |
384 CHARGER_lostConnection | |
385 }; | |
386 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
387 typedef enum { |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
388 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
|
389 TIMER_STATE_PRESTART, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
390 TIMER_STATE_RUNNING, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
391 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
|
392 TIMER_STATE_FINISHED, |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
393 } timerState_e; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
394 |
38 | 395 typedef struct |
396 { | |
397 SDiveSettings diveSettings; | |
398 SLifeData lifeData; | |
399 SVpm vpm; | |
400 SEvents events; | |
401 SWarnings warnings; | |
402 SDecoinfo decolistVPM; | |
403 SDecoinfo decolistFutureVPM; | |
404 SDecoinfo decolistBuehlmann; // | |
405 SDecoinfo decolistFutureBuehlmann; | |
406 uint8_t mode; /* hw for sleep, surface, dive, .. */ | |
407 uint8_t chargeStatus; | |
408 uint8_t data_old__lost_connection_to_slave; | |
409 | |
410 uint32_t pressure_uTick_new; | |
411 uint32_t compass_uTick_new; | |
412 | |
413 uint32_t pressure_uTick_old; | |
414 uint32_t compass_uTick_old; | |
415 | |
416 uint32_t pressure_uTick_local_new; | |
417 uint32_t compass_uTick_local_new; | |
418 | |
419 uint8_t cnsHigh_at_the_end_of_dive; | |
420 uint8_t decoMissed_at_the_end_of_dive; | |
421 | |
422 uint8_t sensorErrorsRTE; | |
423 | |
424 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
|
425 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
426 timerState_e timerState; |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
427 int timerStartedS; |
925 | 428 |
429 SScrubberData scrubberDataDive[2]; | |
38 | 430 } SDiveState; |
431 | |
432 | |
433 typedef struct{ | |
434 uint8_t bit0:1; | |
435 uint8_t bit1:1; | |
436 uint8_t bit2:1; | |
437 uint8_t bit3:1; | |
438 uint8_t bit4:1; | |
439 uint8_t bit5:1; | |
440 uint8_t bit6:1; | |
441 uint8_t bit7:1; | |
442 } ubit8_t; | |
443 | |
444 typedef union{ | |
445 ubit8_t ub; | |
446 uint8_t uw; | |
447 } bit8_Type; | |
448 | |
449 extern SDiveState stateSim; | |
450 extern SDiveState stateDeco; | |
451 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
|
452 extern const SDiveState *stateUsed; |
1303747b5ba2
cleanup: also write gas and setpoint changes in simulator mode
Jan Mulder <jlmulder@xs4all.nl>
parents:
270
diff
changeset
|
453 extern SDiveState *stateUsedWrite; |
38 | 454 |
455 enum DECO_LOCK{ | |
456 DECO_CALC_running, | |
457 DECO_CALC_ready, | |
458 DECO_CALC_FINSHED_Buehlmann, | |
459 DECO_CALC_FINSHED_vpm, | |
460 DECO_CALC_FINSHED_FutureBuehlmann, | |
461 DECO_CALC_FINSHED_Futurevpm, | |
462 DECO_CALC_init_as_is_start_of_dive, | |
463 DECO_CALC_undefined | |
464 }; | |
465 | |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
466 typedef enum |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
467 { |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
468 SENSOR_NONE, |
745 | 469 SENSOR_SEARCH, |
733 | 470 SENSOR_OPTIC, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
471 SENSOR_ANALOG, |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
472 SENSOR_DIGO2, |
796 | 473 SENSOR_DIGO2M, |
745 | 474 SENSOR_SENTINEL, |
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
834
diff
changeset
|
475 SENSOR_SENTINELM, |
745 | 476 SENSOR_TYPE_O2_END, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
477 SENSOR_CO2, |
799 | 478 SENSOR_CO2M, |
920 | 479 SENSOR_GNSS, |
480 SENSOR_GNSSM, | |
780 | 481 SENSOR_MUX, |
728
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
482 SENSOR_END |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
483 } externalInterfaceSensorType; |
5143e927219f
Added sensor map to Firmware <=> RTE inferface:
Ideenmodellierer
parents:
714
diff
changeset
|
484 |
745 | 485 #define DVO2_FATAL_INTENSITY_LOW (0x00000001) |
486 #define DVO2_FATAL_AMBIENT_HIGH (0x00000002) | |
487 #define DVO2_FATAL_REFINT_LOW (0x00000004) | |
488 #define DVO2_FATAL_REFAMB_HIGH (0x00000008) | |
489 #define DVO2_FATAL_TEMPERATURE (0x00000010) | |
490 | |
491 #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
|
492 |
38 | 493 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow); |
494 | |
495 void set_stateUsedToSim(void); | |
496 void set_stateUsedToReal(void); | |
497 | |
498 _Bool is_stateUsedSetToSim(void); | |
499 | |
500 const SDiveState * stateRealGetPointer(void); | |
501 const SDiveState * stateSimGetPointer(void); | |
502 SDiveState * stateRealGetPointerWrite(void); | |
503 SDiveState * stateSimGetPointerWrite(void); | |
504 const SDevice * stateDeviceGetPointer(void); | |
505 SDevice * stateDeviceGetPointerWrite(void); | |
506 const SVpmRepetitiveData * stateVpmRepetitiveDataGetPointer(void); | |
507 SVpmRepetitiveData * stateVpmRepetitiveDataGetPointerWrite(void); | |
508 | |
509 void UpdateLifeDataTest(SDiveState * diveState); | |
510 | |
511 void setSimulationValues(int _ascent_rate_meter_per_min, int _descent_rate_meter_per_min, int _max_depth, int _bottom_time ); | |
512 | |
513 void createDiveSettings(void); | |
514 void copyDiveSettingsToSim(void); | |
515 void copyVpmRepetetiveDataToSim(void); | |
516 //void fallbackToFixedSetpoints(SLifeData *lifeData); | |
517 void setActualGasFirst(SLifeData *lifeData); | |
518 void setActualGasAir(SLifeData *lifeData); | |
519 void setActualGas(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar); | |
520 void setActualGas_ExtraGas(SLifeData *lifeData, uint8_t oxygen, uint8_t helium, uint8_t setpoint_cbar); | |
521 void setActualGas_DM(SLifeData *lifeData, uint8_t gasId, uint8_t setpoint_cbar); | |
522 void setWeekday(RTC_DateTypeDef *sDate); | |
523 void setDate(RTC_DateTypeDef Sdate); | |
524 void setTime(RTC_TimeTypeDef Stime); | |
525 void setBatteryPercentage(uint8_t newChargePercentage); | |
526 void setButtonResponsiveness(uint8_t *ButtonSensitivyList); | |
527 void calibrateCompass(void); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
478
diff
changeset
|
528 void compass_Inertia(float newHeading); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
478
diff
changeset
|
529 float compass_getCompensated(); |
38 | 530 void clearDeco(void); |
531 void translateDate(uint32_t datetmpreg, RTC_DateTypeDef *sDate); | |
532 void translateTime(uint32_t tmpreg, RTC_TimeTypeDef *sTime); | |
533 void updateSetpointStateUsed(void); | |
534 | |
535 uint8_t calc_MOD(uint8_t gasId); | |
536 uint8_t calc_MinOD(uint8_t gasId); | |
537 //float calc_ppO2(float input_ambient_pressure_bar, SGas* pGas); | |
538 int current_second(void); | |
539 _Bool vpm_crush(SDiveState* pDiveState); | |
540 _Bool deco_zone_reached(void); | |
270
2e58a4094770
feature, debug: make simulator write a logbook entry
Jan Mulder <jlmulder@xs4all.nl>
parents:
247
diff
changeset
|
541 void resetEvents(const SDiveState *pStateUsed); |
38 | 542 |
543 uint32_t crc32c_checksum(uint8_t* message, uint16_t length, uint8_t* message2, uint16_t length2); | |
544 uint32_t CRC_CalcBlockCRC(uint32_t *buffer, uint32_t words); | |
545 uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words); | |
546 | |
547 _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData); | |
548 | |
662 | 549 uint8_t isLoopMode(uint8_t Mode); |
550 | |
776
45b8f3c2acce
Add support for a configurable compass declination in a range of -99 to 99 degrees.
heinrichsweikamp
parents:
774
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 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
|
555 |
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
|
556 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
|
557 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
799
diff
changeset
|
558 void disableTimer(void); |
868
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
559 |
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
560 uint8_t drawingColor_from_ascentspeed(float speed); |
db92692c014f
Introduce speed dependend coloring of depth:
Ideenmodellierer
parents:
857
diff
changeset
|
561 |
38 | 562 #endif // DATA_CENTRAL_H |