From 320835a1b7b29a7f3e01710e346dd0895600e0e5 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 10 Dec 2021 01:46:20 +0100 Subject: [PATCH] Do not cancel wait-for-temperature loops in disable_heaters() Partially revert previous change: cancelling a single loop would often advance the gcode stream to the next wait-for loop if executed at the beginning of an SD print, implicitly turning off the flag again. Cancel the loop directly in UnconditionalStop() which stops the command queue as well in an atomic way, handling this correctly. --- Firmware/Marlin_main.cpp | 3 ++- Firmware/temperature.cpp | 1 - Firmware/temperature.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 5fb82577..30c20589 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -294,7 +294,7 @@ uint8_t newFanSpeed = 0; bool powersupply = true; #endif -bool cancel_heatup = false ; +bool cancel_heatup = false; int8_t busy_state = NOT_BUSY; static long prev_busy_signal_ms = -1; @@ -10160,6 +10160,7 @@ void UnconditionalStop() // Disable all heaters and unroll the temperature wait loop stack disable_heater(); + cancel_heatup = true; // Clear any saved printing state cancel_saved_printing(); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index c53242ae..87ffc614 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1416,7 +1416,6 @@ void temp_runaway_stop(bool isPreheat, bool isBed) void disable_heater() { - cancel_heatup = true; setAllTargetHotends(0); setTargetBed(0); #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1 diff --git a/Firmware/temperature.h b/Firmware/temperature.h index a2d1db2b..b0e035d7 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -220,7 +220,7 @@ FORCE_INLINE bool isCoolingBed() { #define CHECK_ALL_HEATERS (checkAllHotends()||(target_temperature_bed!=0)) int getHeaterPower(int heater); -void disable_heater(); // Disable all heaters and unroll the temperature wait loop stack +void disable_heater(); // Disable all heaters void updatePID();