From 5005c7b64c1763eca767ad476f404301d6ef754a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 19 Apr 2022 15:03:42 +1200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Manual=20Move=20cold=20ext?= =?UTF-8?q?rude=20override=20(#24045)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #19606 Co-authored-by: Scott Lahteine --- Marlin/src/lcd/menu/menu.cpp | 2 ++ Marlin/src/lcd/menu/menu_motion.cpp | 2 +- Marlin/src/module/temperature.cpp | 6 ++++++ Marlin/src/module/temperature.h | 10 +++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 52c43ec5e9..bcdff450bd 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -28,6 +28,7 @@ #include "../../module/planner.h" #include "../../module/motion.h" #include "../../module/printcounter.h" +#include "../../module/temperature.h" #include "../../gcode/queue.h" #if HAS_BUZZER @@ -171,6 +172,7 @@ bool printer_busy() { */ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { if (currentScreen != screen) { + thermalManager.set_menu_cold_override(false); TERN_(IS_DWIN_MARLINUI, did_first_redraw = false); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index baed081036..1ef38c014b 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -228,7 +228,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int ui.goto_screen([]{ MenuItem_confirm::select_screen( GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), - _goto_menu_move_distance_e, nullptr, + [] { _goto_menu_move_distance_e(); thermalManager.set_menu_cold_override(true); }, nullptr, GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!") ); }); diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 2db2487b78..9cadcdc84e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -487,6 +487,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #endif #endif +#if BOTH(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 + bool Temperature::allow_cold_extrude_override = false; +#else + constexpr bool Temperature::allow_cold_extrude_override; +#endif + #if ENABLED(PREVENT_COLD_EXTRUSION) bool Temperature::allow_cold_extrude = false; celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 7cd2c13343..f54cd0334b 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -429,10 +429,18 @@ class Temperature { static uint8_t soft_pwm_controller_speed; #endif + #if BOTH(HAS_MARLINUI_MENU, PREVENT_COLD_EXTRUSION) && E_MANUAL > 0 + static bool allow_cold_extrude_override; + static void set_menu_cold_override(const bool allow) { allow_cold_extrude_override = allow; } + #else + static constexpr bool allow_cold_extrude_override = false; + static void set_menu_cold_override(const bool) {} + #endif + #if ENABLED(PREVENT_COLD_EXTRUSION) static bool allow_cold_extrude; static celsius_t extrude_min_temp; - static bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); } + static bool tooCold(const celsius_t temp) { return !allow_cold_extrude && !allow_cold_extrude_override && temp < extrude_min_temp - (TEMP_WINDOW); } static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); } static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); } #else