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