|
@@ -6501,6 +6501,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6501
|
6501
|
return;
|
6502
|
6502
|
}
|
6503
|
6503
|
|
|
6504
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
6505
|
+ if (DEBUGGING(LEVELING)) {
|
|
6506
|
+ SERIAL_ECHOLNPGM(">>> gcode_T");
|
|
6507
|
+ DEBUG_POS("BEFORE", current_position);
|
|
6508
|
+ }
|
|
6509
|
+ #endif
|
|
6510
|
+
|
6504
|
6511
|
#if HOTENDS > 1
|
6505
|
6512
|
|
6506
|
6513
|
float old_feedrate = feedrate;
|
|
@@ -6583,11 +6590,6 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6583
|
6590
|
// Z software endstop. But this is technically correct (and
|
6584
|
6591
|
// there is no viable alternative).
|
6585
|
6592
|
//
|
6586
|
|
- float xydiff[2] = {
|
6587
|
|
- hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
6588
|
|
- hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
6589
|
|
- };
|
6590
|
|
-
|
6591
|
6593
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
6592
|
6594
|
// Offset extruder, make sure to apply the bed level rotation matrix
|
6593
|
6595
|
vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
|
|
@@ -6600,31 +6602,29 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6600
|
6602
|
|
6601
|
6603
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
6602
|
6604
|
if (DEBUGGING(LEVELING)) {
|
6603
|
|
- SERIAL_ECHOLNPGM(">>> gcode_T");
|
6604
|
6605
|
tmp_offset_vec.debug("tmp_offset_vec");
|
6605
|
6606
|
act_offset_vec.debug("act_offset_vec");
|
6606
|
6607
|
offset_vec.debug("offset_vec (BEFORE)");
|
6607
|
|
- DEBUG_POS("BEFORE rotation", current_position);
|
6608
|
6608
|
}
|
6609
|
6609
|
#endif
|
6610
|
6610
|
|
6611
|
6611
|
offset_vec.apply_rotation(planner.bed_level_matrix.transpose(planner.bed_level_matrix));
|
6612
|
6612
|
|
6613
|
|
- // Adjust the current position
|
6614
|
|
- current_position[X_AXIS] += offset_vec.x;
|
6615
|
|
- current_position[Y_AXIS] += offset_vec.y;
|
6616
|
|
- current_position[Z_AXIS] += offset_vec.z;
|
6617
|
|
-
|
6618
|
6613
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
6619
|
|
- if (DEBUGGING(LEVELING)) {
|
6620
|
|
- offset_vec.debug("offset_vec (AFTER)");
|
6621
|
|
- DEBUG_POS("AFTER rotation", current_position);
|
6622
|
|
- SERIAL_ECHOLNPGM("<<< gcode_T");
|
6623
|
|
- }
|
|
6614
|
+ if (DEBUGGING(LEVELING)) offset_vec.debug("offset_vec (AFTER)");
|
6624
|
6615
|
#endif
|
6625
|
6616
|
|
|
6617
|
+ // Adjustments to the current position
|
|
6618
|
+ float xydiff[2] = { offset_vec.x, offset_vec.y };
|
|
6619
|
+ current_position[Z_AXIS] += offset_vec.z;
|
|
6620
|
+
|
6626
|
6621
|
#else // !AUTO_BED_LEVELING_FEATURE
|
6627
|
6622
|
|
|
6623
|
+ float xydiff[2] = {
|
|
6624
|
+ hotend_offset[X_AXIS][tmp_extruder] - hotend_offset[X_AXIS][active_extruder],
|
|
6625
|
+ hotend_offset[Y_AXIS][tmp_extruder] - hotend_offset[Y_AXIS][active_extruder]
|
|
6626
|
+ };
|
|
6627
|
+
|
6628
|
6628
|
#if ENABLED(MESH_BED_LEVELING)
|
6629
|
6629
|
|
6630
|
6630
|
if (mbl.active()) {
|
|
@@ -6635,12 +6635,11 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6635
|
6635
|
|
6636
|
6636
|
#endif // MESH_BED_LEVELING
|
6637
|
6637
|
|
6638
|
|
- // The newly-selected extruder XY is actually at...
|
6639
|
|
- current_position[X_AXIS] += xydiff[X_AXIS];
|
6640
|
|
- current_position[Y_AXIS] += xydiff[Y_AXIS];
|
6641
|
|
-
|
6642
|
6638
|
#endif // !AUTO_BED_LEVELING_FEATURE
|
6643
|
6639
|
|
|
6640
|
+ // The newly-selected extruder XY is actually at...
|
|
6641
|
+ current_position[X_AXIS] += xydiff[X_AXIS];
|
|
6642
|
+ current_position[Y_AXIS] += xydiff[Y_AXIS];
|
6644
|
6643
|
for (uint8_t i = X_AXIS; i <= Y_AXIS; i++) {
|
6645
|
6644
|
position_shift[i] += xydiff[i];
|
6646
|
6645
|
update_software_endstops((AxisEnum)i);
|
|
@@ -6674,6 +6673,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
6674
|
6673
|
|
6675
|
6674
|
#endif
|
6676
|
6675
|
|
|
6676
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
6677
|
+ if (DEBUGGING(LEVELING)) {
|
|
6678
|
+ DEBUG_POS("AFTER", current_position);
|
|
6679
|
+ SERIAL_ECHOLNPGM("<<< gcode_T");
|
|
6680
|
+ }
|
|
6681
|
+ #endif
|
|
6682
|
+
|
6677
|
6683
|
SERIAL_ECHO_START;
|
6678
|
6684
|
SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
|
6679
|
6685
|
SERIAL_PROTOCOLLN((int)active_extruder);
|