Browse Source

Using ESP.restart() instead of ESP.reset()

fastled
Xose Pérez 7 years ago
parent
commit
b203757b5c
4 changed files with 7 additions and 5 deletions
  1. +1
    -1
      code/espurna/button.ino
  2. +1
    -1
      code/espurna/mqtt.ino
  3. +1
    -1
      code/espurna/settings.ino
  4. +4
    -2
      code/espurna/web.ino

+ 1
- 1
code/espurna/button.ino View File

@ -78,7 +78,7 @@ void buttonEvent(unsigned int id, unsigned char event) {
} }
} }
if (action == BUTTON_MODE_AP) createAP(); 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(); if (action == BUTTON_MODE_PULSE) relayPulseToggle();
} }


+ 1
- 1
code/espurna/mqtt.ino View File

@ -138,7 +138,7 @@ void _mqttOnMessage(char* topic, char* payload, unsigned int len) {
char * p = mqttSubtopic(topic); char * p = mqttSubtopic(topic);
if (strcmp(p, MQTT_ACTION_TOPIC) == 0) { if (strcmp(p, MQTT_ACTION_TOPIC) == 0) {
if (strcmp(message, MQTT_ACTION_RESET) == 0) { if (strcmp(message, MQTT_ACTION_RESET) == 0) {
ESP.reset();
ESP.restart();
} }
} }


+ 1
- 1
code/espurna/settings.ino View File

@ -89,7 +89,7 @@ void settingsSetup() {
Embedis::command( F("RESET"), [](Embedis* e) { Embedis::command( F("RESET"), [](Embedis* e) {
e->response(Embedis::OK); e->response(Embedis::OK);
ESP.reset();
ESP.restart();
}); });
Embedis::command( F("STATUS"), [](Embedis* e) { Embedis::command( F("STATUS"), [](Embedis* e) {


+ 4
- 2
code/espurna/web.ino View File

@ -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()); 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")) { if (action.equals("restore") && root.containsKey("data")) {
JsonObject& data = root["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){ for (auto element : data){
if (strcmp(element.key, "app") == 0) continue;
if (strcmp(element.key, "version") == 0) continue;
setSetting(element.key, element.value.as<char*>()); setSetting(element.key, element.value.as<char*>());
} }
@ -696,7 +698,7 @@ void _onRPC(AsyncWebServerRequest *request) {
if (action.equals("reset")) { if (action.equals("reset")) {
response = 200; response = 200;
deferred.once_ms(100, []() { ESP.reset(); });
deferred.once_ms(100, []() { ESP.restart(); });
} }
} }


Loading…
Cancel
Save