From db5a627e7c64bc44297bd9d24b1ce562b902bc04 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Mon, 28 Jul 2025 17:58:06 +1000 Subject: [PATCH] Workaround Webserver needing to stay up while Wifi is turned off Expertly triaged by @philon- , turning off wifi using the HTTP API did not work. That was because we only served the HTTP API if Wifi was deemed to be available, but mid-way through turning it off Wifi was still available, but the configuration we were checking said it wasn't. This patch introduces an additional way the system can determine if Wifi is available, by referring to the WiFi.status(). This means that in that limbo state where Wifi has been set to be turned off, but the configuration has not been saved and it is still up, the HTTP API will stay up long enough to save the configuration. Fixes https://github.com/meshtastic/firmware/issues/6965 --- src/mesh/wifi/WiFiAPClient.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 7a56c258b..1133ad424 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -235,6 +235,11 @@ bool isWifiAvailable() #ifdef USE_WS5500 } else if (config.network.eth_enabled) { return true; +#endif +#ifndef ARCH_PORTDUINO + } else if (WiFi.status() == WL_CONNECTED) { + // it's likely we have wifi now, but user intends to turn it off in config! + return true; #endif } else { return false;