[SYS] Change eraseAndRestart scope (#1627)
This commit is contained in:
1 parent
39b36b4456
commit
9f71a50109
3 files changed
+20
-16
No files matched your search
@@ -113,6 +113,7 @@ build_flags =
|
||||
'-DWM_PWD_FROM_MAC=true'
|
||||
'-DUSE_MAC_AS_GATEWAY_NAME=true'
|
||||
'-DZsensorC37_YL83_HMRD="HMRD"'
|
||||
'-DESPWifiManualSetup=true'
|
||||
'-DDEEP_SLEEP_IN_US=120000000' ; Deep sleep for a period of time to conserve battery
|
||||
'-DESP32_EXT0_WAKE_PIN=GPIO_NUM_14' ;Should a water leak be detected immediatly wake the ESP32 and report the problem
|
||||
'-DESP32_EXT0_WAKE_PIN_STATE=0' ;Should a water leak be detected immediatly wake the ESP32 and report the problem, sensor state to look for wakeup
|
||||
|
||||
@@ -46,8 +46,6 @@ QueueHandle_t webUIQueue;
|
||||
WebServer server(80);
|
||||
|
||||
/*------------------- External functions ----------------------*/
|
||||
|
||||
esp_err_t nvs_flash_erase(void);
|
||||
extern void eraseAndRestart();
|
||||
extern unsigned long uptime();
|
||||
|
||||
|
||||
+19
-14
@@ -1306,20 +1306,6 @@ void checkButton() {
|
||||
void checkButton() {}
|
||||
# endif
|
||||
|
||||
void eraseAndRestart() {
|
||||
Log.trace(F("Formatting requested, result: %d" CR), SPIFFS.format());
|
||||
|
||||
# if defined(ESP8266)
|
||||
WiFi.disconnect(true);
|
||||
wifiManager.resetSettings();
|
||||
delay(5000);
|
||||
ESP.reset();
|
||||
# else
|
||||
nvs_flash_erase();
|
||||
ESP.restart();
|
||||
# endif
|
||||
}
|
||||
|
||||
void saveMqttConfig() {
|
||||
Log.trace(F("saving config" CR));
|
||||
DynamicJsonDocument json(512 + ota_server_cert.length() + mqtt_cert.length());
|
||||
@@ -1923,6 +1909,25 @@ String UTCtimestamp() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
Erase flash and restart the ESP
|
||||
*/
|
||||
void eraseAndRestart() {
|
||||
Log.trace(F("Formatting requested, result: %d" CR), SPIFFS.format());
|
||||
|
||||
# if defined(ESP8266)
|
||||
WiFi.disconnect(true);
|
||||
# ifndef ESPWifiManualSetup
|
||||
wifiManager.resetSettings();
|
||||
# endif
|
||||
delay(5000);
|
||||
ESP.reset();
|
||||
# else
|
||||
nvs_flash_erase();
|
||||
ESP.restart();
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
|
||||
|
||||
Reference in new issue
Block a user