mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-23 21:55:26 +01:00
Network manager: AutoAP Disable
This commit is contained in:
parent
1ff5504956
commit
1668fc1412
|
|
@ -11,21 +11,19 @@ NetworkManager::~NetworkManager() { }
|
|||
// Private methods
|
||||
|
||||
void NetworkManager::_processAPTimeout() {
|
||||
if (!_wifiAPmode || _apTimeout == 0 || !_wifiSTAmode) {
|
||||
if (!_wifiAPmode || _apTimeout == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If any station is connected, reset the timer
|
||||
if (WiFi.softAPgetStationNum() > 0) {
|
||||
_apStartup = millis();
|
||||
return;
|
||||
}
|
||||
|
||||
if (millis() - _apStartup > _apTimeout) {
|
||||
// Time expired, switch to client mode if successfully connected
|
||||
if (isWiFiConnected()) {
|
||||
Serial.println("AP timeout reached. Switching to client mode only.");
|
||||
disableAP();
|
||||
}
|
||||
else {
|
||||
// Not connected as a client, keep AP running
|
||||
Serial.println("AP timeout reached but WiFi client still not connected. Keeping AP mode active.");
|
||||
_apStartup = millis(); // Reset timer
|
||||
}
|
||||
Serial.println("AP timeout reached. Disabling AP mode.");
|
||||
disableAP();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue