From efc370f0e5e82d37252364aacd3dda59ba0c2ba8 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Thu, 31 Oct 2024 14:29:08 +0100 Subject: [PATCH] Improve Watchdog reset conditions --- v10/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v10/main.c b/v10/main.c index dd98650..e4ec589 100644 --- a/v10/main.c +++ b/v10/main.c @@ -642,9 +642,11 @@ int main(void) /* Feed the dog if sensor values are relevant */ int allow_wd_feed = 1; if ((solar_prod_value == 0) || (home_conso_value == 0)) { + /* The sensors cannot read as 0, this is an ADC initialisation error */ allow_wd_feed = 0; } - if ((water_centi_degrees < 0) || (water_centi_degrees > (ABSOLUTE_MAX_WATER_TEMP + 200))) { + if ((water_centi_degrees <= 0) || (water_centi_degrees > (ABSOLUTE_MAX_WATER_TEMP + 200))) { + /* This is certainly a thermocouple reading error : reset */ allow_wd_feed = 0; } /* Blocked in overvoltage mode */ @@ -653,7 +655,7 @@ int main(void) } /* Blocked in overtemperature mode */ if (mode == mode_overtemp) { - if ((mosfet_temp_shutdown == 0) && (internal_temp_error_shutdown >= 0)) { + if ((mosfet_temp_shutdown == 0) && (internal_temp_error_shutdown == 0)) { allow_wd_feed = 0; } } -- 2.43.0