Browse Source

Apply MIN_Z_HEIGHT_FOR_HOMING raise literally

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

+ 19
- 14
Marlin/Marlin_main.cpp View File

@@ -2915,22 +2915,27 @@ inline void gcode_G28() {
2915 2915
     #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2916 2916
 
2917 2917
       // Raise Z before homing, if specified
2918
-      destination[Z_AXIS] = (current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING);
2919
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
2920
-        if (DEBUGGING(LEVELING)) {
2921
-          SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
2922
-          SERIAL_EOL;
2923
-        }
2924
-      #endif
2918
+      float z_dest = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
2919
+      if (z_dest > current_position[Z_AXIS]) {
2925 2920
 
2926
-      feedrate = homing_feedrate[Z_AXIS];
2921
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
2922
+          if (DEBUGGING(LEVELING)) {
2923
+            SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
2924
+            SERIAL_EOL;
2925
+          }
2926
+        #endif
2927 2927
 
2928
-      #if HAS_BED_PROBE
2929
-        do_blocking_move_to_z(destination[Z_AXIS]);
2930
-      #else
2931
-        line_to_z(destination[Z_AXIS]);
2932
-        stepper.synchronize();
2933
-      #endif
2928
+        feedrate = homing_feedrate[Z_AXIS];
2929
+
2930
+        #if HAS_BED_PROBE
2931
+          do_blocking_move_to_z(z_dest);
2932
+        #else
2933
+          line_to_z(z_dest);
2934
+          stepper.synchronize();
2935
+        #endif
2936
+
2937
+        destination[Z_AXIS] = current_position[Z_AXIS] = z_dest;
2938
+      }
2934 2939
 
2935 2940
     #endif // MIN_Z_HEIGHT_FOR_HOMING
2936 2941
 

Loading…
Cancel
Save