Add JSON API for AP toggle

This commit is contained in:
Blaz Kristan
2023-12-10 09:59:36 +01:00
parent 27532a4237
commit 6f3b5fc559
2 changed files with 21 additions and 5 deletions

View File

@@ -889,11 +889,14 @@ void WLED::handleConnection()
DEBUG_PRINTLN(F("Not connected AP."));
initAP(); // start AP only within first 5min
}
} if (apActive && apBehavior == AP_BEHAVIOR_BOOT_NO_CONN_5MIN && now > 300000 && stac == 0) { // disconnect AP after 5min
dnsServer.stop();
WiFi.softAPdisconnect(true);
apActive = false;
DEBUG_PRINTLN(F("Access point disabled (after 5min)."));
} if (apActive && apBehavior == AP_BEHAVIOR_BOOT_NO_CONN_5MIN && now > 300000 && stac == 0) { // disconnect AP after 5min if no clients connected
// if AP was enabled more than 10min after boot or if client was connected more than 10min after boot do not disconnect AP mode
if (now < 600000) {
dnsServer.stop();
WiFi.softAPdisconnect(true);
apActive = false;
DEBUG_PRINTLN(F("Access point disabled (after 5min)."));
}
}
} else if (!interfacesInited) { //newly connected
DEBUG_PRINTLN("");