mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-15 15:41:21 +10:00
adds nvs erase
// #define WM_ERASE_NVS // esp32 erase() will erase NVS
This commit is contained in:
+12
-1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user