Browse Source

Further cleanup of G28 for probes

AnHardt 9 years ago
parent
commit
e480ee0054
1 changed files with 34 additions and 31 deletions
  1. 34
    31
      Marlin/Marlin_main.cpp

+ 34
- 31
Marlin/Marlin_main.cpp View File

@@ -1713,10 +1713,7 @@ static void clean_up_after_endstop_or_probe_move() {
1713 1713
       z_dest -= zprobe_zoffset;
1714 1714
 
1715 1715
     if (z_dest > current_position[Z_AXIS]) {
1716
-      float old_feedrate = feedrate;
1717
-      feedrate = homing_feedrate[Z_AXIS];
1718 1716
       do_blocking_move_to_z(z_dest);
1719
-      feedrate = old_feedrate;
1720 1717
     }
1721 1718
   }
1722 1719
 
@@ -1795,9 +1792,7 @@ static void clean_up_after_endstop_or_probe_move() {
1795 1792
     if (endstops.z_probe_enabled) return;
1796 1793
 
1797 1794
     // Make room for probe
1798
-    #if _Z_RAISE_PROBE_DEPLOY_STOW > 0
1799
-      do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
1800
-    #endif
1795
+    do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
1801 1796
 
1802 1797
     #if ENABLED(Z_PROBE_SLED)
1803 1798
 
@@ -1899,9 +1894,7 @@ static void clean_up_after_endstop_or_probe_move() {
1899 1894
     if (!endstops.z_probe_enabled) return;
1900 1895
 
1901 1896
     // Make more room for the servo
1902
-    #if _Z_RAISE_PROBE_DEPLOY_STOW > 0
1903
-      do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
1904
-    #endif
1897
+    do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
1905 1898
 
1906 1899
     #if ENABLED(Z_PROBE_SLED)
1907 1900
 
@@ -2839,28 +2832,33 @@ inline void gcode_G28() {
2839 2832
 
2840 2833
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2841 2834
 
2842
-      // Raise Z before homing any other axes and z is not already high enough (never lower z)
2843
-      if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
2844
-        destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
2845
-        feedrate = planner.max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2846
-        #if ENABLED(DEBUG_LEVELING_FEATURE)
2847
-          if (DEBUGGING(LEVELING)) {
2848
-            SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
2849
-            SERIAL_EOL;
2850
-            DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2851
-            DEBUG_POS("> (home_all_axis || homeZ)", destination);
2852
-          }
2853
-        #endif
2854
-        line_to_destination();
2855
-        stepper.synchronize();
2835
+      #if HAS_BED_PROBE
2836
+        do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
2837
+        destination[Z_AXIS] = current_position[Z_AXIS];
2838
+      #else
2839
+        // Raise Z before homing any other axes and z is not already high enough (never lower z)
2840
+        if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
2841
+          destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
2842
+          feedrate = planner.max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2843
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
2844
+            if (DEBUGGING(LEVELING)) {
2845
+              SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
2846
+              SERIAL_EOL;
2847
+              DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2848
+              DEBUG_POS("> (home_all_axis || homeZ)", destination);
2849
+            }
2850
+          #endif
2851
+          line_to_destination();
2852
+          stepper.synchronize();
2856 2853
 
2857
-        /**
2858
-         * Update the current Z position even if it currently not real from
2859
-         * Z-home otherwise each call to line_to_destination() will want to
2860
-         * move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
2861
-         */
2862
-        current_position[Z_AXIS] = destination[Z_AXIS];
2863
-      }
2854
+          /**
2855
+           * Update the current Z position even if it currently not real from
2856
+           * Z-home otherwise each call to line_to_destination() will want to
2857
+           * move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
2858
+           */
2859
+          current_position[Z_AXIS] = destination[Z_AXIS];
2860
+        }
2861
+      #endif
2864 2862
     #endif
2865 2863
 
2866 2864
     #if ENABLED(QUICK_HOME)
@@ -2917,7 +2915,12 @@ inline void gcode_G28() {
2917 2915
 
2918 2916
     #if ENABLED(HOME_Y_BEFORE_X)
2919 2917
       // Home Y
2920
-      if (home_all_axis || homeY) HOMEAXIS(Y);
2918
+      if (home_all_axis || homeY) {
2919
+        HOMEAXIS(Y);
2920
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
2921
+          if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
2922
+        #endif
2923
+      }
2921 2924
     #endif
2922 2925
 
2923 2926
     // Home X

Loading…
Cancel
Save