fix: Endlosschleife Wifi auto off
This commit is contained in:
1 parent
5688f8d679
commit
13f1aa2148
1 file changed
+7
-1
@@ -65,6 +65,7 @@ TelemetrySettings *active_settings = nullptr;
|
||||
bool restart_after_update = false;
|
||||
bool update_failed = false;
|
||||
bool access_point_restart_pending = false;
|
||||
bool access_point_active = false;
|
||||
unsigned long access_point_started_ms = 0UL;
|
||||
|
||||
String html_escape(const String &value)
|
||||
@@ -348,6 +349,7 @@ bool webinterface_begin(TelemetrySettings &settings)
|
||||
if (!ap_started)
|
||||
return false;
|
||||
|
||||
access_point_active = true;
|
||||
access_point_started_ms = millis();
|
||||
dns_server.start(53, "connectivitycheck.gstatic.com", WiFi.softAPIP());
|
||||
dns_server.start(53, "clients3.google.com", WiFi.softAPIP());
|
||||
@@ -381,16 +383,20 @@ void webinterface_handle(void)
|
||||
{
|
||||
access_point_restart_pending = false;
|
||||
WiFi.softAPdisconnect(true);
|
||||
access_point_active = false;
|
||||
delay(100);
|
||||
if (!WiFi.softAP(active_settings->access_point_name, active_settings->access_point_password))
|
||||
Serial.println("Access Point konnte nicht neu gestartet werden");
|
||||
else
|
||||
access_point_active = true;
|
||||
access_point_started_ms = millis();
|
||||
}
|
||||
|
||||
if (WiFi.softAPgetStationNum() == 0 && (millis() - access_point_started_ms) >= access_point_timeout_ms)
|
||||
if (access_point_active && WiFi.softAPgetStationNum() == 0 && (millis() - access_point_started_ms) >= access_point_timeout_ms)
|
||||
{
|
||||
Serial.println("Access Point nach 5 Minuten ohne Client deaktiviert");
|
||||
WiFi.softAPdisconnect(true);
|
||||
access_point_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user