From 61c7af5eb54c9e0a287c7b9aa573bb82632fd8d1 Mon Sep 17 00:00:00 2001 From: DeltaLima Date: Thu, 5 Dec 2024 05:07:06 +0100 Subject: [PATCH] firmware - fix bug when saving system settings resetting LED and FAN PWM --- Arduino/CanGrow/CanGrow_WebFunctions.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Arduino/CanGrow/CanGrow_WebFunctions.h b/Arduino/CanGrow/CanGrow_WebFunctions.h index 704797a..302a3f7 100644 --- a/Arduino/CanGrow/CanGrow_WebFunctions.h +++ b/Arduino/CanGrow/CanGrow_WebFunctions.h @@ -852,6 +852,9 @@ void POSTgrowSettings() { void POSTsystemSettings() { + + unsigned short UseLEDrelais_old = UseLEDrelais; + unsigned short UseFANrelais_old = UseFANrelais; NtpOffset = webserver.arg("NtpOffset").toInt(); MoistureSensor_Type = webserver.arg("MoistureSensor_Type").toInt(); SoilmoistureLow = webserver.arg("SoilmoistureLow").toInt(); @@ -909,14 +912,14 @@ void POSTsystemSettings() { // when user uses an relais for LED control, we force here PinLEDPWM to 255 // to ensure nothing bad happens and its turned on - if(UseLEDrelais == false) { + if( (UseLEDrelais == false) && (UseLEDrelais != UseLEDrelais_old) ) { PinLEDPWM = 255; EEPROM.put(213, PinLEDPWM); EEPROM.commit(); Serial.println("UseLEDrelais is 0, forcing PinLEDPWM to max to prevent relais damage and ensure its turned on"); } - if(UseFANrelais == false) { + if( (UseFANrelais == false) && (UseFANrelais != UseFANrelais_old) ) { PinFANPWM = 255; EEPROM.put(215, PinFANPWM); EEPROM.commit();