diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 24eb89115..9a7c29094 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4887,52 +4887,69 @@ inline void gcode_M503() { #ifdef FILAMENTCHANGEENABLE /** - * M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] + * M600: Pause for filament change + * + * E[distance] - Retract the filament this far (negative value) + * Z[distance] - Move the Z axis by this distance + * X[position] - Move to this X position, with Y + * Y[position] - Move to this Y position, with X + * L[distance] - Retract distance for removal (manual reload) + * + * Default values are used for omitted arguments. + * */ inline void gcode_M600() { - float target[NUM_AXIS], lastpos[NUM_AXIS], fr60 = feedrate / 60; + + if (degHotend(active_extruder) < extrude_min_temp) { + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600); + return; + } + + float lastpos[NUM_AXIS], fr60 = feedrate / 60; + for (int i=0; i= next_tick) { + lcd_quick_feedback(); + next_tick = ms + 2500; // feedback every 2.5s while waiting + } manage_heater(); manage_inactivity(true); lcd_update(); @@ -4959,6 +4980,7 @@ inline void gcode_M503() { st_synchronize(); #endif } // while(!lcd_clicked) + lcd_quick_feedback(); // click sound feedback #ifdef AUTO_FILAMENT_CHANGE current_position[E_AXIS]= 0; @@ -4966,12 +4988,12 @@ inline void gcode_M503() { #endif //return to normal - if (code_seen('L')) target[E_AXIS] -= code_value(); + if (code_seen('L')) destination[E_AXIS] -= code_value(); #ifdef FILAMENTCHANGE_FINALRETRACT - else target[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT; + else destination[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT; #endif - current_position[E_AXIS] = target[E_AXIS]; //the long retract of L is compensated by manual filament feeding + current_position[E_AXIS] = destination[E_AXIS]; //the long retract of L is compensated by manual filament feeding plan_set_e_position(current_position[E_AXIS]); RUNPLAN; //should do nothing @@ -4979,13 +5001,19 @@ inline void gcode_M503() { lcd_reset_alert_level(); #ifdef DELTA + // Move XYZ to starting position, then E calculate_delta(lastpos); - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xyz back - plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder); + plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); #else - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xy back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move z back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract + // Move XY to starting position, then Z, then E + destination[X_AXIS] = lastpos[X_AXIS]; + destination[Y_AXIS] = lastpos[Y_AXIS]; + line_to_destination(); + destination[Z_AXIS] = lastpos[Z_AXIS]; + line_to_destination(); + destination[E_AXIS] = lastpos[E_AXIS]; + line_to_destination(); #endif #ifdef FILAMENT_RUNOUT_SENSOR diff --git a/Marlin/configurator/config/language.h b/Marlin/configurator/config/language.h index 5f3d790c5..f83a0d9a1 100644 --- a/Marlin/configurator/config/language.h +++ b/Marlin/configurator/config/language.h @@ -170,6 +170,7 @@ #define MSG_ENDSTOPS_HIT "endstops hit: " #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" +#define MSG_TOO_COLD_FOR_M600 "M600 Hotend too cold to change filament" #define MSG_BABYSTEPPING_X "Babystepping X" #define MSG_BABYSTEPPING_Y "Babystepping Y" #define MSG_BABYSTEPPING_Z "Babystepping Z" diff --git a/Marlin/language.h b/Marlin/language.h index eb20a5b92..140525270 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -171,6 +171,7 @@ #define MSG_ENDSTOPS_HIT "endstops hit: " #define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented" #define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented" +#define MSG_TOO_COLD_FOR_M600 "M600 Hotend too cold to change filament" #define MSG_BABYSTEPPING_X "Babystepping X" #define MSG_BABYSTEPPING_Y "Babystepping Y" #define MSG_BABYSTEPPING_Z "Babystepping Z"