🐛 Fix Manual Move cold extrude override (#24045)

Followup to #19606

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2022-04-19 15:03:42 +12:00 committed by Scott Lahteine
parent 7f1c5ad7aa
commit 27b1484428
4 changed files with 18 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "../../module/planner.h" #include "../../module/planner.h"
#include "../../module/motion.h" #include "../../module/motion.h"
#include "../../module/printcounter.h" #include "../../module/printcounter.h"
#include "../../module/temperature.h"
#include "../../gcode/queue.h" #include "../../gcode/queue.h"
#if HAS_BUZZER #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*/) { 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) { if (currentScreen != screen) {
thermalManager.set_menu_cold_override(false);
TERN_(IS_DWIN_MARLINUI, did_first_redraw = false); TERN_(IS_DWIN_MARLINUI, did_first_redraw = false);

View File

@ -219,7 +219,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
ui.goto_screen([]{ ui.goto_screen([]{
MenuItem_confirm::select_screen( MenuItem_confirm::select_screen(
GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), 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("!") GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!")
); );
}); });

View File

@ -482,6 +482,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
#endif #endif
#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) #if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false; bool Temperature::allow_cold_extrude = false;
celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;

View File

@ -402,10 +402,18 @@ class Temperature {
static uint8_t soft_pwm_controller_speed; static uint8_t soft_pwm_controller_speed;
#endif #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) #if ENABLED(PREVENT_COLD_EXTRUSION)
static bool allow_cold_extrude; static bool allow_cold_extrude;
static celsius_t extrude_min_temp; 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 tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); } static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
#else #else