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
This commit is contained in:
Tom Fifield 2025-07-28 17:58:06 +10:00
parent aa3b14ce72
commit db5a627e7c
No known key found for this signature in database

View File

@ -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;