Browse Source

MBL Z adjustment on toolchange

Scott Lahteine 9 years ago
parent
commit
4b93989a77
1 changed files with 7 additions and 9 deletions
  1. 7
    9
      Marlin/Marlin_main.cpp

+ 7
- 9
Marlin/Marlin_main.cpp View File

@@ -6748,17 +6748,15 @@ inline void gcode_T(uint8_t tmp_extruder) {
6748 6748
             }
6749 6749
           #endif
6750 6750
 
6751
-        #else // !AUTO_BED_LEVELING_FEATURE
6752
-
6753
-          // The newly-selected extruder is actually at...
6754
-          for (int i=X_AXIS; i<=Y_AXIS; i++) {
6755
-            float diff = hotend_offset[i][tmp_extruder] - hotend_offset[i][active_extruder];
6756
-            current_position[i] += diff;
6757
-            position_shift[i] += diff; // Offset the coordinate space
6758
-            update_software_endstops((AxisEnum)i);
6751
+        #elif ENABLED(MESH_BED_LEVELING)
6752
+
6753
+          if (mbl.active()) {
6754
+            float xpos = current_position[X_AXIS] - home_offset[X_AXIS],
6755
+                  ypos = current_position[Y_AXIS] - home_offset[Y_AXIS];
6756
+            current_position[Z_AXIS] += mbl.get_z(xpos + xydiff[X_AXIS], ypos + xydiff[Y_AXIS]) - mbl.get_z(xpos, ypos);
6759 6757
           }
6760 6758
 
6761
-        #endif // !AUTO_BED_LEVELING_FEATURE
6759
+        #else // no bed leveling
6762 6760
 
6763 6761
           // The newly-selected extruder XY is actually at...
6764 6762
           current_position[X_AXIS] += xydiff[X_AXIS];

Loading…
Cancel
Save