Updates for ensure_safe_temperature (#6963)

* Updates for ensure_safe_temperature

* M600 fixes
This commit is contained in:
Thomas Moore 2017-06-09 15:19:08 -05:00 committed by Roxy-3D
parent 2f55870edb
commit 897bc2ac1f

View file

@ -5871,16 +5871,42 @@ 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, 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 const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false
) { ) {
if (move_away_flag) return false; // already paused if (move_away_flag) return false; // already paused
if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) { 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_ERROR_START;
SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600); SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
return false; return false;
} }
#endif
ensure_safe_temperature(); // wait for extruder to heat up before unloading
}
// Indicate that the printer is paused // Indicate that the printer is paused
move_away_flag = true; move_away_flag = true;
@ -5965,25 +5991,6 @@ inline void gcode_M17() {
return true; 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) { static void wait_for_filament_reload(int8_t max_beep_count = 0) {
bool nozzle_timed_out = false; bool nozzle_timed_out = false;
@ -6000,7 +6007,8 @@ inline void gcode_M17() {
nozzle_timed_out |= thermalManager.is_heater_idle(e); nozzle_timed_out |= thermalManager.is_heater_idle(e);
#if ENABLED(ULTIPANEL) #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 #endif
idle(true); idle(true);
@ -6019,23 +6027,7 @@ inline void gcode_M17() {
thermalManager.reset_heater_idle_timer(e); thermalManager.reset_heater_idle_timer(e);
} }
#if ENABLED(ULTIPANEL) if (nozzle_timed_out) ensure_safe_temperature();
// 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 HAS_BUZZER #if HAS_BUZZER
filament_change_beep(max_beep_count, true); filament_change_beep(max_beep_count, true);
@ -9248,8 +9240,6 @@ inline void gcode_M503() {
*/ */
inline void gcode_M600() { inline void gcode_M600() {
ensure_safe_temperature();
// Initial retract before move to filament change position // Initial retract before move to filament change position
const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0 const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
#if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0 #if defined(PAUSE_PARK_RETRACT_LENGTH) && PAUSE_PARK_RETRACT_LENGTH > 0