mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-28 14:24:34 +00:00
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
|
#ifdef FILAMENTCHANGEENABLE
|
||||||
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
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 target[NUM_AXIS], lastpos[NUM_AXIS], fr60 = feedrate/60;
|
||||||
float lastpos[4];
|
for (int i=0; i<NUM_AXIS; i++)
|
||||||
target[X_AXIS]=current_position[X_AXIS];
|
target[i] = lastpos[i] = current_position[i];
|
||||||
target[Y_AXIS]=current_position[Y_AXIS];
|
|
||||||
target[Z_AXIS]=current_position[Z_AXIS];
|
#define BASICPLAN plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], fr60, active_extruder);
|
||||||
target[E_AXIS]=current_position[E_AXIS];
|
#ifdef DELTA
|
||||||
lastpos[X_AXIS]=current_position[X_AXIS];
|
#define RUNPLAN calculate_delta(target); BASICPLAN
|
||||||
lastpos[Y_AXIS]=current_position[Y_AXIS];
|
#else
|
||||||
lastpos[Z_AXIS]=current_position[Z_AXIS];
|
#define RUNPLAN BASICPLAN
|
||||||
lastpos[E_AXIS]=current_position[E_AXIS];
|
#endif
|
||||||
|
|
||||||
//retract by E
|
//retract by E
|
||||||
if(code_seen('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 ;
|
target[E_AXIS]+= FILAMENTCHANGE_FIRSTRETRACT ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
RUNPLAN;
|
||||||
|
|
||||||
//lift Z
|
//lift Z
|
||||||
if(code_seen('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 ;
|
target[Z_AXIS]+= FILAMENTCHANGE_ZADD ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
RUNPLAN;
|
||||||
|
|
||||||
//move xy
|
//move xy
|
||||||
if(code_seen('X'))
|
if(code_seen('X'))
|
||||||
{
|
{
|
||||||
target[X_AXIS]+= code_value();
|
target[X_AXIS]= code_value();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3656,7 +3657,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
|||||||
#endif
|
#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'))
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder);
|
RUNPLAN;
|
||||||
|
|
||||||
//finish moves
|
//finish moves
|
||||||
st_synchronize();
|
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
|
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_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
|
RUNPLAN; //should do nothing
|
||||||
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
|
#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;
|
break;
|
||||||
#endif //FILAMENTCHANGEENABLE
|
#endif //FILAMENTCHANGEENABLE
|
||||||
|
Loading…
Reference in New Issue
Block a user