mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 14:27:18 +00:00
Add rescan & selection on disconnect
This commit is contained in:
parent
8817d41275
commit
3eb412b750
@ -889,6 +889,7 @@ void WLED::initInterfaces()
|
||||
|
||||
void WLED::handleConnection()
|
||||
{
|
||||
static bool scanDone = true;
|
||||
static byte stacO = 0;
|
||||
static uint32_t lastHeap = UINT32_MAX;
|
||||
static unsigned long heapTime = 0;
|
||||
@ -949,10 +950,17 @@ void WLED::handleConnection()
|
||||
|
||||
if (!Network.isConnected()) {
|
||||
if (interfacesInited) {
|
||||
if (scanDone) {
|
||||
DEBUG_PRINTLN(F("WiFi scan initiated on disconnect."));
|
||||
findWiFi(true); // reinit scan
|
||||
scanDone = false;
|
||||
return; // try to connect in next iteration
|
||||
}
|
||||
DEBUG_PRINTLN(F("Disconnected!"));
|
||||
selectedWiFi = findWiFi();
|
||||
initConnection();
|
||||
findWiFi(true); // reinit scan
|
||||
interfacesInited = false;
|
||||
scanDone = true;
|
||||
}
|
||||
//send improv failed 6 seconds after second init attempt (24 sec. after provisioning)
|
||||
if (improvActive > 2 && now - lastReconnectAttempt > 6000) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user