From: Nathael Pajani Date: Mon, 16 Sep 2024 18:01:08 +0000 (+0200) Subject: Update overvolage mode update to prevent deadlock X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=84c8bd56621c1f321a6ec953e0f4614501768a9f;p=soft%2Flpc122x%2Fscialys Update overvolage mode update to prevent deadlock --- 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; + } }