From b3e19041fffd7f137a2b042198a82f06fbe8c81c Mon Sep 17 00:00:00 2001 From: Shawn A Date: Mon, 18 Jun 2018 15:27:47 -0500 Subject: [PATCH] fix esp32 erase w persistent --- WiFiManager.cpp | 6 +++++- WiFiManager.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index cc22363..dd50e20 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2352,8 +2352,12 @@ bool WiFiManager::WiFi_eraseConfig() { return true; #endif #elif defined(ESP32) + bool ret; WiFi.mode(WIFI_AP_STA); // cannot erase if not in STA mode ! - return WiFi.disconnect(true); + WiFi.persistent(true); + ret = WiFi.disconnect(true); + WiFi.persistent(false); + return ret; #endif } diff --git a/WiFiManager.h b/WiFiManager.h index 1953839..8538f4a 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -311,6 +311,7 @@ class WiFiManager boolean _disableIpFields = false; // edge case, if true, showxFields(false) forces ip fields off instead of default show when set // wrapper functions for handling setting and unsetting persistent for now. + bool esp32persistent = false; bool _hasBegun = false; void _begin(); void _end();