Mercurial > public > ostc4
changeset 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 | 66c8a4ff9fc4 |
children | d7dec417afa4 |
files | Discovery/Src/check_warning.c |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/check_warning.c Wed Feb 24 21:03:22 2021 +0100 +++ b/Discovery/Src/check_warning.c Wed Feb 24 21:03:54 2021 +0100 @@ -38,10 +38,14 @@ #include "decom.h" #include "tCCR.h" + +#define DEBOUNCE_FALLBACK_TIME_MS (5000u) /* set warning after 5 seconds of pending error condition */ + /* Private variables with access ----------------------------------------------*/ static uint8_t betterGasId = 0; static uint8_t betterSetpointId = 0; static int8_t fallback = 0; +static uint16_t debounceFallbackTimeMS = 0; /* Private function prototypes -----------------------------------------------*/ static int8_t check_fallback(SDiveState * pDiveState); @@ -96,6 +100,7 @@ void clear_warning_fallback(void) { fallback = 0; + debounceFallbackTimeMS = 0; } @@ -429,5 +434,22 @@ return ret; } #endif + +uint8_t debounce_warning_fallback(uint16_t debounceStepms) +{ + uint8_t retVal = 0; + + debounceFallbackTimeMS += debounceStepms; + if(debounceFallbackTimeMS > DEBOUNCE_FALLBACK_TIME_MS) + { + debounceFallbackTimeMS = DEBOUNCE_FALLBACK_TIME_MS; + retVal = 1; + } + return retVal; +} +void reset_debounce_warning_fallback() +{ + debounceFallbackTimeMS = 0; +} /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/