|
@@ -6684,6 +6684,35 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6684
|
6684
|
}
|
6685
|
6685
|
// No extra case for AUTO_BED_LEVELING_FEATURE in DUAL_X_CARRIAGE. Does that mean they don't work together?
|
6686
|
6686
|
#else // !DUAL_X_CARRIAGE
|
|
6687
|
+
|
|
6688
|
+ //
|
|
6689
|
+ // Set current_position to the position of the new nozzle.
|
|
6690
|
+ // Offsets are based on linear distance, so we need to get
|
|
6691
|
+ // the resulting position in coordinate space.
|
|
6692
|
+ //
|
|
6693
|
+ // - With grid or 3-point leveling, offset XYZ by a tilted vector
|
|
6694
|
+ // - With mesh leveling, update Z for the new position
|
|
6695
|
+ // - Otherwise, just use the raw linear distance
|
|
6696
|
+ //
|
|
6697
|
+ // Software endstops are altered here too. Consider a case where:
|
|
6698
|
+ // E0 at X=0 ... E1 at X=10
|
|
6699
|
+ // When we switch to E1 now X=10, but E1 can't move left.
|
|
6700
|
+ // To express this we apply the change in XY to the software endstops.
|
|
6701
|
+ // E1 can move farther right than E0, so the right limit is extended.
|
|
6702
|
+ //
|
|
6703
|
+ // Note that we don't adjust the Z software endstops. Why not?
|
|
6704
|
+ // Consider a case where Z=0 (here) and switching to E1 makes Z=1
|
|
6705
|
+ // because the bed is 1mm lower at the new position. As long as
|
|
6706
|
+ // the first nozzle is out of the way, the carriage should be
|
|
6707
|
+ // allowed to move 1mm lower. This technically "breaks" the
|
|
6708
|
+ // Z software endstop. But this is technically correct (and
|
|
6709
|
+ // there is no viable alternative).
|
|
6710
|
+ //
|
|
6711
|
+ float xydiff[2] = {
|
|
6712
|
+ hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
|
6713
|
+ hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
|
6714
|
+ };
|
|
6715
|
+
|
6687
|
6716
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
6688
|
6717
|
// Offset extruder, make sure to apply the bed level rotation matrix
|
6689
|
6718
|
vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
|
|
@@ -6731,6 +6760,17 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6731
|
6760
|
|
6732
|
6761
|
#endif // !AUTO_BED_LEVELING_FEATURE
|
6733
|
6762
|
|
|
6763
|
+ // The newly-selected extruder XY is actually at...
|
|
6764
|
+ current_position[X_AXIS] += xydiff[X_AXIS];
|
|
6765
|
+ current_position[Y_AXIS] += xydiff[Y_AXIS];
|
|
6766
|
+
|
|
6767
|
+ #endif // no bed leveling
|
|
6768
|
+
|
|
6769
|
+ for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
|
6770
|
+ position_shift[i] += xydiff[i];
|
|
6771
|
+ update_software_endstops((AxisEnum)i);
|
|
6772
|
+ }
|
|
6773
|
+
|
6734
|
6774
|
// Set the new active extruder
|
6735
|
6775
|
active_extruder = tmp_extruder;
|
6736
|
6776
|
|