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