Browse Source

Don't do_probe_raise with MIN_Z_HEIGHT_FOR_HOMING

Scott Lahteine 9 years ago
parent
commit
e0a6b978f5
1 changed files with 19 additions and 27 deletions
  1. 19
    27
      Marlin/Marlin_main.cpp

+ 19
- 27
Marlin/Marlin_main.cpp View File

@@ -1728,9 +1728,8 @@ static void clean_up_after_endstop_or_probe_move() {
1728 1728
     if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
1729 1729
       z_dest -= zprobe_zoffset;
1730 1730
 
1731
-    if (z_dest > current_position[Z_AXIS]) {
1731
+    if (z_dest > current_position[Z_AXIS])
1732 1732
       do_blocking_move_to_z(z_dest);
1733
-    }
1734 1733
   }
1735 1734
 
1736 1735
 #endif //HAS_BED_PROBE
@@ -2860,6 +2859,8 @@ inline void gcode_G28() {
2860 2859
 
2861 2860
     home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
2862 2861
 
2862
+    set_destination_to_current();
2863
+
2863 2864
     #if Z_HOME_DIR > 0  // If homing away from BED do Z first
2864 2865
 
2865 2866
       if (home_all_axis || homeZ) {
@@ -2871,34 +2872,25 @@ inline void gcode_G28() {
2871 2872
 
2872 2873
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2873 2874
 
2875
+      // Raise Z before homing any other axes and z is not already high enough (never lower z)
2876
+      float z_dest = (current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING);
2877
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
2878
+        if (DEBUGGING(LEVELING)) {
2879
+          SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
2880
+          SERIAL_EOL;
2881
+        }
2882
+      #endif
2883
+
2884
+      feedrate = homing_feedrate[Z_AXIS];
2885
+
2874 2886
       #if HAS_BED_PROBE
2875
-        do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
2876
-        destination[Z_AXIS] = current_position[Z_AXIS];
2887
+        do_blocking_move_to_z(z_dest);
2877 2888
       #else
2878
-        // Raise Z before homing any other axes and z is not already high enough (never lower z)
2879
-        if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
2880
-          destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
2881
-          feedrate = planner.max_feedrate[Z_AXIS] * 60;  // feedrate (mm/m) = max_feedrate (mm/s)
2882
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
2883
-            if (DEBUGGING(LEVELING)) {
2884
-              SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
2885
-              SERIAL_EOL;
2886
-              DEBUG_POS("> (home_all_axis || homeZ)", current_position);
2887
-              DEBUG_POS("> (home_all_axis || homeZ)", destination);
2888
-            }
2889
-          #endif
2890
-          line_to_destination();
2891
-          stepper.synchronize();
2892
-
2893
-          /**
2894
-           * Update the current Z position even if it currently not real from
2895
-           * Z-home otherwise each call to line_to_destination() will want to
2896
-           * move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
2897
-           */
2898
-          current_position[Z_AXIS] = destination[Z_AXIS];
2899
-        }
2889
+        line_to_z(z_dest);
2890
+        stepper.synchronize();
2900 2891
       #endif
2901
-    #endif
2892
+
2893
+    #endif // MIN_Z_HEIGHT_FOR_HOMING
2902 2894
 
2903 2895
     #if ENABLED(QUICK_HOME)
2904 2896
 

Loading…
Cancel
Save