From 171933cf20700ad1e7db1bea4bdb7e3d39bb112a Mon Sep 17 00:00:00 2001 From: Nils Bernhardt Date: Tue, 6 Mar 2018 17:29:21 +0100 Subject: [PATCH] One more try... --- espArtLeDNode/espArtLeDNode.ino | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/espArtLeDNode/espArtLeDNode.ino b/espArtLeDNode/espArtLeDNode.ino index 81fd65a..1b43ffb 100644 --- a/espArtLeDNode/espArtLeDNode.ino +++ b/espArtLeDNode/espArtLeDNode.ino @@ -30,7 +30,7 @@ extern "C" { extern struct rst_info resetInfo; } -#define FIRMWARE_VERSION "v1.0.3-dev16" +#define FIRMWARE_VERSION "v1.0.3-dev18" #define ART_FIRM_VERSION 0x0200 // Firmware given over Artnet (2 bytes) @@ -135,6 +135,15 @@ bool doReboot = false; byte* dataIn; void setup(void) { + // Restart if crashed before + switch (resetInfo.reason) { + case REASON_WDT_RST: // hardware watch dog reset + case REASON_EXCEPTION_RST: // exception reset, GPIO status won’t change + case REASON_SOFT_WDT_RST: // software watch dog reset, GPIO status won’t change + ESP.restart(); + break; + } + //pinMode(4, OUTPUT); //digitalWrite(4, LOW); //Serial.begin(74880); // to match bootloader baudrate @@ -238,15 +247,6 @@ void setup(void) { deviceSettings.doFirmwareUpdate = false; } break; - - case REASON_WDT_RST: // hardware watch dog reset - case REASON_EXCEPTION_RST: // exception reset, GPIO status won’t change - case REASON_SOFT_WDT_RST: // software watch dog reset, GPIO status won’t change - ESP.restart(); - break; - case REASON_DEEP_SLEEP_AWAKE: - // not used - break; } delay(10);