From 4937519d51047f95032d9f8149432c45fc95c48f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 1 Feb 2020 17:04:29 -0600 Subject: [PATCH] Fix LPC build with USE_WATCHDOG off --- Marlin/src/HAL/HAL_LPC1768/DebugMonitor.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Marlin/src/HAL/HAL_LPC1768/DebugMonitor.cpp b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor.cpp index fefee386e..bd6c59bcb 100644 --- a/Marlin/src/HAL/HAL_LPC1768/DebugMonitor.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor.cpp @@ -199,14 +199,23 @@ void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause // Clear cause of reset to prevent entering smoothie bootstrap HAL_clear_reset_source(); + // Restart watchdog - //WDT_Restart(WDT); - watchdog_init(); + #if ENABLED(USE_WATCHDOG) + //WDT_Restart(WDT); + watchdog_init(); + #endif // Reset controller NVIC_SystemReset(); - for (;;) watchdog_init(); + // Nothing below here is compiled because NVIC_SystemReset loops forever + + for (;;) { + #if ENABLED(USE_WATCHDOG) + watchdog_init(); + #endif + } } extern "C" {