From 9c870baf840ab17be0c4be4bb3928434bac2d10d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 28 Aug 2017 18:19:30 -0500 Subject: [PATCH] Add a hidden 8s watchdog option for easier debugging --- Marlin/watchdog.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/watchdog.cpp b/Marlin/watchdog.cpp index 5e42b5fac..9e6f0a819 100644 --- a/Marlin/watchdog.cpp +++ b/Marlin/watchdog.cpp @@ -26,16 +26,22 @@ #include "watchdog.h" -// Initialize watchdog with a 4 sec interrupt time +// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s. void watchdog_init() { + #if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S) + #define WDTO_NS WDTO_8S + #else + #define WDTO_NS WDTO_4S + #endif #if ENABLED(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. + // Take care, as this requires the correct order of operation, with interrupts disabled. + // See the datasheet of any AVR chip for details. wdt_reset(); _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); - _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S; + _WD_CONTROL_REG = _BV(WDIE) | WDTO_NS; #else - wdt_enable(WDTO_4S); + wdt_enable(WDTO_NS); #endif }