From 847e4ced11c014bdba869bb903c0c28d30b0b8a1 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Mon, 16 Sep 2019 23:09:43 +0200 Subject: [PATCH] Fix M43 without watchdog (#15280) --- Marlin/src/gcode/config/M43.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 7b048f2190..e26f6d8ee2 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -50,6 +50,12 @@ #define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q) #endif +inline void _watchdog_reset() { + #if ENABLED(USE_WATCHDOG) + watchdog_reset(); + #endif +} + inline void toggle_pins() { const bool ignore_protection = parser.boolval('I'); const int repeat = parser.intval('R', 1), @@ -65,7 +71,7 @@ inline void toggle_pins() { SERIAL_EOL(); } else { - watchdog_reset(); + _watchdog_reset(); report_pin_state_extended(pin, ignore_protection, true, "Pulsing "); #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO if (pin == TEENSY_E2) { @@ -89,10 +95,10 @@ inline void toggle_pins() { { pinMode(pin, OUTPUT); for (int16_t j = 0; j < repeat; j++) { - watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); - watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait); - watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); - watchdog_reset(); + _watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + _watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait); + _watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + _watchdog_reset(); } } }