From dc187690109b9f66673bb6675c098af0644d40e1 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Sun, 2 May 2021 23:37:54 -0300 Subject: [PATCH] Prevent watchdog reset in setup() (#21776) Cause `manage_heaters` to only reset the watchdog and return until `setup()` is completed. Co-authored-by: Scott Lahteine --- Marlin/src/inc/Conditionals_adv.h | 5 ----- Marlin/src/module/temperature.cpp | 18 ++---------------- Marlin/src/module/temperature.h | 4 ---- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 735e6464d9..19ab98fed3 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -370,11 +370,6 @@ #endif #endif -// If platform requires early initialization of watchdog to properly boot -#if ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM) - #define EARLY_WATCHDOG 1 -#endif - // Full Touch Screen needs 'tft/xpt2046' #if EITHER(TOUCH_SCREEN, HAS_TFT_LVGL_UI) #define HAS_TFT_XPT2046 1 diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 6a04efc302..2f1a54e91d 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -420,10 +420,6 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, // private: -#if EARLY_WATCHDOG - bool Temperature::inited = false; -#endif - volatile bool Temperature::raw_temps_ready = false; #if ENABLED(PID_EXTRUSION_SCALING) @@ -1205,11 +1201,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { * - Update the heated bed PID output value */ void Temperature::manage_heater() { - - #if EARLY_WATCHDOG - // If thermal manager is still not running, make sure to at least reset the watchdog! - if (!inited) return watchdog_refresh(); - #endif + if (marlin_state == MF_INITIALIZING) return watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! #if ENABLED(EMERGENCY_PARSER) if (emergency_parser.killed_by_M112) kill(M112_KILL_STR, nullptr, true); @@ -2015,12 +2007,6 @@ void Temperature::init() { TERN_(TEMP_SENSOR_1_IS_MAX6675, max6675_1.begin()); #endif - #if EARLY_WATCHDOG - // Flag that the thermalManager should be running - if (inited) return; - inited = true; - #endif - #if MB(RUMBA) // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector #define _AD(N) (TEMP_SENSOR_##N##_IS_AD595 || TEMP_SENSOR_##N##_IS_AD8495) @@ -2209,7 +2195,7 @@ void Temperature::init() { #endif // Wait for temperature measurement to settle - delay(250); + //delay(250); #if HAS_HOTEND diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 148e9eec54..96ff8b5895 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -419,10 +419,6 @@ class Temperature { private: - #if ENABLED(EARLY_WATCHDOG) - static bool inited; // If temperature controller is running - #endif - static volatile bool raw_temps_ready; #if ENABLED(WATCH_HOTENDS)