|
@@ -2741,6 +2741,8 @@ static void homeaxis(AxisEnum axis) {
|
2741
|
2741
|
|
2742
|
2742
|
void retract(bool retracting, bool swapping = false) {
|
2743
|
2743
|
|
|
2744
|
+ static float hop_height;
|
|
2745
|
+
|
2744
|
2746
|
if (retracting == retracted[active_extruder]) return;
|
2745
|
2747
|
|
2746
|
2748
|
float old_feedrate_mm_s = feedrate_mm_s;
|
|
@@ -2755,14 +2757,19 @@ static void homeaxis(AxisEnum axis) {
|
2755
|
2757
|
prepare_move_to_destination();
|
2756
|
2758
|
|
2757
|
2759
|
if (retract_zlift > 0.01) {
|
|
2760
|
+ hop_height = current_position[Z_AXIS];
|
|
2761
|
+ // Pretend current position is lower
|
2758
|
2762
|
current_position[Z_AXIS] -= retract_zlift;
|
2759
|
2763
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
2764
|
+ // Raise up to the old current_position
|
2760
|
2765
|
prepare_move_to_destination();
|
2761
|
2766
|
}
|
2762
|
2767
|
}
|
2763
|
2768
|
else {
|
2764
|
2769
|
|
2765
|
|
- if (retract_zlift > 0.01) {
|
|
2770
|
+ // If the height hasn't been altered, undo the Z hop
|
|
2771
|
+ if (retract_zlift > 0.01 && hop_height == current_position[Z_AXIS]) {
|
|
2772
|
+ // Pretend current position is higher. Z will lower on the next move
|
2766
|
2773
|
current_position[Z_AXIS] += retract_zlift;
|
2767
|
2774
|
SYNC_PLAN_POSITION_KINEMATIC();
|
2768
|
2775
|
}
|
|
@@ -2771,6 +2778,8 @@ static void homeaxis(AxisEnum axis) {
|
2771
|
2778
|
float move_e = swapping ? retract_length_swap + retract_recover_length_swap : retract_length + retract_recover_length;
|
2772
|
2779
|
current_position[E_AXIS] -= move_e / volumetric_multiplier[active_extruder];
|
2773
|
2780
|
sync_plan_position_e();
|
|
2781
|
+
|
|
2782
|
+ // Lower Z and recover E
|
2774
|
2783
|
prepare_move_to_destination();
|
2775
|
2784
|
}
|
2776
|
2785
|
|