diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2841dd7309..0d69405545 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -185,9 +185,10 @@ //#define USE_WATCHDOG #ifdef USE_WATCHDOG -// you cannot watchdog reboot on Arduino mega2560 due to a bug in he bootloader. Hence we need to ask the user to reset. -// THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. -//#define RESET_MANUAL +// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. +// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset. +// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. +#define WATCHDOG_RESET_MANUAL #endif // extruder advance constant (s2/mm3) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index bec9dfe91b..6f7de792c0 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -17,7 +17,6 @@ #include #include #include -#include #include diff --git a/Marlin/watchdog.cpp b/Marlin/watchdog.cpp index 19e6c54d49..7d42995505 100644 --- a/Marlin/watchdog.cpp +++ b/Marlin/watchdog.cpp @@ -1,6 +1,8 @@ #include "Marlin.h" -#ifdef USE_WATCHDOG +#ifdef USE_WATCHDOG +#include + #include "watchdog.h" #include "ultralcd.h" @@ -16,7 +18,7 @@ /// intialise watch dog with a 1 sec interrupt time void watchdog_init() { -#ifdef RESET_MANUAL +#ifdef WATCHDOG_RESET_MANUAL //We enable the watchdog timer, but only for the interrupt. //Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details. wdt_reset(); @@ -30,7 +32,7 @@ void watchdog_init() /// reset watchdog. MUST be called every 1s after init or avr will reset. void watchdog_reset() { - wdt_reset(); + wdt_reset(); } //=========================================================================== @@ -38,14 +40,14 @@ void watchdog_reset() //=========================================================================== //Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled. -#ifdef RESET_MANUAL +#ifdef WATCHDOG_RESET_MANUAL ISR(WDT_vect) -{ +{ + //TODO: This message gets overwritten by the kill() call LCD_MESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display LCD_STATUS; SERIAL_ERROR_START; SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer."); - kill(); //kill blocks while(1); //wait for user or serial reset }