diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1e0ef1554a..c01686105f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5871,15 +5871,41 @@ inline void gcode_M17() { } } + static void ensure_safe_temperature() { + bool heaters_heating = true; + + wait_for_heatup = true; // M108 will clear this + while (wait_for_heatup && heaters_heating) { + idle(); + heaters_heating = false; + HOTEND_LOOP() { + if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) { + heaters_heating = true; + #if ENABLED(ULTIPANEL) + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT); + #endif + break; + } + } + } + } + static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos, const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false ) { if (move_away_flag) return false; // already paused - if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) { - SERIAL_ERROR_START; - SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600); - return false; + if (!DEBUGGING(DRYRUN) && unload_length != 0) { + #if ENABLED(PREVENT_COLD_EXTRUSION) + if (!thermalManager.allow_cold_extrude && + thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) { + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600); + return false; + } + #endif + + ensure_safe_temperature(); // wait for extruder to heat up before unloading } // Indicate that the printer is paused @@ -5965,25 +5991,6 @@ inline void gcode_M17() { return true; } - static void ensure_safe_temperature() { - bool did_show = false; - wait_for_heatup = true; - while (wait_for_heatup) { - idle(); - wait_for_heatup = false; - HOTEND_LOOP() { - if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) { - wait_for_heatup = true; - if (!did_show) { // Show "wait for heating" - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT); - did_show = true; - } - break; - } - } - } - } - static void wait_for_filament_reload(int8_t max_beep_count = 0) { bool nozzle_timed_out = false; @@ -6000,7 +6007,8 @@ inline void gcode_M17() { nozzle_timed_out |= thermalManager.is_heater_idle(e); #if ENABLED(ULTIPANEL) - if (nozzle_timed_out) ensure_safe_temperature(); + if (nozzle_timed_out) + lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE); #endif idle(true); @@ -6019,23 +6027,7 @@ inline void gcode_M17() { thermalManager.reset_heater_idle_timer(e); } - #if ENABLED(ULTIPANEL) - // Show "wait for heating" - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT); - #endif - - wait_for_heatup = true; - while (wait_for_heatup) { - idle(); - wait_for_heatup = false; - HOTEND_LOOP() { - const int16_t target_temp = thermalManager.degTargetHotend(e); - if (target_temp && abs(thermalManager.degHotend(e) - target_temp) > 3) { - wait_for_heatup = true; - break; - } - } - } + if (nozzle_timed_out) ensure_safe_temperature(); #if HAS_BUZZER filament_change_beep(max_beep_count, true); @@ -9248,8 +9240,6 @@ inline void gcode_M503() { */ inline void gcode_M600() { - ensure_safe_temperature(); - // Initial retract before move to filament change position const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0 #if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0