adds nvs erase

// #define WM_ERASE_NVS // esp32 erase() will erase NVS
This commit is contained in:
Shawn A
2018-03-05 16:17:49 -06:00
parent 6e1b2ed32c
commit 9f6cc23beb
2 changed files with 18 additions and 1 deletions
+12 -1
View File
@@ -1545,6 +1545,17 @@ void WiFiManager::reboot(){
*/
bool WiFiManager::erase(){
DEBUG_WM("Erasing");
#if defined(WM_ERASE_NVS)
DEBUG_WM("Erasing NVS");
int err;
err=nvs_flash_init();
DEBUG_WM("nvs_flash_init: ",err ? err : "Success");
err=nvs_flash_erase();
DEBUG_WM("nvs_flash_erase: ", ? err : "Success");
return;
#endif
return WiFi_eraseConfig();
}
@@ -2119,4 +2130,4 @@ void WiFiManager::WiFi_autoReconnect(){
WiFi.onEvent(WiFiEvent);
}
#endif
}
}
+6
View File
@@ -16,6 +16,7 @@
#define WM_WEBSERVERSHIM // use webserver shim lib
// #define WM_MDNS // use MDNS
// #define WM_FIXERASECONFIG // use erase flash fix
// #define WM_ERASE_NVS // esp32 erase() will erase NVS
#ifdef ESP8266
@@ -51,6 +52,11 @@
#endif
#endif
#ifdef WM_ERASE_NVS
#include <nvs.h>
#include <nvs_flash.h>
#endif
#ifdef WM_MDNS
#include <ESPmDNS.h>
#endif