Erase stored settings in NVS when triggered. (#1009)
This resolves #994 where the esp32 would still save the client information after a factory reset is performed.
This commit is contained in:
1 parent
3f13984f44
commit
c55646968f
1 file changed
+4
-7
+4
-7
@@ -186,6 +186,8 @@ static String mqtt_cert = "";
|
|||||||
# include <ArduinoOTA.h>
|
# include <ArduinoOTA.h>
|
||||||
# include <FS.h>
|
# include <FS.h>
|
||||||
# include <SPIFFS.h>
|
# include <SPIFFS.h>
|
||||||
|
# include <nvs.h>
|
||||||
|
# include <nvs_flash.h>
|
||||||
|
|
||||||
# ifdef ESP32_ETHERNET
|
# ifdef ESP32_ETHERNET
|
||||||
# define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
|
# define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
|
||||||
@@ -985,19 +987,14 @@ void checkButton() {}
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
void eraseAndRestart() {
|
void eraseAndRestart() {
|
||||||
# if defined(ESP8266)
|
|
||||||
WiFi.disconnect(true);
|
|
||||||
# else
|
|
||||||
WiFi.disconnect(true, true);
|
|
||||||
# endif
|
|
||||||
|
|
||||||
Log.trace(F("Formatting requested, result: %d" CR), SPIFFS.format());
|
Log.trace(F("Formatting requested, result: %d" CR), SPIFFS.format());
|
||||||
|
|
||||||
# if defined(ESP8266)
|
# if defined(ESP8266)
|
||||||
ESP.eraseConfig();
|
SPIFFS.format();
|
||||||
delay(5000);
|
delay(5000);
|
||||||
ESP.reset();
|
ESP.reset();
|
||||||
# else
|
# else
|
||||||
|
nvs_flash_erase();
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user