Skip to content

Commit

Permalink
Ensure safe temperature for M600
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 4, 2017
1 parent ea74ceb commit d878450
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
24 changes: 22 additions & 2 deletions Marlin/Marlin_main.cpp
Expand Up @@ -5921,6 +5921,25 @@ 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;

This comment has been minimized.

Copy link
@tcm0116

tcm0116 Jun 5, 2017

Contributor

Per my comment on #6407, I think we need to add if (!wait_for_heatup) break; here after the call to idle() to allow M108 to abort the heatup.

This comment has been minimized.

Copy link
@thinkyhead

thinkyhead Feb 6, 2018

Author Member

That would only break out one loop early.

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);

This comment has been minimized.

Copy link
@tcm0116

tcm0116 Jun 5, 2017

Contributor

In the original code, the LCD functions were independent of the temperature control functions to allow pause_print and resume_print to work on a printer without an LCD. Moving the call to lcd_advanced_pause_show_message to within ensure_safe_temperature, which only gets called if ULTIPANEL is enabled, will cause the call to ensure_safe_temperature to not be make if there is no LCD. This can be avoided by moving the #if ENABLED(ULTIPANEL) from resume_print to ensure_safe_temperature.

did_show = true;
}
break;
}
}
}
}

static void wait_for_filament_reload(int8_t max_beep_count = 0) {
bool nozzle_timed_out = false;

Expand All @@ -5937,8 +5956,7 @@ inline void gcode_M17() {
nozzle_timed_out |= thermalManager.is_heater_idle(e);

#if ENABLED(ULTIPANEL)
if (nozzle_timed_out)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
if (nozzle_timed_out) ensure_safe_temperature();

This comment has been minimized.

Copy link
@tcm0116

tcm0116 Jun 5, 2017

Contributor

This change won't work. The purpose of this function is to wait for the user to click the encoder before heating the extruder, which is why it showed the ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE message and not the ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT message, which is shown in ensure_safe_temperature.

#endif

idle(true);
Expand Down Expand Up @@ -9204,6 +9222,8 @@ inline void gcode_M503() {
*/
inline void gcode_M600() {

ensure_safe_temperature();

This comment has been minimized.

Copy link
@tcm0116

tcm0116 Jun 5, 2017

Contributor

It would make more sense if this call to ensure_safe_temperature was in pause_print within the if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) statement.


// 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
Expand Down
4 changes: 3 additions & 1 deletion Marlin/ultralcd.cpp
Expand Up @@ -1094,6 +1094,7 @@ void kill_screen(const char* lcd_msg) {
#endif

#if ENABLED(ADVANCED_PAUSE_FEATURE)

void lcd_enqueue_filament_change() {
if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder)) {
lcd_save_previous_screen();
Expand All @@ -1103,7 +1104,8 @@ void kill_screen(const char* lcd_msg) {
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
enqueue_and_echo_commands_P(PSTR("M600 B0"));
}
#endif

#endif // ADVANCED_PAUSE_FEATURE

/**
*
Expand Down

0 comments on commit d878450

Please sign in to comment.