Overridable Options - Part 5
Apply `ENABLED` / `DISABLED` macros to files needing only a small number of changes.
This commit is contained in:
committed by
Richard Wackerbarth
parent
5e834352a9
commit
58cfcd4239
@ -1,6 +1,6 @@
|
||||
#include "Marlin.h"
|
||||
|
||||
#ifdef USE_WATCHDOG
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
#include <avr/wdt.h>
|
||||
|
||||
#include "watchdog.h"
|
||||
@ -18,15 +18,15 @@
|
||||
/// intialise watch dog with a 4 sec interrupt time
|
||||
void watchdog_init()
|
||||
{
|
||||
#ifdef WATCHDOG_RESET_MANUAL
|
||||
#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.
|
||||
wdt_reset();
|
||||
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
|
||||
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
|
||||
#else
|
||||
#else
|
||||
wdt_enable(WDTO_4S);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||
@ -40,7 +40,7 @@ void watchdog_reset()
|
||||
//===========================================================================
|
||||
|
||||
//Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
|
||||
#ifdef WATCHDOG_RESET_MANUAL
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||
ISR(WDT_vect)
|
||||
{
|
||||
SERIAL_ERROR_START;
|
||||
|
Reference in New Issue
Block a user