Skip to content

Commit

Permalink
🐛 Fix Manual Move cold extrude override (MarlinFirmware#24045)
Browse files Browse the repository at this point in the history
Followup to MarlinFirmware#19606

Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
2 people authored and LCh-77 committed Jul 19, 2022
1 parent cea15a4 commit b891be0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("!")
);
});
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b891be0

Please sign in to comment.