From 81d594f899db000209d9f5a2f93f9bdfb1f715eb Mon Sep 17 00:00:00 2001 From: Rick Watson Date: Sun, 11 Nov 2018 19:44:20 +0000 Subject: [PATCH] Force reconfiguration of software access point when updating config or initializing APSettingsService instance. --- src/APSettingsService.cpp | 4 +++- src/WiFiSettingsService.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/APSettingsService.cpp b/src/APSettingsService.cpp index d293ad1..895766d 100644 --- a/src/APSettingsService.cpp +++ b/src/APSettingsService.cpp @@ -32,7 +32,6 @@ void APSettingsService::manageAP() { void APSettingsService::startAP() { Serial.println("Starting software access point"); WiFi.softAP(_ssid.c_str(), _password.c_str()); - if (!_dnsServer) { IPAddress apIp = WiFi.softAPIP(); Serial.print("Starting captive portal on "); @@ -81,4 +80,7 @@ void APSettingsService::writeToJsonObject(JsonObject& root) { void APSettingsService::onConfigUpdated() { _lastManaged = millis() - MANAGE_NETWORK_DELAY; + + // stop softAP - forces reconfiguration in loop() + stopAP(); } \ No newline at end of file diff --git a/src/WiFiSettingsService.h b/src/WiFiSettingsService.h index 14ffe53..18949c6 100644 --- a/src/WiFiSettingsService.h +++ b/src/WiFiSettingsService.h @@ -21,7 +21,6 @@ class WiFiSettingsService : public SettingsService { void readFromJsonObject(JsonObject& root); void writeToJsonObject(JsonObject& root); void onConfigUpdated(); - void reconfigureWiFiConnection(); private: