Преглед изворни кода

Use do_blicking_move_to*() in G28

AnHardt пре 9 година
родитељ
комит
46994fd17d
1 измењених фајлова са 9 додато и 22 уклоњено
  1. 9
    22
      Marlin/Marlin_main.cpp

+ 9
- 22
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -1709,6 +1709,10 @@ inline void do_blocking_move_to_y(float y) {
1709 1709
   do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
1710 1710
 }
1711 1711
 
1712
+inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
1713
+  do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
1714
+}
1715
+
1712 1716
 inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1713 1717
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
1714 1718
 }
@@ -2110,10 +2114,6 @@ inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
2110 2114
     return current_position[Z_AXIS];
2111 2115
   }
2112 2116
 
2113
-  inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
2114
-    do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
2115
-  }
2116
-
2117 2117
   //
2118 2118
   // - Move to the given XY
2119 2119
   // - Deploy the probe, if not already deployed
@@ -2885,20 +2885,17 @@ inline void gcode_G28() {
2885 2885
 
2886 2886
       if (home_all_axis || homeX || homeY) {
2887 2887
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
2888
-        float z_dest = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
2889
-        if (z_dest > current_position[Z_AXIS]) {
2888
+        destination[Z_AXIS] = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
2889
+        if (destination[Z_AXIS] > current_position[Z_AXIS]) {
2890 2890
 
2891 2891
           #if ENABLED(DEBUG_LEVELING_FEATURE)
2892 2892
             if (DEBUGGING(LEVELING)) {
2893
-              SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
2893
+              SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
2894 2894
               SERIAL_EOL;
2895 2895
             }
2896 2896
           #endif
2897 2897
 
2898
-          feedrate = homing_feedrate[Z_AXIS];
2899
-          line_to_z(z_dest);
2900
-          stepper.synchronize();
2901
-          destination[Z_AXIS] = current_position[Z_AXIS] = z_dest;
2898
+          do_blocking_move_to_z(destination[Z_AXIS]);
2902 2899
         }
2903 2900
       }
2904 2901
 
@@ -2985,8 +2982,6 @@ inline void gcode_G28() {
2985 2982
             destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2986 2983
             destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height
2987 2984
 
2988
-            feedrate = XY_PROBE_FEEDRATE;
2989
-
2990 2985
             #if ENABLED(DEBUG_LEVELING_FEATURE)
2991 2986
               if (DEBUGGING(LEVELING)) {
2992 2987
                 DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position);
@@ -2995,15 +2990,7 @@ inline void gcode_G28() {
2995 2990
             #endif
2996 2991
 
2997 2992
             // Move in the XY plane
2998
-            line_to_destination();
2999
-            stepper.synchronize();
3000
-
3001
-            /**
3002
-             * Update the current positions for XY, Z is still at least at
3003
-             * MIN_Z_HEIGHT_FOR_HOMING height, no changes there.
3004
-             */
3005
-            current_position[X_AXIS] = destination[X_AXIS];
3006
-            current_position[Y_AXIS] = destination[Y_AXIS];
2993
+            do_blocking_move_to_xy(destination[X_AXIS], destination[Y_AXIS]);
3007 2994
           }
3008 2995
 
3009 2996
           // Let's see if X and Y are homed

Loading…
Откажи
Сачувај