From 2890a7928b492ce4679ac23b04595cbff3917f3a Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Fri, 4 Mar 2022 23:36:31 +0100 Subject: [PATCH] restart with AVR WDT or ESP.restart() --- DCCEXParser.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index ab1f122..643d0a4 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -38,7 +38,9 @@ #include "DIAG.h" #include "TrackManager.h" #include "DCCTimer.h" +#ifdef HAS_AVR_WDT #include +#endif // These keywords are used in the <1> command. The number is what you get if you use the keyword as a parameter. @@ -775,8 +777,12 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[]) case HASH_KEYWORD_RESET: { +#ifdef HAS_AVR_WDT wdt_enable( WDTO_15MS); // set Arduino watchdog timer for 15ms - delay(50); // wait for the prescaller time to expire + delay(50); // wait for the prescaller time to expire +#else + ESP.restart(); +#endif break; // and if we didnt restart }