Merge pull request #3577 from thinkyhead/rc_fix_G92_set_e_twice
Fix G92 setting E twice
This commit is contained in:
commit
cfd10fcba1
|
@ -1427,6 +1427,7 @@ inline void sync_plan_position() {
|
|||
#endif
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
}
|
||||
inline void sync_plan_position_e() { plan_set_e_position(current_position[E_AXIS]); }
|
||||
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
||||
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
||||
|
||||
|
@ -2320,7 +2321,7 @@ static void homeaxis(AxisEnum axis) {
|
|||
|
||||
feedrate = retract_feedrate * 60;
|
||||
current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
|
||||
plan_set_e_position(current_position[E_AXIS]);
|
||||
sync_plan_position_e();
|
||||
prepare_move();
|
||||
|
||||
if (retract_zlift > 0.01) {
|
||||
|
@ -2348,7 +2349,7 @@ static void homeaxis(AxisEnum axis) {
|
|||
feedrate = retract_recover_feedrate * 60;
|
||||
float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
|
||||
current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
|
||||
plan_set_e_position(current_position[E_AXIS]);
|
||||
sync_plan_position_e();
|
||||
prepare_move();
|
||||
}
|
||||
|
||||
|
@ -2439,7 +2440,7 @@ inline void gcode_G0_G1() {
|
|||
// Is this move an attempt to retract or recover?
|
||||
if ((echange < -MIN_RETRACT && !retracted[active_extruder]) || (echange > MIN_RETRACT && retracted[active_extruder])) {
|
||||
current_position[E_AXIS] = destination[E_AXIS]; // hide the slicer-generated retract/recover from calculations
|
||||
plan_set_e_position(current_position[E_AXIS]); // AND from the planner
|
||||
sync_plan_position_e(); // AND from the planner
|
||||
retract(!retracted[active_extruder]);
|
||||
return;
|
||||
}
|
||||
|
@ -3642,8 +3643,9 @@ inline void gcode_G28() {
|
|||
* G92: Set current position to given X Y Z E
|
||||
*/
|
||||
inline void gcode_G92() {
|
||||
if (!code_seen(axis_codes[E_AXIS]))
|
||||
st_synchronize();
|
||||
bool didE = code_seen(axis_codes[E_AXIS]);
|
||||
|
||||
if (!didE) st_synchronize();
|
||||
|
||||
bool didXYZ = false;
|
||||
for (int i = 0; i < NUM_AXIS; i++) {
|
||||
|
@ -3653,12 +3655,9 @@ inline void gcode_G92() {
|
|||
|
||||
current_position[i] = v;
|
||||
|
||||
if (i == E_AXIS)
|
||||
plan_set_e_position(v);
|
||||
else {
|
||||
if (i != E_AXIS) {
|
||||
position_shift[i] += v - p; // Offset the coordinate space
|
||||
update_software_endstops((AxisEnum)i);
|
||||
|
||||
didXYZ = true;
|
||||
}
|
||||
}
|
||||
|
@ -3670,6 +3669,9 @@ inline void gcode_G92() {
|
|||
sync_plan_position();
|
||||
#endif
|
||||
}
|
||||
else if (didE) {
|
||||
sync_plan_position_e();
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
|
@ -6106,7 +6108,7 @@ inline void gcode_M503() {
|
|||
#endif
|
||||
|
||||
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]);
|
||||
sync_plan_position_e();
|
||||
|
||||
RUNPLAN; //should do nothing
|
||||
|
||||
|
|
Loading…
Reference in a new issue