Quellcode durchsuchen

Adjust final Z after bilinear G29

Scott Lahteine vor 8 Jahren
Ursprung
Commit
18e40de39c
1 geänderte Dateien mit 18 neuen und 2 gelöschten Zeilen
  1. 18
    2
      Marlin/Marlin_main.cpp

+ 18
- 2
Marlin/Marlin_main.cpp Datei anzeigen

@@ -3818,7 +3818,7 @@ inline void gcode_G28() {
3818 3818
         // 1. Get the distance from the current position to the reference point.
3819 3819
         float x_dist = RAW_CURRENT_POSITION(X_AXIS) - X_TILT_FULCRUM,
3820 3820
               y_dist = RAW_CURRENT_POSITION(Y_AXIS) - Y_TILT_FULCRUM,
3821
-              z_real = RAW_CURRENT_POSITION(Z_AXIS),
3821
+              z_real = current_position[Z_AXIS],
3822 3822
               z_zero = 0;
3823 3823
 
3824 3824
         #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -3853,7 +3853,7 @@ inline void gcode_G28() {
3853 3853
         // 5. The rotated XY and corrected Z are now current_position
3854 3854
         current_position[X_AXIS] = LOGICAL_X_POSITION(x_dist) + X_TILT_FULCRUM;
3855 3855
         current_position[Y_AXIS] = LOGICAL_Y_POSITION(y_dist) + Y_TILT_FULCRUM;
3856
-        current_position[Z_AXIS] = LOGICAL_Z_POSITION(new_z);
3856
+        current_position[Z_AXIS] = new_z;
3857 3857
 
3858 3858
         SYNC_PLAN_POSITION_KINEMATIC();
3859 3859
 
@@ -3862,6 +3862,22 @@ inline void gcode_G28() {
3862 3862
         #endif
3863 3863
       }
3864 3864
 
3865
+    #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
3866
+
3867
+      if (!dryrun) {
3868
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3869
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("G29 uncorrected Z:", current_position[Z_AXIS]);
3870
+        #endif
3871
+
3872
+        current_position[Z_AXIS] -= bilinear_z_offset(current_position);
3873
+
3874
+        SYNC_PLAN_POSITION_KINEMATIC();
3875
+
3876
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
3877
+          if (DEBUGGING(LEVELING)) SERIAL_ECHOPAIR("G29 corrected Z:", current_position[Z_AXIS]);
3878
+        #endif
3879
+      }
3880
+
3865 3881
     #endif // ABL_PLANAR
3866 3882
 
3867 3883
     #ifdef Z_PROBE_END_SCRIPT

Laden…
Abbrechen
Speichern