|
@@ -4887,52 +4887,69 @@ inline void gcode_M503() {
|
4887
|
4887
|
#ifdef FILAMENTCHANGEENABLE
|
4888
|
4888
|
|
4889
|
4889
|
/**
|
4890
|
|
- * M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
|
4890
|
+ * M600: Pause for filament change
|
|
4891
|
+ *
|
|
4892
|
+ * E[distance] - Retract the filament this far (negative value)
|
|
4893
|
+ * Z[distance] - Move the Z axis by this distance
|
|
4894
|
+ * X[position] - Move to this X position, with Y
|
|
4895
|
+ * Y[position] - Move to this Y position, with X
|
|
4896
|
+ * L[distance] - Retract distance for removal (manual reload)
|
|
4897
|
+ *
|
|
4898
|
+ * Default values are used for omitted arguments.
|
|
4899
|
+ *
|
4891
|
4900
|
*/
|
4892
|
4901
|
inline void gcode_M600() {
|
4893
|
|
- float target[NUM_AXIS], lastpos[NUM_AXIS], fr60 = feedrate / 60;
|
|
4902
|
+
|
|
4903
|
+ if (degHotend(active_extruder) < extrude_min_temp) {
|
|
4904
|
+ SERIAL_ERROR_START;
|
|
4905
|
+ SERIAL_ERRORLNPGM(MSG_TOO_COLD_FOR_M600);
|
|
4906
|
+ return;
|
|
4907
|
+ }
|
|
4908
|
+
|
|
4909
|
+ float lastpos[NUM_AXIS], fr60 = feedrate / 60;
|
|
4910
|
+
|
4894
|
4911
|
for (int i=0; i<NUM_AXIS; i++)
|
4895
|
|
- target[i] = lastpos[i] = current_position[i];
|
|
4912
|
+ lastpos[i] = destination[i] = current_position[i];
|
4896
|
4913
|
|
4897
|
|
- #define BASICPLAN plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder);
|
4898
|
4914
|
#ifdef DELTA
|
4899
|
|
- #define RUNPLAN calculate_delta(target); BASICPLAN
|
|
4915
|
+ #define RUNPLAN calculate_delta(destination); \
|
|
4916
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
4900
|
4917
|
#else
|
4901
|
|
- #define RUNPLAN BASICPLAN
|
|
4918
|
+ #define RUNPLAN line_to_destination();
|
4902
|
4919
|
#endif
|
4903
|
4920
|
|
4904
|
4921
|
//retract by E
|
4905
|
|
- if (code_seen('E')) target[E_AXIS] += code_value();
|
|
4922
|
+ if (code_seen('E')) destination[E_AXIS] += code_value();
|
4906
|
4923
|
#ifdef FILAMENTCHANGE_FIRSTRETRACT
|
4907
|
|
- else target[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
|
|
4924
|
+ else destination[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
|
4908
|
4925
|
#endif
|
4909
|
4926
|
|
4910
|
4927
|
RUNPLAN;
|
4911
|
4928
|
|
4912
|
4929
|
//lift Z
|
4913
|
|
- if (code_seen('Z')) target[Z_AXIS] += code_value();
|
|
4930
|
+ if (code_seen('Z')) destination[Z_AXIS] += code_value();
|
4914
|
4931
|
#ifdef FILAMENTCHANGE_ZADD
|
4915
|
|
- else target[Z_AXIS] += FILAMENTCHANGE_ZADD;
|
|
4932
|
+ else destination[Z_AXIS] += FILAMENTCHANGE_ZADD;
|
4916
|
4933
|
#endif
|
4917
|
4934
|
|
4918
|
4935
|
RUNPLAN;
|
4919
|
4936
|
|
4920
|
4937
|
//move xy
|
4921
|
|
- if (code_seen('X')) target[X_AXIS] = code_value();
|
|
4938
|
+ if (code_seen('X')) destination[X_AXIS] = code_value();
|
4922
|
4939
|
#ifdef FILAMENTCHANGE_XPOS
|
4923
|
|
- else target[X_AXIS] = FILAMENTCHANGE_XPOS;
|
|
4940
|
+ else destination[X_AXIS] = FILAMENTCHANGE_XPOS;
|
4924
|
4941
|
#endif
|
4925
|
4942
|
|
4926
|
|
- if (code_seen('Y')) target[Y_AXIS] = code_value();
|
|
4943
|
+ if (code_seen('Y')) destination[Y_AXIS] = code_value();
|
4927
|
4944
|
#ifdef FILAMENTCHANGE_YPOS
|
4928
|
|
- else target[Y_AXIS] = FILAMENTCHANGE_YPOS;
|
|
4945
|
+ else destination[Y_AXIS] = FILAMENTCHANGE_YPOS;
|
4929
|
4946
|
#endif
|
4930
|
4947
|
|
4931
|
4948
|
RUNPLAN;
|
4932
|
4949
|
|
4933
|
|
- if (code_seen('L')) target[E_AXIS] += code_value();
|
|
4950
|
+ if (code_seen('L')) destination[E_AXIS] += code_value();
|
4934
|
4951
|
#ifdef FILAMENTCHANGE_FINALRETRACT
|
4935
|
|
- else target[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
|
|
4952
|
+ else destination[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
|
4936
|
4953
|
#endif
|
4937
|
4954
|
|
4938
|
4955
|
RUNPLAN;
|
|
@@ -4946,10 +4963,14 @@ inline void gcode_M503() {
|
4946
|
4963
|
disable_e3();
|
4947
|
4964
|
delay(100);
|
4948
|
4965
|
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
|
4949
|
|
- uint8_t cnt = 0;
|
|
4966
|
+ millis_t next_tick = 0;
|
4950
|
4967
|
while (!lcd_clicked()) {
|
4951
|
4968
|
#ifndef AUTO_FILAMENT_CHANGE
|
4952
|
|
- if (++cnt == 0) lcd_quick_feedback(); // every 256th frame till the lcd is clicked
|
|
4969
|
+ millis_t ms = millis();
|
|
4970
|
+ if (ms >= next_tick) {
|
|
4971
|
+ lcd_quick_feedback();
|
|
4972
|
+ next_tick = ms + 2500; // feedback every 2.5s while waiting
|
|
4973
|
+ }
|
4953
|
4974
|
manage_heater();
|
4954
|
4975
|
manage_inactivity(true);
|
4955
|
4976
|
lcd_update();
|
|
@@ -4959,6 +4980,7 @@ inline void gcode_M503() {
|
4959
|
4980
|
st_synchronize();
|
4960
|
4981
|
#endif
|
4961
|
4982
|
} // while(!lcd_clicked)
|
|
4983
|
+ lcd_quick_feedback(); // click sound feedback
|
4962
|
4984
|
|
4963
|
4985
|
#ifdef AUTO_FILAMENT_CHANGE
|
4964
|
4986
|
current_position[E_AXIS]= 0;
|
|
@@ -4966,12 +4988,12 @@ inline void gcode_M503() {
|
4966
|
4988
|
#endif
|
4967
|
4989
|
|
4968
|
4990
|
//return to normal
|
4969
|
|
- if (code_seen('L')) target[E_AXIS] -= code_value();
|
|
4991
|
+ if (code_seen('L')) destination[E_AXIS] -= code_value();
|
4970
|
4992
|
#ifdef FILAMENTCHANGE_FINALRETRACT
|
4971
|
|
- else target[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
|
|
4993
|
+ else destination[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
|
4972
|
4994
|
#endif
|
4973
|
4995
|
|
4974
|
|
- current_position[E_AXIS] = target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
|
|
4996
|
+ current_position[E_AXIS] = destination[E_AXIS]; //the long retract of L is compensated by manual filament feeding
|
4975
|
4997
|
plan_set_e_position(current_position[E_AXIS]);
|
4976
|
4998
|
|
4977
|
4999
|
RUNPLAN; //should do nothing
|
|
@@ -4979,13 +5001,19 @@ inline void gcode_M503() {
|
4979
|
5001
|
lcd_reset_alert_level();
|
4980
|
5002
|
|
4981
|
5003
|
#ifdef DELTA
|
|
5004
|
+ // Move XYZ to starting position, then E
|
4982
|
5005
|
calculate_delta(lastpos);
|
4983
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xyz back
|
4984
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
|
|
5006
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
5007
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
|
4985
|
5008
|
#else
|
4986
|
|
- plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move xy back
|
4987
|
|
- plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move z back
|
4988
|
|
- plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
|
|
5009
|
+ // Move XY to starting position, then Z, then E
|
|
5010
|
+ destination[X_AXIS] = lastpos[X_AXIS];
|
|
5011
|
+ destination[Y_AXIS] = lastpos[Y_AXIS];
|
|
5012
|
+ line_to_destination();
|
|
5013
|
+ destination[Z_AXIS] = lastpos[Z_AXIS];
|
|
5014
|
+ line_to_destination();
|
|
5015
|
+ destination[E_AXIS] = lastpos[E_AXIS];
|
|
5016
|
+ line_to_destination();
|
4989
|
5017
|
#endif
|
4990
|
5018
|
|
4991
|
5019
|
#ifdef FILAMENT_RUNOUT_SENSOR
|