Restarting due to too long AP inactivity

This commit is contained in:
chshkhr 2022-11-28 17:24:00 +02:00
parent 4c9ab6e174
commit eb0b0508cd
1 changed files with 8 additions and 0 deletions

View File

@ -443,6 +443,9 @@ void StartCamera() {
// We now have camera with default init
}
unsigned long accesspoint_start = 0;
void WifiSetup() {
// Feedback that we are now attempting to connect
flashLED(300);
@ -625,6 +628,7 @@ void WifiSetup() {
dnsServer.start(DNS_PORT, "*", ip);
captivePortal = true;
}
accesspoint_start = millis();
}
}
@ -814,6 +818,10 @@ void loop() {
handleSerial();
if (captivePortal) dnsServer.processNextRequest();
}
if (accesspoint_start > 0 && millis() - accesspoint_start > 20 * WIFI_WATCHDOG && !streamsServed) {
Serial.println("Restarting due to too long AP inactivity...");
ESP.restart();
}
} else {
// client mode can fail; so reconnect as appropriate
static bool warned = false;