From f8eb607d7fc638120df39518d67144fbb52138cf Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Mon, 23 Feb 2026 16:27:11 +0100 Subject: [PATCH 1/9] Add compile-time WiFi hard-off mode --- wled00/my_config_sample.h | 1 + wled00/wled.cpp | 16 ++++++++++++++++ wled00/wled.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/wled00/my_config_sample.h b/wled00/my_config_sample.h index 000793deb6..16f0abeb76 100644 --- a/wled00/my_config_sample.h +++ b/wled00/my_config_sample.h @@ -22,5 +22,6 @@ #define CLIENT_PASS "Your_Password" */ +//#define WLED_FORCE_WIFI_OFF // Hard disable WiFi radio (WIFI_OFF): no STA and no AP. //#define MAX_LEDS 1500 // Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. //#define MDNS_NAME "wled" // mDNS hostname, ie: *.local diff --git a/wled00/wled.cpp b/wled00/wled.cpp index d67f784078..3fbf98d925 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -511,8 +511,13 @@ void WLED::setup() WiFi.persistent(false); // on ES8266 using NVM for wifi config has no benefit of faster connection #endif WiFi.onEvent(WiFiEvent); +#ifdef WLED_FORCE_WIFI_OFF + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: forcing WiFi OFF.")); + WiFi.mode(WIFI_OFF); +#else WiFi.mode(WIFI_STA); // enable scanning findWiFi(true); // start scanning for available WiFi-s +#endif // all GPIOs are allocated at this point serialCanRX = !PinManager::isPinAllocated(hardwareRX); // Serial RX pin (GPIO 3 on ESP32 and ESP8266) @@ -633,6 +638,10 @@ void WLED::beginStrip() void WLED::initAP(bool resetAP) { +#ifdef WLED_FORCE_WIFI_OFF + return; +#endif + if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP) return; @@ -673,6 +682,13 @@ void WLED::initAP(bool resetAP) void WLED::initConnection() { DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000); +#ifdef WLED_FORCE_WIFI_OFF + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. Skipping WiFi/AP init.")); + WiFi.disconnect(true); + WiFi.mode(WIFI_OFF); + return; +#endif + #ifdef WLED_ENABLE_WEBSOCKETS ws.onEvent(wsEvent); #endif diff --git a/wled00/wled.h b/wled00/wled.h index 21b340d94c..cfa686eaa1 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -21,6 +21,8 @@ // You are required to disable over-the-air updates: //#define WLED_DISABLE_OTA // saves 14kb +// hard-disable WiFi radio entirely (WIFI_OFF). AP/STA will not start. +//#define WLED_FORCE_WIFI_OFF #ifdef WLED_ENABLE_AOTA #if defined(WLED_DISABLE_OTA) #warning WLED_DISABLE_OTA was defined but it will be ignored due to WLED_ENABLE_AOTA. From e3af1adfd3ec271dab4dda39a508d4ff881c2e73 Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:04:12 +0100 Subject: [PATCH 2/9] Fix position of WLED_FORE_OFF switch. --- wled00/wled.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wled00/wled.h b/wled00/wled.h index cfa686eaa1..88c401a6e6 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -21,8 +21,6 @@ // You are required to disable over-the-air updates: //#define WLED_DISABLE_OTA // saves 14kb -// hard-disable WiFi radio entirely (WIFI_OFF). AP/STA will not start. -//#define WLED_FORCE_WIFI_OFF #ifdef WLED_ENABLE_AOTA #if defined(WLED_DISABLE_OTA) #warning WLED_DISABLE_OTA was defined but it will be ignored due to WLED_ENABLE_AOTA. @@ -31,6 +29,7 @@ #endif // You can choose some of these features to disable: +//#define WLED_FORCE_WIFI_OFF // saves 5kb, hard-disable WiFi radio entirely (WIFI_OFF). AP/STA will not start. //#define WLED_DISABLE_ALEXA // saves 11kb //#define WLED_DISABLE_HUESYNC // saves 4kb //#define WLED_DISABLE_INFRARED // saves 12kb, there is no pin left for this on ESP8266-01 From f2e7d797b655250dc04bdad305af3af8e413371a Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:01:03 +0100 Subject: [PATCH 3/9] WIFI_OFF: set last ReconnectAttempt in initConnection. --- wled00/wled.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 3fbf98d925..72f029ccb2 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -684,6 +684,7 @@ void WLED::initConnection() DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000); #ifdef WLED_FORCE_WIFI_OFF DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. Skipping WiFi/AP init.")); + lastReconnectAttempt = millis(); WiFi.disconnect(true); WiFi.mode(WIFI_OFF); return; From 8913e53ac90309b4396564503bc3d61cc93f4d66 Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Tue, 24 Feb 2026 21:06:37 +0100 Subject: [PATCH 4/9] Support AP-recovery mode for FORCE_WIFI_OFF. --- wled00/my_config_sample.h | 2 +- wled00/wled.cpp | 16 ++++++++-------- wled00/wled.h | 14 +++++++++++++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/wled00/my_config_sample.h b/wled00/my_config_sample.h index 16f0abeb76..6dc2f3f044 100644 --- a/wled00/my_config_sample.h +++ b/wled00/my_config_sample.h @@ -22,6 +22,6 @@ #define CLIENT_PASS "Your_Password" */ -//#define WLED_FORCE_WIFI_OFF // Hard disable WiFi radio (WIFI_OFF): no STA and no AP. +//#define WLED_FORCE_WIFI_OFF // Disable regular WiFi (STA/AP fallback). Requires a configured momentary button 0 for emergency AP long-press recovery. //#define MAX_LEDS 1500 // Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. //#define MDNS_NAME "wled" // mDNS hostname, ie: *.local diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 72f029ccb2..4933246fba 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -512,7 +512,8 @@ void WLED::setup() #endif WiFi.onEvent(WiFiEvent); #ifdef WLED_FORCE_WIFI_OFF - DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: forcing WiFi OFF.")); + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: disabling regular WiFi startup (AP button emergency remains available).")); + apBehavior = AP_BEHAVIOR_BUTTON_ONLY; WiFi.mode(WIFI_OFF); #else WiFi.mode(WIFI_STA); // enable scanning @@ -638,10 +639,6 @@ void WLED::beginStrip() void WLED::initAP(bool resetAP) { -#ifdef WLED_FORCE_WIFI_OFF - return; -#endif - if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP) return; @@ -683,10 +680,13 @@ void WLED::initConnection() { DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000); #ifdef WLED_FORCE_WIFI_OFF - DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. Skipping WiFi/AP init.")); + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. WiFi stays OFF unless AP emergency mode is opened by button.")); + apBehavior = AP_BEHAVIOR_BUTTON_ONLY; lastReconnectAttempt = millis(); - WiFi.disconnect(true); - WiFi.mode(WIFI_OFF); + if (!apActive) { + WiFi.disconnect(true); + WiFi.mode(WIFI_OFF); + } return; #endif diff --git a/wled00/wled.h b/wled00/wled.h index 88c401a6e6..207848d267 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -29,7 +29,7 @@ #endif // You can choose some of these features to disable: -//#define WLED_FORCE_WIFI_OFF // saves 5kb, hard-disable WiFi radio entirely (WIFI_OFF). AP/STA will not start. +//#define WLED_FORCE_WIFI_OFF // disable regular WiFi (STA/AP fallback). Requires a configured momentary button 0 for emergency AP long-press recovery. //#define WLED_DISABLE_ALEXA // saves 11kb //#define WLED_DISABLE_HUESYNC // saves 4kb //#define WLED_DISABLE_INFRARED // saves 12kb, there is no pin left for this on ESP8266-01 @@ -292,6 +292,18 @@ WLED_GLOBAL char otaPass[33] _INIT(DEFAULT_OTA_PASS); #ifndef BTNTYPE #define BTNTYPE BTN_TYPE_PUSH #endif + +#ifdef WLED_FORCE_WIFI_OFF + #ifndef WLED_USE_ETHERNET + #error "WLED_FORCE_WIFI_OFF requires WLED_USE_ETHERNET." + #endif + #if (BTNPIN < 0) + #warning "WLED_FORCE_WIFI_OFF: BTNPIN is disabled. Emergency AP long-press on button 0 will not be available unless configured in cfg.json." + #endif + #if !((BTNTYPE == BTN_TYPE_PUSH) || (BTNTYPE == BTN_TYPE_PUSH_ACT_HIGH) || (BTNTYPE == BTN_TYPE_TOUCH)) + #warning "WLED_FORCE_WIFI_OFF: BTNTYPE is not momentary by default. Emergency AP long-press on button 0 requires a momentary button type." + #endif +#endif #ifndef RLYPIN WLED_GLOBAL int8_t rlyPin _INIT(-1); #else From 1ad958ffe981469c2fdf99b5bffdd8e98b11e63f Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Tue, 24 Feb 2026 22:09:14 +0100 Subject: [PATCH 5/9] Harden WLED_FORCE_WIFI_OFF feature --- wled00/network.cpp | 4 ++++ wled00/wled.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wled00/network.cpp b/wled00/network.cpp index 105fdf6b27..db654f5b9c 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -385,10 +385,12 @@ void WiFiEvent(WiFiEvent_t event) case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: if (wasConnected && interfacesInited) { DEBUG_PRINTF_P(PSTR("WiFi-E: Disconnected! @ %lus\n"), millis()/1000); +#ifndef WLED_FORCE_WIFI_OFF if (interfacesInited && multiWiFi.size() > 1 && WiFi.scanComplete() >= 0) { findWiFi(true); // reinit WiFi scan forceReconnect = true; } +#endif interfacesInited = false; } break; @@ -427,7 +429,9 @@ void WiFiEvent(WiFiEvent_t event) // may be necessary to reconnect the WiFi when // ethernet disconnects, as a way to provide // alternative access to the device. +#ifndef WLED_FORCE_WIFI_OFF if (interfacesInited && WiFi.scanComplete() >= 0) findWiFi(true); // reinit WiFi scan +#endif forceReconnect = true; break; #endif diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 4933246fba..ee448236e0 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -884,7 +884,11 @@ void WLED::handleConnection() // ignore connection handling if WiFi is configured and scan still running // or within first 2s if WiFi is not configured or AP is always active - if ((wifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0) || (now < 2000 && (!wifiConfigured || apBehavior == AP_BEHAVIOR_ALWAYS))) + bool wifiScanRunning = false; +#ifndef WLED_FORCE_WIFI_OFF + wifiScanRunning = (wifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0); +#endif + if (wifiScanRunning || (now < 2000 && (!wifiConfigured || apBehavior == AP_BEHAVIOR_ALWAYS))) return; if (lastReconnectAttempt == 0 || forceReconnect) { From 700849b89ae7d2eb6480658df6e965cdc733feff Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Tue, 24 Feb 2026 22:50:40 +0100 Subject: [PATCH 6/9] Fix corner-cases that activate WIFI anyway. --- wled00/wled.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index ee448236e0..05eab066b5 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -893,7 +893,9 @@ void WLED::handleConnection() if (lastReconnectAttempt == 0 || forceReconnect) { DEBUG_PRINTF_P(PSTR("Initial connect or forced reconnect (@ %lus).\n"), nowS); +#ifndef WLED_FORCE_WIFI_OFF selectedWiFi = findWiFi(); // find strongest WiFi +#endif initConnection(); interfacesInited = false; forceReconnect = false; @@ -926,12 +928,16 @@ void WLED::handleConnection() if (interfacesInited) { if (scanDone && multiWiFi.size() > 1) { DEBUG_PRINTLN(F("WiFi scan initiated on disconnect.")); +#ifndef WLED_FORCE_WIFI_OFF findWiFi(true); // reinit scan +#endif scanDone = false; return; // try to connect in next iteration } DEBUG_PRINTLN(F("Disconnected!")); +#ifndef WLED_FORCE_WIFI_OFF selectedWiFi = findWiFi(); +#endif initConnection(); interfacesInited = false; scanDone = true; From 4382e41ee00bcadcff723f2eb2515c1243cceaed Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Wed, 25 Feb 2026 07:34:12 +0100 Subject: [PATCH 7/9] Log correctly in WLED_FORCE_WIFI_OFF mode. --- wled00/wled.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 05eab066b5..31dbd06621 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -927,8 +927,10 @@ void WLED::handleConnection() if (!Network.isConnected()) { if (interfacesInited) { if (scanDone && multiWiFi.size() > 1) { +#ifdef WLED_FORCE_WIFI_OFF + DEBUG_PRINTLN(F("WiFi scan suppressed (WLED_FORCE_WIFI_OFF).")); +#else DEBUG_PRINTLN(F("WiFi scan initiated on disconnect.")); -#ifndef WLED_FORCE_WIFI_OFF findWiFi(true); // reinit scan #endif scanDone = false; From d14643bae8d8e257631695145f0de857602245bb Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:11:06 +0100 Subject: [PATCH 8/9] Refactor WLED_FORCE_WIFI_OFF implementation. --- wled00/network.cpp | 27 ++++++++++---- wled00/wled.cpp | 91 +++++++++++++++++++++++++++++----------------- 2 files changed, 78 insertions(+), 40 deletions(-) diff --git a/wled00/network.cpp b/wled00/network.cpp index db654f5b9c..073635758f 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -2,6 +2,24 @@ #include "fcn_declare.h" #include "wled_ethernet.h" +namespace { + +bool restartWiFiScanIfEnabled(bool requireMultiWiFi) +{ +#ifdef WLED_FORCE_WIFI_OFF + (void)requireMultiWiFi; + return false; +#else + if (!interfacesInited) return false; + if (requireMultiWiFi && multiWiFi.size() <= 1) return false; + if (WiFi.scanComplete() < 0) return false; + findWiFi(true); // reinit WiFi scan + return true; +#endif +} + +} // namespace + #if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET) // The following six pins are neither configurable nor @@ -385,12 +403,9 @@ void WiFiEvent(WiFiEvent_t event) case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: if (wasConnected && interfacesInited) { DEBUG_PRINTF_P(PSTR("WiFi-E: Disconnected! @ %lus\n"), millis()/1000); -#ifndef WLED_FORCE_WIFI_OFF - if (interfacesInited && multiWiFi.size() > 1 && WiFi.scanComplete() >= 0) { - findWiFi(true); // reinit WiFi scan + if (restartWiFiScanIfEnabled(true)) { forceReconnect = true; } -#endif interfacesInited = false; } break; @@ -429,9 +444,7 @@ void WiFiEvent(WiFiEvent_t event) // may be necessary to reconnect the WiFi when // ethernet disconnects, as a way to provide // alternative access to the device. -#ifndef WLED_FORCE_WIFI_OFF - if (interfacesInited && WiFi.scanComplete() >= 0) findWiFi(true); // reinit WiFi scan -#endif + restartWiFiScanIfEnabled(false); forceReconnect = true; break; #endif diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 31dbd06621..48bdbc8117 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -14,6 +14,58 @@ extern "C" void usePWMFixedNMI(); +namespace { + +bool regularWiFiEnabled() +{ +#ifdef WLED_FORCE_WIFI_OFF + return false; +#else + return true; +#endif +} + +void initRegularWiFiStartup() +{ + if (!regularWiFiEnabled()) { + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: disabling regular WiFi startup (AP button emergency remains available).")); + apBehavior = AP_BEHAVIOR_BUTTON_ONLY; + WiFi.mode(WIFI_OFF); + return; + } + + WiFi.mode(WIFI_STA); // enable scanning + findWiFi(true); // start scanning for available WiFi-s +} + +bool handleForceWiFiOffConnection() +{ + if (regularWiFiEnabled()) return false; + + DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. WiFi stays OFF unless AP emergency mode is opened by button.")); + apBehavior = AP_BEHAVIOR_BUTTON_ONLY; + lastReconnectAttempt = millis(); + if (!apActive) { + WiFi.disconnect(true); + WiFi.mode(WIFI_OFF); + } + return true; +} + +bool wifiScanRunning(bool wifiConfigured) +{ + if (!regularWiFiEnabled()) return false; + return wifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0; +} + +int findWiFiIfEnabled(bool doScan = false) +{ + if (!regularWiFiEnabled()) return selectedWiFi; + return findWiFi(doScan); +} + +} // namespace + /* * Main WLED class implementation. Mostly initialization and connection logic */ @@ -511,14 +563,7 @@ void WLED::setup() WiFi.persistent(false); // on ES8266 using NVM for wifi config has no benefit of faster connection #endif WiFi.onEvent(WiFiEvent); -#ifdef WLED_FORCE_WIFI_OFF - DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF: disabling regular WiFi startup (AP button emergency remains available).")); - apBehavior = AP_BEHAVIOR_BUTTON_ONLY; - WiFi.mode(WIFI_OFF); -#else - WiFi.mode(WIFI_STA); // enable scanning - findWiFi(true); // start scanning for available WiFi-s -#endif + initRegularWiFiStartup(); // all GPIOs are allocated at this point serialCanRX = !PinManager::isPinAllocated(hardwareRX); // Serial RX pin (GPIO 3 on ESP32 and ESP8266) @@ -679,16 +724,7 @@ void WLED::initAP(bool resetAP) void WLED::initConnection() { DEBUG_PRINTF_P(PSTR("initConnection() called @ %lus.\n"), millis()/1000); -#ifdef WLED_FORCE_WIFI_OFF - DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. WiFi stays OFF unless AP emergency mode is opened by button.")); - apBehavior = AP_BEHAVIOR_BUTTON_ONLY; - lastReconnectAttempt = millis(); - if (!apActive) { - WiFi.disconnect(true); - WiFi.mode(WIFI_OFF); - } - return; -#endif + if (handleForceWiFiOffConnection()) return; #ifdef WLED_ENABLE_WEBSOCKETS ws.onEvent(wsEvent); @@ -884,18 +920,13 @@ void WLED::handleConnection() // ignore connection handling if WiFi is configured and scan still running // or within first 2s if WiFi is not configured or AP is always active - bool wifiScanRunning = false; -#ifndef WLED_FORCE_WIFI_OFF - wifiScanRunning = (wifiConfigured && multiWiFi.size() > 1 && WiFi.scanComplete() < 0); -#endif + const bool wifiScanRunning = ::wifiScanRunning(wifiConfigured); if (wifiScanRunning || (now < 2000 && (!wifiConfigured || apBehavior == AP_BEHAVIOR_ALWAYS))) return; if (lastReconnectAttempt == 0 || forceReconnect) { DEBUG_PRINTF_P(PSTR("Initial connect or forced reconnect (@ %lus).\n"), nowS); -#ifndef WLED_FORCE_WIFI_OFF - selectedWiFi = findWiFi(); // find strongest WiFi -#endif + selectedWiFi = findWiFiIfEnabled(); // find strongest WiFi initConnection(); interfacesInited = false; forceReconnect = false; @@ -927,19 +958,13 @@ void WLED::handleConnection() if (!Network.isConnected()) { if (interfacesInited) { if (scanDone && multiWiFi.size() > 1) { -#ifdef WLED_FORCE_WIFI_OFF - DEBUG_PRINTLN(F("WiFi scan suppressed (WLED_FORCE_WIFI_OFF).")); -#else DEBUG_PRINTLN(F("WiFi scan initiated on disconnect.")); - findWiFi(true); // reinit scan -#endif + findWiFiIfEnabled(true); // reinit scan scanDone = false; return; // try to connect in next iteration } DEBUG_PRINTLN(F("Disconnected!")); -#ifndef WLED_FORCE_WIFI_OFF - selectedWiFi = findWiFi(); -#endif + selectedWiFi = findWiFiIfEnabled(); initConnection(); interfacesInited = false; scanDone = true; From ef88e49db126c936b1edea0f6fa624580bd17e8a Mon Sep 17 00:00:00 2001 From: Stargazer2026 <258677952+Stargazer2026@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:02:22 +0100 Subject: [PATCH 9/9] Restart WIFI scan on failed scan. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- wled00/network.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/network.cpp b/wled00/network.cpp index 073635758f..4a4f469a39 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -12,7 +12,8 @@ bool restartWiFiScanIfEnabled(bool requireMultiWiFi) #else if (!interfacesInited) return false; if (requireMultiWiFi && multiWiFi.size() <= 1) return false; - if (WiFi.scanComplete() < 0) return false; + const int scanStatus = WiFi.scanComplete(); + if (scanStatus == WIFI_SCAN_RUNNING) return false; // do not restart while scan is active findWiFi(true); // reinit WiFi scan return true; #endif