From 84c8bd56621c1f321a6ec953e0f4614501768a9f Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Mon, 16 Sep 2024 20:01:08 +0200 Subject: [PATCH] Update overvolage mode update to prevent deadlock --- v10/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/v10/main.c b/v10/main.c index 421d2fe..72f2498 100644 --- a/v10/main.c +++ b/v10/main.c @@ -61,7 +61,7 @@ uint8_t forced_cmd_val = 0; int8_t internal_temp_error_shutdown = 0; /* Flag and error code */ uint8_t external_disable = 0; /* Flag only */ uint8_t mosfet_temp_shutdown = 0; /* Flag only */ -uint8_t overvoltage = 0; /* Flag and counter. Used to create a delay when overvoltage is detected, +volatile uint8_t overvoltage = 0; /* Flag and counter. Used to create a delay when overvoltage is detected, set to OVERVOLTAGE_PROTECTION_CYCLES and decreases to 0 */ /* Current running mode */ @@ -157,8 +157,10 @@ void overvoltage_protect(uint32_t gpio) overvoltage = OVERVOLTAGE_PROTECTION_CYCLES; gpio_set(fan_ctrl); /* Turn on FAN immediatly */ /* Change current working mode */ - old_mode = mode; - mode = mode_overvoltage; + if (mode != mode_overvoltage) { + old_mode = mode; + mode = mode_overvoltage; + } } -- 2.43.0