Mercurial > public > ostc4
comparison Discovery/Src/check_warning.c @ 636:c47766ec3f96
Debounce fallback warning:
In previous versions the fallback option (automatical setting of a fixed setpoint) was only done for communication timeout scenario in combination with a HUD. It is now also applied in case all sensors are rated as out of bounds. The signaling of the fallback warning (including optional automatic setpoint change) is now done taking a 5 seconds debounds time into account.
In case a fallback warning is active, then the only way to reset it is by selecting a new setpoint or by changing the sensor configuration (no change compared to previous implementation
author | Ideenmodellierer |
---|---|
date | Wed, 24 Feb 2021 21:03:54 +0100 |
parents | 7c73f066cd16 |
children | 1b995079c045 |
comparison
equal
deleted
inserted
replaced
635:66c8a4ff9fc4 | 636:c47766ec3f96 |
---|---|
36 #include "check_warning.h" | 36 #include "check_warning.h" |
37 #include "settings.h" | 37 #include "settings.h" |
38 #include "decom.h" | 38 #include "decom.h" |
39 #include "tCCR.h" | 39 #include "tCCR.h" |
40 | 40 |
41 | |
42 #define DEBOUNCE_FALLBACK_TIME_MS (5000u) /* set warning after 5 seconds of pending error condition */ | |
43 | |
41 /* Private variables with access ----------------------------------------------*/ | 44 /* Private variables with access ----------------------------------------------*/ |
42 static uint8_t betterGasId = 0; | 45 static uint8_t betterGasId = 0; |
43 static uint8_t betterSetpointId = 0; | 46 static uint8_t betterSetpointId = 0; |
44 static int8_t fallback = 0; | 47 static int8_t fallback = 0; |
48 static uint16_t debounceFallbackTimeMS = 0; | |
45 | 49 |
46 /* Private function prototypes -----------------------------------------------*/ | 50 /* Private function prototypes -----------------------------------------------*/ |
47 static int8_t check_fallback(SDiveState * pDiveState); | 51 static int8_t check_fallback(SDiveState * pDiveState); |
48 static int8_t check_ppO2(SDiveState * pDiveState); | 52 static int8_t check_ppO2(SDiveState * pDiveState); |
49 static int8_t check_O2_sensors(SDiveState * pDiveState); | 53 static int8_t check_O2_sensors(SDiveState * pDiveState); |
94 | 98 |
95 | 99 |
96 void clear_warning_fallback(void) | 100 void clear_warning_fallback(void) |
97 { | 101 { |
98 fallback = 0; | 102 fallback = 0; |
103 debounceFallbackTimeMS = 0; | |
99 } | 104 } |
100 | 105 |
101 | 106 |
102 uint8_t actualBetterGasId(void) | 107 uint8_t actualBetterGasId(void) |
103 { | 108 { |
427 pDiveState->warnings.newPressure = 0; | 432 pDiveState->warnings.newPressure = 0; |
428 } | 433 } |
429 return ret; | 434 return ret; |
430 } | 435 } |
431 #endif | 436 #endif |
437 | |
438 uint8_t debounce_warning_fallback(uint16_t debounceStepms) | |
439 { | |
440 uint8_t retVal = 0; | |
441 | |
442 debounceFallbackTimeMS += debounceStepms; | |
443 if(debounceFallbackTimeMS > DEBOUNCE_FALLBACK_TIME_MS) | |
444 { | |
445 debounceFallbackTimeMS = DEBOUNCE_FALLBACK_TIME_MS; | |
446 retVal = 1; | |
447 } | |
448 return retVal; | |
449 } | |
450 void reset_debounce_warning_fallback() | |
451 { | |
452 debounceFallbackTimeMS = 0; | |
453 } | |
432 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ | 454 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |
433 | 455 |