Mercurial > public > ostc4
comparison Common/Inc/data_central.h @ 981:c6c781a2e85b default
Merge into default
| author | heinrichsweikamp |
|---|---|
| date | Tue, 11 Feb 2025 18:12:00 +0100 |
| parents | e9c37071933b |
| children | 8507a87f6401 |
comparison
equal
deleted
inserted
replaced
| 871:f7318457df4d | 981:c6c781a2e85b |
|---|---|
| 42 #define true 1 | 42 #define true 1 |
| 43 | 43 |
| 44 #define EXT_INTERFACE_SENSOR_CNT (8u) /* 1 MUX + 7 sensors may be connected to the external interface (1 MUX + 3 ADC + 4 UART) */ | 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 */ | 45 #define EXT_INTERFACE_MUX_OFFSET (3u) /* the sensor struct starts with 3 ADC sensors */ |
| 46 | 46 |
| 47 #define EXT_INTERFACE_BUZZER_ON_TIME_MS (2000u) /* max time the buzzer should be active without break */ | |
| 48 #define EXT_INTERFACE_BUZZER_STABLE_TIME_MS (500u) /* min time a state (ON / OFF) should be stable before it may be changed */ | |
| 49 | |
| 50 | |
| 47 /* Helper structs ------------------------------------------------------------*/ | 51 /* Helper structs ------------------------------------------------------------*/ |
| 48 | 52 |
| 49 //struct SGas | 53 //struct SGas |
| 50 //contains gasinfos of single gas for deco calculation | 54 //contains gasinfos of single gas for deco calculation |
| 51 typedef struct | 55 typedef struct |
| 162 { | 166 { |
| 163 SDevice device; | 167 SDevice device; |
| 164 SVpmRepetitiveData vpm; | 168 SVpmRepetitiveData vpm; |
| 165 } SDeviceState; | 169 } SDeviceState; |
| 166 */ | 170 */ |
| 171 | |
| 172 typedef struct | |
| 173 { | |
| 174 float fLat; | |
| 175 float fLon; | |
| 176 }SGnssCoord; | |
| 177 | |
| 178 | |
| 179 typedef struct | |
| 180 { | |
| 181 uint8_t year; | |
| 182 uint8_t month; | |
| 183 uint8_t day; | |
| 184 uint8_t hour; | |
| 185 uint8_t min; | |
| 186 uint8_t sec; | |
| 187 }SDateTime; | |
| 188 | |
| 189 typedef struct | |
| 190 { | |
| 191 SGnssCoord coord; | |
| 192 uint8_t alive; | |
| 193 uint8_t fixType; | |
| 194 uint8_t numSat; /* number of available satellites */ | |
| 195 uint8_t signalQual[4]; /* signal quality indicator for x sats */ | |
| 196 SDateTime DateTime; /* UTC time information */ | |
| 197 } SGnssInfo; | |
| 198 | |
| 199 typedef enum | |
| 200 { | |
| 201 SE_INIT = 0, | |
| 202 SE_REINIT, | |
| 203 SE_ACTIVE, | |
| 204 SE_END | |
| 205 } SSlowExitState; | |
| 206 | |
| 167 | 207 |
| 168 /* struct SLifeData | 208 /* struct SLifeData |
| 169 * contains data all actual data (pressure, stuturation, etc. as received from second ship | 209 * contains data all actual data (pressure, stuturation, etc. as received from second ship |
| 170 * and has actualGas to be send to Small CPU (second chip) | 210 * and has actualGas to be send to Small CPU (second chip) |
| 171 * contains data calculated from actual data after receiption from Small CPU | 211 * contains data calculated from actual data after receiption from Small CPU |
| 243 float sensorVoltage_mV[3]; | 283 float sensorVoltage_mV[3]; |
| 244 float HUD_battery_voltage_V; | 284 float HUD_battery_voltage_V; |
| 245 | 285 |
| 246 /* for PSCR Mode */ | 286 /* for PSCR Mode */ |
| 247 float ppo2Simulated_bar; | 287 float ppo2Simulated_bar; |
| 288 /* GNSS data */ | |
| 289 SGnssInfo gnssData; | |
| 290 | |
| 248 } SLifeData; | 291 } SLifeData; |
| 249 | 292 |
| 250 | 293 |
| 251 typedef struct | 294 typedef struct |
| 252 { | 295 { |
| 274 int8_t betterSetpoint; | 317 int8_t betterSetpoint; |
| 275 int8_t co2High; | 318 int8_t co2High; |
| 276 #ifdef ENABLE_BOTTLE_SENSOR | 319 #ifdef ENABLE_BOTTLE_SENSOR |
| 277 int8_t newPressure; | 320 int8_t newPressure; |
| 278 #endif | 321 #endif |
| 322 #ifdef HAVE_DEBUG_WARNINGS | |
| 323 int8_t debug; | |
| 324 #endif | |
| 279 } SWarnings; | 325 } SWarnings; |
| 280 | 326 |
| 281 | 327 |
| 282 typedef struct | 328 typedef struct |
| 283 { | 329 { |
| 291 int16_t info_manualGasSetHe; | 337 int16_t info_manualGasSetHe; |
| 292 int16_t info_manualGasSetO2; | 338 int16_t info_manualGasSetO2; |
| 293 int16_t bailout; | 339 int16_t bailout; |
| 294 int16_t info_bailoutHe; | 340 int16_t info_bailoutHe; |
| 295 int16_t info_bailoutO2; | 341 int16_t info_bailoutO2; |
| 296 } SEvents; | 342 int16_t compassHeadingUpdate; |
| 343 uint16_t info_compassHeadingUpdate; | |
| 344 int16_t gnssPositionUpdate; | |
| 345 SGnssCoord info_gnssPosition; | |
| 346 } SEvents; | |
| 297 | 347 |
| 298 | 348 |
| 299 | 349 |
| 300 //struct SDiveSettings | 350 //struct SDiveSettings |
| 301 //contains settings necessary for deco calculation | 351 //contains settings necessary for deco calculation |
| 322 /* VPM conservatism, do not change during dive!!! | 372 /* VPM conservatism, do not change during dive!!! |
| 323 * do not change in between dives otherwise repetitve dive is not possible | 373 * do not change in between dives otherwise repetitve dive is not possible |
| 324 */ | 374 */ |
| 325 uint8_t vpm_conservatism; | 375 uint8_t vpm_conservatism; |
| 326 | 376 |
| 377 /* VPM table mode, do not change during dive!!! | |
| 378 */ | |
| 379 uint8_t vpm_tableMode; | |
| 380 | |
| 327 /* B�hlmann GF | 381 /* B�hlmann GF |
| 328 * and a variable that is used by Buehlmann during the dive | 382 * and a variable that is used by Buehlmann during the dive |
| 329 * to remember the position of GF low during ascend | 383 * to remember the position of GF low during ascend |
| 330 */ | 384 */ |
| 331 uint8_t gf_high; | 385 uint8_t gf_high; |
| 349 float internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero; | 403 float internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero; |
| 350 uint16_t compassHeading; | 404 uint16_t compassHeading; |
| 351 | 405 |
| 352 uint8_t pscr_o2_drop; | 406 uint8_t pscr_o2_drop; |
| 353 uint8_t pscr_lung_ratio; | 407 uint8_t pscr_lung_ratio; |
| 408 | |
| 409 uint32_t activeAFViews; | |
| 354 } SDiveSettings; | 410 } SDiveSettings; |
| 355 | 411 |
| 356 enum CHARGE_STATUS{ | 412 enum CHARGE_STATUS{ |
| 357 CHARGER_off = 0, | 413 CHARGER_off = 0, |
| 358 CHARGER_running, | 414 CHARGER_running, |
| 399 | 455 |
| 400 uint8_t lastKnownBatteryPercentage; | 456 uint8_t lastKnownBatteryPercentage; |
| 401 | 457 |
| 402 timerState_e timerState; | 458 timerState_e timerState; |
| 403 int timerStartedS; | 459 int timerStartedS; |
| 460 | |
| 461 SScrubberData scrubberDataDive[2]; | |
| 404 } SDiveState; | 462 } SDiveState; |
| 405 | 463 |
| 406 | 464 |
| 407 typedef struct{ | 465 typedef struct{ |
| 408 uint8_t bit0:1; | 466 uint8_t bit0:1; |
| 444 SENSOR_OPTIC, | 502 SENSOR_OPTIC, |
| 445 SENSOR_ANALOG, | 503 SENSOR_ANALOG, |
| 446 SENSOR_DIGO2, | 504 SENSOR_DIGO2, |
| 447 SENSOR_DIGO2M, | 505 SENSOR_DIGO2M, |
| 448 SENSOR_SENTINEL, | 506 SENSOR_SENTINEL, |
| 507 SENSOR_SENTINELM, | |
| 449 SENSOR_TYPE_O2_END, | 508 SENSOR_TYPE_O2_END, |
| 450 SENSOR_CO2, | 509 SENSOR_CO2, |
| 451 SENSOR_CO2M, | 510 SENSOR_CO2M, |
| 511 SENSOR_GNSS, | |
| 512 SENSOR_GNSSM, | |
| 452 SENSOR_MUX, | 513 SENSOR_MUX, |
| 453 SENSOR_END | 514 SENSOR_END |
| 454 } externalInterfaceSensorType; | 515 } externalInterfaceSensorType; |
| 455 | 516 |
| 456 #define DVO2_FATAL_INTENSITY_LOW (0x00000001) | 517 #define DVO2_FATAL_INTENSITY_LOW (0x00000001) |
| 518 _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData); | 579 _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData); |
| 519 | 580 |
| 520 uint8_t isLoopMode(uint8_t Mode); | 581 uint8_t isLoopMode(uint8_t Mode); |
| 521 | 582 |
| 522 bool isCompassCalibrated(void); | 583 bool isCompassCalibrated(void); |
| 584 void logCompassHeading(uint16_t heading); | |
| 585 void clearCompassHeading(void); | |
| 523 void setCompassHeading(uint16_t heading); | 586 void setCompassHeading(uint16_t heading); |
| 524 | 587 |
| 525 const SDecoinfo *getDecoInfo(void); | 588 const SDecoinfo *getDecoInfo(void); |
| 526 | 589 |
| 527 void disableTimer(void); | 590 void disableTimer(void); |
| 591 | |
| 592 uint8_t drawingColor_from_ascentspeed(float speed); | |
| 593 | |
| 594 void convertStringOfDate_DDMMYY(char* pString, uint8_t strLen, uint8_t day, uint8_t month, uint8_t year); | |
| 595 void getStringOfFormat_DDMMYY(char* pString, uint8_t strLen); | |
| 596 void convertUTCToLocal(uint8_t utcHours, uint8_t utcMinutes, uint8_t* pLocalHours, uint8_t* pLocalMinutes); | |
| 597 | |
| 598 uint8_t calculateSlowExit(uint16_t* pCountDownSec, float* pExitDepthMeter, uint8_t* pColor); | |
| 599 | |
| 528 #endif // DATA_CENTRAL_H | 600 #endif // DATA_CENTRAL_H |
