From d9d0185e39b74056f923eb3934db8fc5526a8d7e Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Wed, 9 Apr 2025 23:52:05 +0200 Subject: [PATCH 01/15] ArduinoJson@7.4.0 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 58d0f843..e86b780f 100755 --- a/platformio.ini +++ b/platformio.ini @@ -25,7 +25,7 @@ extra_scripts = post:platformio_version_increment/version_increment_post.py lib_deps = makuna/NeoPixelBus@2.8.3 - bblanchon/ArduinoJson@7.3.1 + bblanchon/ArduinoJson@7.4.0 knolleary/PubSubClient@2.8.0 ;https://github.com/Makuna/NeoPixelBus.git#master lib_extra_dirs = arduino_bootstrapper From 0748a4df15b9718da85e03f2e2b8172f9ff3cf55 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Thu, 10 Apr 2025 10:14:44 +0200 Subject: [PATCH 02/15] ArduinoJson@7.4.0 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index e86b780f..94765d7b 100755 --- a/platformio.ini +++ b/platformio.ini @@ -25,7 +25,7 @@ extra_scripts = post:platformio_version_increment/version_increment_post.py lib_deps = makuna/NeoPixelBus@2.8.3 - bblanchon/ArduinoJson@7.4.0 + bblanchon/ArduinoJson@7.3.1 knolleary/PubSubClient@2.8.0 ;https://github.com/Makuna/NeoPixelBus.git#master lib_extra_dirs = arduino_bootstrapper From de63942ed57f9ebe46e12e336e7ea872d8c3efb3 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Fri, 11 Apr 2025 16:02:10 +0200 Subject: [PATCH 03/15] ArduinoJson@7.4.1 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 94765d7b..a48c4865 100755 --- a/platformio.ini +++ b/platformio.ini @@ -25,7 +25,7 @@ extra_scripts = post:platformio_version_increment/version_increment_post.py lib_deps = makuna/NeoPixelBus@2.8.3 - bblanchon/ArduinoJson@7.3.1 + bblanchon/ArduinoJson@7.4.1 knolleary/PubSubClient@2.8.0 ;https://github.com/Makuna/NeoPixelBus.git#master lib_extra_dirs = arduino_bootstrapper From f9c277af71631a79a9c116d494cd9e112997f015 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Sat, 10 May 2025 18:08:55 +0200 Subject: [PATCH 04/15] invert relay option for Gledopto devices --- include/Globals.h | 1 + include/LedManager.h | 3 ++- include/Version.h | 4 ++-- include/WebSettings.h | 2 +- src/Globals.cpp | 5 +++-- src/GlowWormLuciferin.cpp | 6 +++++- src/LedManager.cpp | 4 +++- src/NetManager.cpp | 12 ++++++++---- version | 2 +- 9 files changed, 26 insertions(+), 13 deletions(-) diff --git a/include/Globals.h b/include/Globals.h index 8e5c1615..6ebedccc 100644 --- a/include/Globals.h +++ b/include/Globals.h @@ -96,6 +96,7 @@ const String BAUDRATE_FILENAME = "baudrate.json"; extern bool ldrReading; extern int ldrValue; extern bool ldrEnabled; +extern bool relInv; extern uint8_t ldrInterval; extern bool ldrTurnOff; extern uint8_t ldrMin; diff --git a/include/LedManager.h b/include/LedManager.h index aa086601..71d4f0dc 100644 --- a/include/LedManager.h +++ b/include/LedManager.h @@ -61,6 +61,7 @@ class LedManager { const String MIN_LDR_PARAM = "minLdr"; const String MAX_LDR_PARAM = "maxLdr"; const String RELAY_PIN_PARAM = "relayPin"; + const String RELAY_INV = "relayInv"; const String SB_PIN_PARAM = "sbPin"; const String LDR_PIN_PARAM = "ldrPin"; const String EFFECT_FILENAME = "effect.json"; @@ -130,7 +131,7 @@ class LedManager { void setLdr(int maxLdr); - void setPins(uint8_t relayPinParam, uint8_t sbPinParam, uint8_t ldrPinParam); + void setPins(uint8_t relayPinParam, uint8_t sbPinParam, uint8_t ldrPinParam, bool relInv); void flushSerial(); diff --git a/include/Version.h b/include/Version.h index a4d1f5d0..b4845670 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.3" + #define VERSION "5.21.15" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-04-06 09:15:45.340060" + #define BUILD_TIMESTAMP "2025-05-10 18:08:32.266289" #endif \ No newline at end of file diff --git a/include/WebSettings.h b/include/WebSettings.h index 90d90704..3158a44a 100644 --- a/include/WebSettings.h +++ b/include/WebSettings.h @@ -27,6 +27,6 @@ const char setSettingsPage[] PROGMEM = R"=====(LUCIFERIN Web Interface

LUCIFERIN

Bias Lighting and Ambient Light firmware designed for Firefly Luciferin



















)====="; -const char setLdrPage[] PROGMEM = R"=====(LUCIFERIN Web Interface

LUCIFERIN











_
)====="; +const char setLdrPage[] PROGMEM = R"=====(LUCIFERIN Web Interface

LUCIFERIN



Invert relay








_
)====="; #endif //GLOW_WORM_LUCIFERIN_WEBSETTINGS_H diff --git a/src/Globals.cpp b/src/Globals.cpp index aa3d8924..9431fba2 100755 --- a/src/Globals.cpp +++ b/src/Globals.cpp @@ -62,6 +62,7 @@ bool breakLoop = false; bool ldrReading = false; int ldrValue; bool ldrEnabled = false; +bool relInv = false; uint8_t ldrInterval = 30; bool ldrTurnOff = false; uint8_t ldrMin = 20; @@ -238,7 +239,7 @@ void Globals::setBaudRate(int bdRate) { void Globals::turnOnRelay() { if (!relayState) { relayState = true; - digitalWrite(relayPin, HIGH); + digitalWrite(relayPin, relInv ? LOW : HIGH); delay(10); } } @@ -250,7 +251,7 @@ void Globals::turnOffRelay() { if (relayState) { relayState = false; delay(10); - digitalWrite(relayPin, LOW); + digitalWrite(relayPin, relInv ? HIGH : LOW); } } diff --git a/src/GlowWormLuciferin.cpp b/src/GlowWormLuciferin.cpp index f7b6d85f..af76f1da 100755 --- a/src/GlowWormLuciferin.cpp +++ b/src/GlowWormLuciferin.cpp @@ -124,6 +124,7 @@ void setup() { String ldrMinFromStorage = bootstrapManager.readValueFromFile(ledManager.LDR_FILENAME, ledManager.MIN_LDR_PARAM); String ldrMaxFromStorage = bootstrapManager.readValueFromFile(ledManager.LDR_CAL_FILENAME, ledManager.MAX_LDR_PARAM); String relayPinFromStorage = bootstrapManager.readValueFromFile(ledManager.PIN_FILENAME, ledManager.RELAY_PIN_PARAM); + String relayInvStorage = bootstrapManager.readValueFromFile(ledManager.PIN_FILENAME, ledManager.RELAY_INV); String sbPinFromStorage = bootstrapManager.readValueFromFile(ledManager.PIN_FILENAME, ledManager.SB_PIN_PARAM); String ldrPinFromStorage = bootstrapManager.readValueFromFile(ledManager.PIN_FILENAME, ledManager.LDR_PIN_PARAM); if (!ldrFromStorage.isEmpty() && ldrFromStorage != ERROR) { @@ -141,6 +142,9 @@ void setup() { if (!relayPinFromStorage.isEmpty() && relayPinFromStorage != ERROR) { relayPin = relayPinFromStorage.toInt(); } + if (!relayInvStorage.isEmpty() && relayInvStorage != ERROR) { + relInv = relayInvStorage.toInt(); + } if (!sbPinFromStorage.isEmpty() && sbPinFromStorage != ERROR) { sbPin = sbPinFromStorage.toInt(); } @@ -363,7 +367,7 @@ void mainLoop() { relayPin = relaySerialPin; sbPin = sbSerialPin; ldrPin = ldrSerialPin; - ledManager.setPins(relayPin, sbPin, ldrPin); + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); } } uint16_t numLedFromLuciferin = lo + (loSecondPart * SERIAL_CHUNK_SIZE) + 1; diff --git a/src/LedManager.cpp b/src/LedManager.cpp index 0a2a56ed..8bf611b6 100644 --- a/src/LedManager.cpp +++ b/src/LedManager.cpp @@ -788,13 +788,15 @@ void LedManager::setLdr(int maxLdr) { * @param ldrTurnOffToSet Turn off LEDs before LDR readings * @param ldrIntervalToSet Interval between readings * @param minLdr min brightness when using LDR + * @param relInv relay iverted */ -void LedManager::setPins(uint8_t relayPinParam, uint8_t sbPinParam, uint8_t ldrPinParam) { +void LedManager::setPins(uint8_t relayPinParam, uint8_t sbPinParam, uint8_t ldrPinParam, bool relInv) { Serial.println(F("CHANGING PINs")); JsonDocument ldrDoc; ldrDoc[RELAY_PIN_PARAM] = relayPinParam; ldrDoc[SB_PIN_PARAM] = sbPinParam; ldrDoc[LDR_PIN_PARAM] = ldrPinParam; + ldrDoc[RELAY_INV] = relInv; BootstrapManager::writeToLittleFS(ldrDoc, PIN_FILENAME); delay(200); #if defined(ARDUINO_ARCH_ESP32) diff --git a/src/NetManager.cpp b/src/NetManager.cpp index bfdb0599..b094d58a 100644 --- a/src/NetManager.cpp +++ b/src/NetManager.cpp @@ -312,6 +312,8 @@ void NetManager::listenOnHttpGet() { prefsData += ldrMin; prefsData += F("\",\"relayPin\":\""); prefsData += relayPin; + prefsData += F("\",\"relInv\":\""); + prefsData += relInv; prefsData += F("\",\"sbPin\":\""); prefsData += sbPin; prefsData += F("\",\"ldrPin\":\""); @@ -776,7 +778,7 @@ bool NetManager::processFirmwareConfig() { int ldrPinParam = (int) bootstrapManager.jsonDoc[ledManager.LDR_PIN_PARAM]; if (ldrPin != ldrPinParam) { ldrPin = ldrPinParam; - ledManager.setPins(relayPin, sbPin, ldrPin); + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); ledManager.reinitLEDTriggered = true; } } @@ -785,7 +787,7 @@ bool NetManager::processFirmwareConfig() { int relayPinParam = (int) bootstrapManager.jsonDoc[ledManager.RELAY_PIN_PARAM]; if (relayPin != relayPinParam) { relayPin = relayPinParam; - ledManager.setPins(relayPin, sbPin, ldrPin); + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); ledManager.reinitLEDTriggered = true; } } @@ -794,7 +796,7 @@ bool NetManager::processFirmwareConfig() { int sbrPinParam = (int) bootstrapManager.jsonDoc[ledManager.SB_PIN_PARAM]; if (sbPin != sbrPinParam) { sbPin = sbrPinParam; - ledManager.setPins(relayPin, sbPin, ldrPin); + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); ledManager.reinitLEDTriggered = true; } } @@ -1127,8 +1129,10 @@ bool NetManager::processLDR() { String ldrMinMqtt = bootstrapManager.jsonDoc[F("ldrMin")]; String ldrActionMqtt = bootstrapManager.jsonDoc[F("ldrAction")]; String rPin = bootstrapManager.jsonDoc[F("relayPin")]; + String rInvStr = bootstrapManager.jsonDoc[F("relInv")]; String sPin = bootstrapManager.jsonDoc[F("sbPin")]; String lPin = bootstrapManager.jsonDoc[F("ldrPin")]; + relInv = rInvStr == "true"; ldrEnabled = ldrEnabledMqtt == "true"; ldrTurnOff = ldrTurnOffMqtt == "true"; ldrInterval = ldrIntervalMqtt.toInt(); @@ -1154,7 +1158,7 @@ bool NetManager::processLDR() { relayPin = rPin.toInt(); sbPin = sPin.toInt(); ldrPin = lPin.toInt(); - ledManager.setPins(relayPin, sbPin, ldrPin); + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); } delay(DELAY_500); startUDP(); diff --git a/version b/version index 0864b48b..0e2314da 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.3 \ No newline at end of file +5.21.15 \ No newline at end of file From 3467a466c2c8dffc2ea2cb7a5cfc7e752b04ff0e Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Thu, 15 May 2025 13:52:26 +0200 Subject: [PATCH 05/15] makuna/NeoPixelBus@2.8.4 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index a48c4865..8a27bad7 100755 --- a/platformio.ini +++ b/platformio.ini @@ -24,7 +24,7 @@ extra_scripts = pre:platformio_version_increment/version_increment_pre.py post:platformio_version_increment/version_increment_post.py lib_deps = - makuna/NeoPixelBus@2.8.3 + makuna/NeoPixelBus@2.8.4 bblanchon/ArduinoJson@7.4.1 knolleary/PubSubClient@2.8.0 ;https://github.com/Makuna/NeoPixelBus.git#master From 94df6111f715dd3bdf680a621f64532fa964d4f4 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Wed, 28 May 2025 15:15:23 +0200 Subject: [PATCH 06/15] espressif32@6.11.0 --- include/Version.h | 4 ++-- platformio.ini | 2 +- version | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Version.h b/include/Version.h index b4845670..a2191ef5 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.15" + #define VERSION "5.21.18" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-05-10 18:08:32.266289" + #define BUILD_TIMESTAMP "2025-05-28 15:12:50.164996" #endif \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 8a27bad7..d92c65db 100755 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ platform_esp8266 = espressif8266@4.2.1 f_cpu_esp8266 = 160000000L monitor_filters_esp8266 = esp8266_exception_decoder -platform_esp32 = espressif32@6.10.0 +platform_esp32 = espressif32@6.11.0 monitor_filters_esp32 = esp32_exception_decoder framework = arduino diff --git a/version b/version index 0e2314da..5e888397 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.15 \ No newline at end of file +5.21.18 \ No newline at end of file From b50dc360dfaecb444077dd2ce6a7338d301e780d Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Mon, 23 Jun 2025 10:41:20 +0200 Subject: [PATCH 07/15] bblanchon/ArduinoJson@7.4.2 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index d92c65db..b26e471d 100755 --- a/platformio.ini +++ b/platformio.ini @@ -25,7 +25,7 @@ extra_scripts = post:platformio_version_increment/version_increment_post.py lib_deps = makuna/NeoPixelBus@2.8.4 - bblanchon/ArduinoJson@7.4.1 + bblanchon/ArduinoJson@7.4.2 knolleary/PubSubClient@2.8.0 ;https://github.com/Makuna/NeoPixelBus.git#master lib_extra_dirs = arduino_bootstrapper From 0f45d3acdd1849b151cf1c803be64d572d9d5cd9 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Mon, 21 Jul 2025 15:02:45 +0200 Subject: [PATCH 08/15] inverted relay --- src/Globals.cpp | 2 +- src/GlowWormLuciferin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Globals.cpp b/src/Globals.cpp index 9431fba2..19828f94 100755 --- a/src/Globals.cpp +++ b/src/Globals.cpp @@ -62,7 +62,7 @@ bool breakLoop = false; bool ldrReading = false; int ldrValue; bool ldrEnabled = false; -bool relInv = false; +bool relInv = true; // TODO change to false uint8_t ldrInterval = 30; bool ldrTurnOff = false; uint8_t ldrMin = 20; diff --git a/src/GlowWormLuciferin.cpp b/src/GlowWormLuciferin.cpp index af76f1da..1a6ff26f 100755 --- a/src/GlowWormLuciferin.cpp +++ b/src/GlowWormLuciferin.cpp @@ -143,7 +143,7 @@ void setup() { relayPin = relayPinFromStorage.toInt(); } if (!relayInvStorage.isEmpty() && relayInvStorage != ERROR) { - relInv = relayInvStorage.toInt(); + relInv = true; // TODO change to relayInvStorage.toInt() } if (!sbPinFromStorage.isEmpty() && sbPinFromStorage != ERROR) { sbPin = sbPinFromStorage.toInt(); From c8e6b28296ed958bcfbeddb428201c8a278f2d14 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Sat, 26 Jul 2025 16:28:34 +0200 Subject: [PATCH 09/15] HA warnings fix --- src/NetManager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NetManager.cpp b/src/NetManager.cpp index b094d58a..c92dd4e9 100644 --- a/src/NetManager.cpp +++ b/src/NetManager.cpp @@ -918,7 +918,8 @@ void NetManager::sendStatus() { if (effect == Effect::GlowWorm || effect == Effect::GlowWormWifi) { fpsData = F("{\"deviceName\":\""); fpsData += deviceName; - fpsData += F("\",\"state\":\""); + fpsData += "\",\"color\": { \"r\": 255, \"g\": 190, \"b\": 140 }"; // Default for bias light + fpsData += F(",\"state\":\""); fpsData += (ledManager.stateOn) ? ON_CMD : OFF_CMD; fpsData += F("\",\"brightness\":"); fpsData += brightness; @@ -953,8 +954,8 @@ void NetManager::sendStatus() { } else { bootstrapManager.jsonDoc.clear(); JsonObject root = bootstrapManager.jsonDoc.to(); - JsonObject color = root["color"].to(); root[F("state")] = (ledManager.stateOn) ? ON_CMD : OFF_CMD; + JsonObject color = root["color"].to(); color[F("r")] = ledManager.red; color[F("g")] = ledManager.green; color[F("b")] = ledManager.blue; From 7a754dcad4eb849bec13099f26a5ae8b146df7bf Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Sat, 26 Jul 2025 16:35:36 +0200 Subject: [PATCH 10/15] HA warnings fix --- include/Version.h | 4 ++-- version | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Version.h b/include/Version.h index a2191ef5..1dd07835 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.18" + #define VERSION "5.21.32" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-05-28 15:12:50.164996" + #define BUILD_TIMESTAMP "2025-07-26 16:27:38.556813" #endif \ No newline at end of file diff --git a/version b/version index 5e888397..6581ceda 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.18 \ No newline at end of file +5.21.32 \ No newline at end of file From 08ef9afd1be8005c373386127e2eb880912b8024 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Mon, 28 Jul 2025 23:35:14 +0200 Subject: [PATCH 11/15] PlatformIO Version Increment (v0.1.9) --- platformio_version_increment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio_version_increment b/platformio_version_increment index 781207e2..e436ee27 160000 --- a/platformio_version_increment +++ b/platformio_version_increment @@ -1 +1 @@ -Subproject commit 781207e2d24c4cfcc274a4f5aa8529741e129697 +Subproject commit e436ee2719945796e292ed5861a71a97ea4b645a From 1bfbd3d9068ebbd949bdce9109c8d3e130f33bdf Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Tue, 29 Jul 2025 12:45:57 +0200 Subject: [PATCH 12/15] invert relay option --- include/Globals.h | 4 ++-- include/LedManager.h | 1 + include/Version.h | 4 ++-- src/Globals.cpp | 3 ++- src/GlowWormLuciferin.cpp | 8 +++++--- src/NetManager.cpp | 10 ++++++++++ version | 2 +- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/Globals.h b/include/Globals.h index 6ebedccc..bd2470db 100644 --- a/include/Globals.h +++ b/include/Globals.h @@ -33,7 +33,7 @@ #define LDR_DIVIDER 4096 #endif #define SERIAL_SIZE_RX 2048 -#define CONFIG_NUM_PARAMS 20 +#define CONFIG_NUM_PARAMS 21 #define CONFIG_PREFIX_LENGTH 6 // This value must meet the one in Firefly Luciferin // We are transferring byte via Serial, the maximum decimal number that can be represented with 1 byte is 255. @@ -56,7 +56,7 @@ extern class Globals globals; extern byte config[CONFIG_NUM_PARAMS]; extern byte pre[CONFIG_PREFIX_LENGTH]; extern uint8_t prefix[], hi, lo, chk, loSecondPart, usbBrightness, gpio, baudRate, whiteTemp, fireflyEffect, - fireflyColorMode, fireflyColorOrder, ldrEn, ldrTo, ldrInt, ldrMn, ldrAction, relaySerialPin, sbSerialPin, ldrSerialPin, gpioClock; + fireflyColorMode, fireflyColorOrder, ldrEn, ldrTo, ldrInt, ldrMn, ldrAction, relaySerialPin, relayInvPin, sbSerialPin, ldrSerialPin, gpioClock; enum class Effect { GlowWormWifi, GlowWorm, solid, fire, twinkle, bpm, rainbow, chase_rainbow, solid_rainbow, slowRainbow, randomColors, diff --git a/include/LedManager.h b/include/LedManager.h index 71d4f0dc..89ffa93e 100644 --- a/include/LedManager.h +++ b/include/LedManager.h @@ -61,6 +61,7 @@ class LedManager { const String MIN_LDR_PARAM = "minLdr"; const String MAX_LDR_PARAM = "maxLdr"; const String RELAY_PIN_PARAM = "relayPin"; + const String RELAY_INV_PARAM = "relayInv"; const String RELAY_INV = "relayInv"; const String SB_PIN_PARAM = "sbPin"; const String LDR_PIN_PARAM = "ldrPin"; diff --git a/include/Version.h b/include/Version.h index 1dd07835..48e86fd9 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.32" + #define VERSION "5.21.46" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-07-26 16:27:38.556813" + #define BUILD_TIMESTAMP "2025-07-29 12:40:21.271978" #endif \ No newline at end of file diff --git a/src/Globals.cpp b/src/Globals.cpp index 19828f94..feeb852d 100755 --- a/src/Globals.cpp +++ b/src/Globals.cpp @@ -33,7 +33,7 @@ Globals globals; byte config[CONFIG_NUM_PARAMS]; byte pre[CONFIG_PREFIX_LENGTH]; uint8_t prefix[] = {'D', 'P', 's', 'o', 'f', 't'}, hi, lo, chk, loSecondPart, usbBrightness, gpio, baudRate, whiteTemp, - fireflyEffect, fireflyColorMode, fireflyColorOrder, ldrEn, ldrTo, ldrInt, ldrMn, ldrAction, relaySerialPin, sbSerialPin, ldrSerialPin, gpioClock; + fireflyEffect, fireflyColorMode, fireflyColorOrder, ldrEn, ldrTo, ldrInt, ldrMn, ldrAction, relaySerialPin, relayInvPin, sbSerialPin, ldrSerialPin, gpioClock; uint8_t whiteTempInUse = WHITE_TEMP_CORRECTION_DISABLE; uint8_t colorMode = 1; uint8_t colorOrder = 1; @@ -302,6 +302,7 @@ void Globals::sendSerialInfo() { Serial.printf("ldr:%d\n", ((ldrValue * 100) / ldrDivider)); } Serial.printf("relayPin:%d\n", relayPin); + Serial.printf("relInv:%d\n", relInv); Serial.printf("sbPin:%d\n", sbPin); Serial.printf("ldrPin:%d\n", ldrPin); Serial.flush(); diff --git a/src/GlowWormLuciferin.cpp b/src/GlowWormLuciferin.cpp index 1a6ff26f..1813ecc4 100755 --- a/src/GlowWormLuciferin.cpp +++ b/src/GlowWormLuciferin.cpp @@ -143,7 +143,7 @@ void setup() { relayPin = relayPinFromStorage.toInt(); } if (!relayInvStorage.isEmpty() && relayInvStorage != ERROR) { - relInv = true; // TODO change to relayInvStorage.toInt() + relInv = relayInvStorage.toInt(); } if (!sbPinFromStorage.isEmpty() && sbPinFromStorage != ERROR) { sbPin = sbPinFromStorage.toInt(); @@ -318,6 +318,7 @@ void mainLoop() { fireflyColorMode = config[i++]; fireflyColorOrder = config[i++]; relaySerialPin = config[i++]; + relayInvPin = config[i++]; sbSerialPin = config[i++]; ldrSerialPin = config[i++]; gpioClock = config[i++]; @@ -325,7 +326,7 @@ void mainLoop() { if (!(!breakLoop && (chk != (hi ^ lo ^ loSecondPart ^ usbBrightness ^ gpio ^ baudRate ^ whiteTemp ^ fireflyEffect ^ ldrEn ^ ldrTo ^ ldrInt ^ ldrMn ^ ldrAction ^ fireflyColorMode ^ fireflyColorOrder - ^ relaySerialPin ^ sbSerialPin ^ ldrSerialPin ^ gpioClock ^ 0x55)))) { + ^ relaySerialPin ^ relayInvPin ^ sbSerialPin ^ ldrSerialPin ^ gpioClock ^ 0x55)))) { if (!breakLoop) { #ifdef TARGET_GLOWWORMLUCIFERINLIGHT if (!relayState) { @@ -363,10 +364,11 @@ void mainLoop() { relaySerialPin = relaySerialPin - 10; sbSerialPin = sbSerialPin - 10; ldrSerialPin = ldrSerialPin - 10; - if ((relayPin != relaySerialPin) || (sbPin != sbSerialPin) || (ldrPin != ldrSerialPin)) { + if ((relayPin != relaySerialPin) || (sbPin != sbSerialPin) || (ldrPin != ldrSerialPin) || (relayInvPin == 10 && relInv) || (relayInvPin == 11 && !relInv)) { relayPin = relaySerialPin; sbPin = sbSerialPin; ldrPin = ldrSerialPin; + relInv = relayInvPin == 11; ledManager.setPins(relayPin, sbPin, ldrPin, relInv); } } diff --git a/src/NetManager.cpp b/src/NetManager.cpp index c92dd4e9..ae28a790 100644 --- a/src/NetManager.cpp +++ b/src/NetManager.cpp @@ -791,6 +791,15 @@ bool NetManager::processFirmwareConfig() { ledManager.reinitLEDTriggered = true; } } + // INVERTED RELAY + if (bootstrapManager.jsonDoc[ledManager.RELAY_INV_PARAM].is()) { + bool relayInvParam = bootstrapManager.jsonDoc[ledManager.RELAY_INV_PARAM]; + if (relInv != relayInvParam) { + relInv = relayInvParam; + ledManager.setPins(relayPin, sbPin, ldrPin, relInv); + ledManager.reinitLEDTriggered = true; + } + } // SB_PIN_PARAM if (bootstrapManager.jsonDoc[ledManager.SB_PIN_PARAM].is()) { int sbrPinParam = (int) bootstrapManager.jsonDoc[ledManager.SB_PIN_PARAM]; @@ -975,6 +984,7 @@ void NetManager::sendStatus() { root[F("ldr")] = ((ldrValue * 100) / ldrDivider); } root[F("relayPin")] = relayPin; + root[F("relayInv")] = relInv; root[F("sbPin")] = sbPin; root[F("ldrPin")] = ldrPin; root[BAUDRATE_PARAM] = baudRateInUse; diff --git a/version b/version index 6581ceda..7f541a54 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.32 \ No newline at end of file +5.21.46 \ No newline at end of file From 3e8f41e24b01788e247729322b841a4b47834983 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Tue, 29 Jul 2025 17:20:18 +0200 Subject: [PATCH 13/15] invert relay option --- include/Version.h | 4 ++-- version | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Version.h b/include/Version.h index 48e86fd9..7b75b87f 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.46" + #define VERSION "5.21.49" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-07-29 12:40:21.271978" + #define BUILD_TIMESTAMP "2025-07-29 14:56:27.699113" #endif \ No newline at end of file diff --git a/version b/version index 7f541a54..ae2b82fa 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.46 \ No newline at end of file +5.21.49 \ No newline at end of file From 60cd577ce8e0d2b4b70b8c14d5ca2103f31dbd1f Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Sat, 9 Aug 2025 14:32:10 +0200 Subject: [PATCH 14/15] invert relay option --- include/Version.h | 4 ++-- src/Globals.cpp | 2 +- version | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Version.h b/include/Version.h index 7b75b87f..bdd4b234 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,9 +1,9 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.49" + #define VERSION "5.21.51" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2025-07-29 14:56:27.699113" + #define BUILD_TIMESTAMP "2025-08-09 14:31:39.066602" #endif \ No newline at end of file diff --git a/src/Globals.cpp b/src/Globals.cpp index feeb852d..c8f7735d 100755 --- a/src/Globals.cpp +++ b/src/Globals.cpp @@ -62,7 +62,7 @@ bool breakLoop = false; bool ldrReading = false; int ldrValue; bool ldrEnabled = false; -bool relInv = true; // TODO change to false +bool relInv = false; uint8_t ldrInterval = 30; bool ldrTurnOff = false; uint8_t ldrMin = 20; diff --git a/version b/version index ae2b82fa..13522bf6 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.49 \ No newline at end of file +5.21.51 \ No newline at end of file From d01327dffc7796d676d8c9e33a09541b096534d9 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Thu, 14 Aug 2025 12:56:33 +0200 Subject: [PATCH 15/15] invert relay option --- include/Version.h | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Version.h b/include/Version.h index bdd4b234..54e77b65 100644 --- a/include/Version.h +++ b/include/Version.h @@ -1,7 +1,7 @@ // AUTO GENERATED FILE, DO NOT EDIT #ifndef VERSION - #define VERSION "5.21.51" + #define VERSION "5.21.3" #endif #ifndef BUILD_TIMESTAMP #define BUILD_TIMESTAMP "2025-08-09 14:31:39.066602" diff --git a/version b/version index 13522bf6..0864b48b 100644 --- a/version +++ b/version @@ -1 +1 @@ -5.21.51 \ No newline at end of file +5.21.3 \ No newline at end of file