Merge pull request #1461 from thinkyhead/issue_1453_redo
Apply fix for M600 filament change
This commit is contained in:
commit
cc56f36870
|
@ -3598,16 +3598,17 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
#ifdef FILAMENTCHANGEENABLE
|
||||
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
{
|
||||
float target[4];
|
||||
float lastpos[4];
|
||||
target[X_AXIS]=current_position[X_AXIS];
|
||||
target[Y_AXIS]=current_position[Y_AXIS];
|
||||
target[Z_AXIS]=current_position[Z_AXIS];
|
||||
target[E_AXIS]=current_position[E_AXIS];
|
||||
lastpos[X_AXIS]=current_position[X_AXIS];
|
||||
lastpos[Y_AXIS]=current_position[Y_AXIS];
|
||||
lastpos[Z_AXIS]=current_position[Z_AXIS];
|
||||
lastpos[E_AXIS]=current_position[E_AXIS];
|
||||
float target[NUM_AXIS], lastpos[NUM_AXIS], fr60 = feedrate/60;
|
||||
for (int i=0; i<NUM_AXIS; i++)
|
||||
target[i] = lastpos[i] = current_position[i];
|
||||
|
||||
#define BASICPLAN plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder);
|
||||
#ifdef DELTA
|
||||
#define RUNPLAN calculate_delta(target); BASICPLAN
|
||||
#else
|
||||
#define RUNPLAN BASICPLAN
|
||||
#endif
|
||||
|
||||
//retract by E
|
||||
if(code_seen('E'))
|
||||
{
|
||||
|
@ -3619,7 +3620,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
target[E_AXIS]+= FILAMENTCHANGE_FIRSTRETRACT ;
|
||||
#endif
|
||||
}
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
||||
RUNPLAN;
|
||||
|
||||
//lift Z
|
||||
if(code_seen('Z'))
|
||||
|
@ -3632,12 +3633,12 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
target[Z_AXIS]+= FILAMENTCHANGE_ZADD ;
|
||||
#endif
|
||||
}
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
||||
RUNPLAN;
|
||||
|
||||
//move xy
|
||||
if(code_seen('X'))
|
||||
{
|
||||
target[X_AXIS]+= code_value();
|
||||
target[X_AXIS]= code_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3656,7 +3657,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
#endif
|
||||
}
|
||||
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
||||
RUNPLAN;
|
||||
|
||||
if(code_seen('L'))
|
||||
{
|
||||
|
@ -3669,7 +3670,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
#endif
|
||||
}
|
||||
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
||||
RUNPLAN;
|
||||
|
||||
//finish moves
|
||||
st_synchronize();
|
||||
|
@ -3717,10 +3718,18 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||
}
|
||||
current_position[E_AXIS]=target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
|
||||
plan_set_e_position(current_position[E_AXIS]);
|
||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //should do nothing
|
||||
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //move xy back
|
||||
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder); //move z back
|
||||
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder); //final untretract
|
||||
|
||||
RUNPLAN; //should do nothing
|
||||
|
||||
#ifdef DELTA
|
||||
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
|
||||
#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
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif //FILAMENTCHANGEENABLE
|
||||
|
|
Loading…
Reference in a new issue