From 7cc358b56b02a121e90e1c5a80ccc91d328487b0 Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Sun, 6 Nov 2011 14:58:12 +0100 Subject: [PATCH] wrong file location --- Marlin/watchdog.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++ Marlin/watchdog.h | 10 ++++++++++ 2 files changed, 58 insertions(+) create mode 100644 Marlin/watchdog.cpp create mode 100644 Marlin/watchdog.h diff --git a/Marlin/watchdog.cpp b/Marlin/watchdog.cpp new file mode 100644 index 000000000..0adf9cc7d --- /dev/null +++ b/Marlin/watchdog.cpp @@ -0,0 +1,48 @@ +#ifdef USE_WATCHDOG + +#include +#include + +volatile uint8_t timeout_seconds=0; + +void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560 + +//Watchdog timer interrupt, called if main program blocks >1sec +ISR(WDT_vect) +{ + if(timeout_seconds++ >= WATCHDOG_TIMEOUT) + { + + #ifdef RESET_MANUAL + LCD_MESSAGE("Please Reset!"); + ECHOLN("echo_: Something is wrong, please turn off the printer."); + #else + LCD_MESSAGE("Timeout, resetting!"); + #endif + //disable watchdog, it will survife reboot. + WDTCSR |= (1<