From b232f39341db700a375c24b7f518726d2c861cca Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 29 Oct 2017 18:30:03 -0500 Subject: [PATCH] AVR: Hidden option to use 8s watchdog --- Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp index 78dc943ea..9bf674fce 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp @@ -30,16 +30,22 @@ #include "../../Marlin.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 }