1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

DCCTimer::reset

Moves CPU dependent reset code into correct place.
This commit is contained in:
Asbelos
2022-07-08 15:01:40 +01:00
parent 090acdae44
commit 9768083bfe
8 changed files with 34 additions and 26 deletions

View File

@@ -40,9 +40,7 @@
#include "TrackManager.h"
#include "DCCTimer.h"
#include "EXRAIL2.h"
#ifdef HAS_AVR_WDT
#include <avr/wdt.h>
#endif
// These keywords are used in the <1> command. The number is what you get if you use the keyword as a parameter.
@@ -902,23 +900,9 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
return true;
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
#else
#if defined(ARDUINO_ARCH_ESP32)
ESP.restart();
#endif
#if defined(ARDUINO_ARCH_SAMD)
// Disable all interrupts and reset uC
__disable_irq();
NVIC_SystemReset();
while(true) {};
#endif
#endif
break; // and <X> if we didnt restart
}
DCCTimer::reset();
break; // and <X> if we didnt restart
#ifndef DISABLE_EEPROM
case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries>