# HG changeset patch # User Ideenmodellierer # Date 1614197034 -3600 # Node ID c47766ec3f9639d44981670a5a1f928902af6e7c # Parent 66c8a4ff9fc4de53ac8488eaaf02a368e48c4ec1 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 diff -r 66c8a4ff9fc4 -r c47766ec3f96 Discovery/Src/check_warning.c --- 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****/