Force reconfiguration of software access point when updating config or initializing APSettingsService instance.

This commit is contained in:
Rick Watson 2018-11-11 19:44:20 +00:00
parent be1c86710b
commit 81d594f899
2 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,6 @@ void APSettingsService::manageAP() {
void APSettingsService::startAP() { void APSettingsService::startAP() {
Serial.println("Starting software access point"); Serial.println("Starting software access point");
WiFi.softAP(_ssid.c_str(), _password.c_str()); WiFi.softAP(_ssid.c_str(), _password.c_str());
if (!_dnsServer) { if (!_dnsServer) {
IPAddress apIp = WiFi.softAPIP(); IPAddress apIp = WiFi.softAPIP();
Serial.print("Starting captive portal on "); Serial.print("Starting captive portal on ");
@ -81,4 +80,7 @@ void APSettingsService::writeToJsonObject(JsonObject& root) {
void APSettingsService::onConfigUpdated() { void APSettingsService::onConfigUpdated() {
_lastManaged = millis() - MANAGE_NETWORK_DELAY; _lastManaged = millis() - MANAGE_NETWORK_DELAY;
// stop softAP - forces reconfiguration in loop()
stopAP();
} }

View File

@ -21,7 +21,6 @@ class WiFiSettingsService : public SettingsService {
void readFromJsonObject(JsonObject& root); void readFromJsonObject(JsonObject& root);
void writeToJsonObject(JsonObject& root); void writeToJsonObject(JsonObject& root);
void onConfigUpdated(); void onConfigUpdated();
void reconfigureWiFiConnection(); void reconfigureWiFiConnection();
private: private: