From b203757b5c85e554d4ee052cbeff6cf1844b11eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 23 Feb 2017 21:20:15 +0100 Subject: [PATCH] Using ESP.restart() instead of ESP.reset() --- code/espurna/button.ino | 2 +- code/espurna/mqtt.ino | 2 +- code/espurna/settings.ino | 2 +- code/espurna/web.ino | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/espurna/button.ino b/code/espurna/button.ino index bb6e9a20..70245338 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -78,7 +78,7 @@ void buttonEvent(unsigned int id, unsigned char event) { } } if (action == BUTTON_MODE_AP) createAP(); - if (action == BUTTON_MODE_RESET) ESP.reset(); + if (action == BUTTON_MODE_RESET) ESP.restart(); if (action == BUTTON_MODE_PULSE) relayPulseToggle(); } diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index f4bc5c51..1f633ed6 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -138,7 +138,7 @@ void _mqttOnMessage(char* topic, char* payload, unsigned int len) { char * p = mqttSubtopic(topic); if (strcmp(p, MQTT_ACTION_TOPIC) == 0) { if (strcmp(message, MQTT_ACTION_RESET) == 0) { - ESP.reset(); + ESP.restart(); } } diff --git a/code/espurna/settings.ino b/code/espurna/settings.ino index 633126ea..8f58179e 100644 --- a/code/espurna/settings.ino +++ b/code/espurna/settings.ino @@ -89,7 +89,7 @@ void settingsSetup() { Embedis::command( F("RESET"), [](Embedis* e) { e->response(Embedis::OK); - ESP.reset(); + ESP.restart(); }); Embedis::command( F("STATUS"), [](Embedis* e) { diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 2be6b31d..9eb84a3f 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -88,7 +88,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) { DEBUG_MSG("[WEBSOCKET] Requested action: %s\n", action.c_str()); - if (action.equals("reset")) ESP.reset(); + if (action.equals("reset")) ESP.restart(); if (action.equals("restore") && root.containsKey("data")) { JsonObject& data = root["data"]; @@ -102,6 +102,8 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) { } for (auto element : data){ + if (strcmp(element.key, "app") == 0) continue; + if (strcmp(element.key, "version") == 0) continue; setSetting(element.key, element.value.as()); } @@ -696,7 +698,7 @@ void _onRPC(AsyncWebServerRequest *request) { if (action.equals("reset")) { response = 200; - deferred.once_ms(100, []() { ESP.reset(); }); + deferred.once_ms(100, []() { ESP.restart(); }); } }