Browse Source

Merge pull request #4314 from AnHardt/use-d_b_m_t-in-g28

Use do_blicking_move_to*() in G28
Scott Lahteine 9 years ago
parent
commit
e563634a25
1 changed files with 9 additions and 22 deletions
  1. 9
    22
      Marlin/Marlin_main.cpp

+ 9
- 22
Marlin/Marlin_main.cpp View File

@@ -1726,6 +1726,10 @@ inline void do_blocking_move_to_y(float y) {
1726 1726
   do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
1727 1727
 }
1728 1728
 
1729
+inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
1730
+  do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
1731
+}
1732
+
1729 1733
 inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1730 1734
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
1731 1735
 }
@@ -2127,10 +2131,6 @@ inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
2127 2131
     return current_position[Z_AXIS];
2128 2132
   }
2129 2133
 
2130
-  inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
2131
-    do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
2132
-  }
2133
-
2134 2134
   //
2135 2135
   // - Move to the given XY
2136 2136
   // - Deploy the probe, if not already deployed
@@ -2902,20 +2902,17 @@ inline void gcode_G28() {
2902 2902
 
2903 2903
       if (home_all_axis || homeX || homeY) {
2904 2904
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
2905
-        float z_dest = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
2906
-        if (z_dest > current_position[Z_AXIS]) {
2905
+        destination[Z_AXIS] = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
2906
+        if (destination[Z_AXIS] > current_position[Z_AXIS]) {
2907 2907
 
2908 2908
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2909 2909
             if (DEBUGGING(LEVELING)) {
2910
-              SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
2910
+              SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
2911 2911
               SERIAL_EOL;
2912 2912
             }
2913 2913
           #endif
2914 2914
 
2915
-          feedrate = homing_feedrate[Z_AXIS];
2916
-          line_to_z(z_dest);
2917
-          stepper.synchronize();
2918
-          destination[Z_AXIS] = current_position[Z_AXIS] = z_dest;
2915
+          do_blocking_move_to_z(destination[Z_AXIS]);
2919 2916
         }
2920 2917
       }
2921 2918
 
@@ -3002,8 +2999,6 @@ inline void gcode_G28() {
3002 2999
             destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER));
3003 3000
             destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height
3004 3001
 
3005
-            feedrate = XY_PROBE_FEEDRATE;
3006
-
3007 3002
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3008 3003
               if (DEBUGGING(LEVELING)) {
3009 3004
                 DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position);
@@ -3012,15 +3007,7 @@ inline void gcode_G28() {
3012 3007
             #endif
3013 3008
 
3014 3009
             // Move in the XY plane
3015
-            line_to_destination();
3016
-            stepper.synchronize();
3017
-
3018
-            /**
3019
-             * Update the current positions for XY, Z is still at least at
3020
-             * MIN_Z_HEIGHT_FOR_HOMING height, no changes there.
3021
-             */
3022
-            current_position[X_AXIS] = destination[X_AXIS];
3023
-            current_position[Y_AXIS] = destination[Y_AXIS];
3010
+            do_blocking_move_to_xy(destination[X_AXIS], destination[Y_AXIS]);
3024 3011
           }
3025 3012
 
3026 3013
           // Let's see if X and Y are homed

Loading…
Cancel
Save