Browse Source

Add a optional feedrate parameter to `do_blocking_move()`

Add a optional feedrate parameter to `do_blocking_move()` and its companions.
AnHardt 9 years ago
parent
commit
7d063c111c
1 changed files with 11 additions and 11 deletions
  1. 11
    11
      Marlin/Marlin_main.cpp

+ 11
- 11
Marlin/Marlin_main.cpp View File

@@ -1651,7 +1651,7 @@ static void clean_up_after_endstop_or_probe_move() {
1651 1651
    *  Plan a move to (X, Y, Z) and set the current_position
1652 1652
    *  The final current_position may not be the one that was requested
1653 1653
    */
1654
-  static void do_blocking_move_to(float x, float y, float z) {
1654
+  static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0) {
1655 1655
     float old_feedrate = feedrate;
1656 1656
 
1657 1657
     #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -1660,7 +1660,7 @@ static void clean_up_after_endstop_or_probe_move() {
1660 1660
 
1661 1661
     #if ENABLED(DELTA)
1662 1662
 
1663
-      feedrate = XY_PROBE_FEEDRATE;
1663
+      feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
1664 1664
 
1665 1665
       destination[X_AXIS] = x;
1666 1666
       destination[Y_AXIS] = y;
@@ -1675,19 +1675,19 @@ static void clean_up_after_endstop_or_probe_move() {
1675 1675
 
1676 1676
       // If Z needs to raise, do it before moving XY
1677 1677
       if (current_position[Z_AXIS] < z) {
1678
-        feedrate = homing_feedrate[Z_AXIS];
1678
+        feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
1679 1679
         current_position[Z_AXIS] = z;
1680 1680
         line_to_current_position();
1681 1681
       }
1682 1682
 
1683
-      feedrate = XY_PROBE_FEEDRATE;
1683
+      feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
1684 1684
       current_position[X_AXIS] = x;
1685 1685
       current_position[Y_AXIS] = y;
1686 1686
       line_to_current_position();
1687 1687
 
1688 1688
       // If Z needs to lower, do it after moving XY
1689 1689
       if (current_position[Z_AXIS] > z) {
1690
-        feedrate = homing_feedrate[Z_AXIS];
1690
+        feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
1691 1691
         current_position[Z_AXIS] = z;
1692 1692
         line_to_current_position();
1693 1693
       }
@@ -1699,12 +1699,12 @@ static void clean_up_after_endstop_or_probe_move() {
1699 1699
     feedrate = old_feedrate;
1700 1700
   }
1701 1701
 
1702
-  inline void do_blocking_move_to_x(float x) {
1703
-    do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS]);
1702
+  inline void do_blocking_move_to_x(float x, float feed_rate = 0.0) {
1703
+    do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate);
1704 1704
   }
1705 1705
 
1706
-  inline void do_blocking_move_to_z(float z) {
1707
-    do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z);
1706
+  inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1707
+    do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
1708 1708
   }
1709 1709
 
1710 1710
   /**
@@ -2081,8 +2081,8 @@ static void clean_up_after_endstop_or_probe_move() {
2081 2081
     return current_position[Z_AXIS];
2082 2082
   }
2083 2083
 
2084
-  inline void do_blocking_move_to_xy(float x, float y) {
2085
-    do_blocking_move_to(x, y, current_position[Z_AXIS]);
2084
+  inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
2085
+    do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
2086 2086
   }
2087 2087
 
2088 2088
   //

Loading…
Cancel
Save