Browse Source

Save and restore feedrate in probe functions

Scott Lahteine 9 years ago
parent
commit
d3a05de96e
1 changed files with 17 additions and 7 deletions
  1. 17
    7
      Marlin/Marlin_main.cpp

+ 17
- 7
Marlin/Marlin_main.cpp View File

@@ -1667,6 +1667,8 @@ static void setup_for_endstop_move() {
1667 1667
 
1668 1668
   static void run_z_probe() {
1669 1669
 
1670
+    float old_feedrate = feedrate;
1671
+
1670 1672
     /**
1671 1673
      * To prevent stepper_inactive_time from running out and
1672 1674
      * EXTRUDER_RUNOUT_PREVENT from extruding
@@ -1743,6 +1745,8 @@ static void setup_for_endstop_move() {
1743 1745
       #endif
1744 1746
 
1745 1747
     #endif // !DELTA
1748
+
1749
+    feedrate = old_feedrate;
1746 1750
   }
1747 1751
 
1748 1752
   /**
@@ -1750,7 +1754,7 @@ static void setup_for_endstop_move() {
1750 1754
    *  The final current_position may not be the one that was requested
1751 1755
    */
1752 1756
   static void do_blocking_move_to(float x, float y, float z) {
1753
-    float oldFeedRate = feedrate;
1757
+    float old_feedrate = feedrate;
1754 1758
 
1755 1759
     #if ENABLED(DEBUG_LEVELING_FEATURE)
1756 1760
       if (DEBUGGING(LEVELING)) print_xyz("do_blocking_move_to", x, y, z);
@@ -1769,8 +1773,6 @@ static void setup_for_endstop_move() {
1769 1773
       else
1770 1774
         prepare_move_to_destination();     // this will also set_current_to_destination
1771 1775
 
1772
-      stepper.synchronize();
1773
-
1774 1776
     #else
1775 1777
 
1776 1778
       feedrate = homing_feedrate[Z_AXIS];
@@ -1784,11 +1786,12 @@ static void setup_for_endstop_move() {
1784 1786
       current_position[X_AXIS] = x;
1785 1787
       current_position[Y_AXIS] = y;
1786 1788
       line_to_current_position();
1787
-      stepper.synchronize();
1788 1789
 
1789 1790
     #endif
1790 1791
 
1791
-    feedrate = oldFeedRate;
1792
+    stepper.synchronize();
1793
+
1794
+    feedrate = old_feedrate;
1792 1795
   }
1793 1796
 
1794 1797
   inline void do_blocking_move_to_xy(float x, float y) {
@@ -1838,6 +1841,8 @@ static void setup_for_endstop_move() {
1838 1841
       DEPLOY_Z_SERVO();
1839 1842
 
1840 1843
     #elif ENABLED(Z_PROBE_ALLEN_KEY)
1844
+      float old_feedrate = feedrate;
1845
+
1841 1846
       feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE;
1842 1847
 
1843 1848
       // If endstop is already false, the Z probe is deployed
@@ -1890,6 +1895,8 @@ static void setup_for_endstop_move() {
1890 1895
       destination[Y_AXIS] = destination[Y_AXIS] * 0.75;
1891 1896
       prepare_move_to_destination_raw(); // this will also set_current_to_destination
1892 1897
 
1898
+      feedrate = old_feedrate;
1899
+
1893 1900
       stepper.synchronize();
1894 1901
 
1895 1902
       #if ENABLED(Z_MIN_PROBE_ENDSTOP)
@@ -1943,6 +1950,8 @@ static void setup_for_endstop_move() {
1943 1950
 
1944 1951
     #elif ENABLED(Z_PROBE_ALLEN_KEY)
1945 1952
 
1953
+      float old_feedrate = feedrate;
1954
+
1946 1955
       // Move up for safety
1947 1956
       feedrate = Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE;
1948 1957
 
@@ -1983,6 +1992,8 @@ static void setup_for_endstop_move() {
1983 1992
       destination[Y_AXIS] = 0;
1984 1993
       prepare_move_to_destination_raw(); // this will also set_current_to_destination
1985 1994
 
1995
+      feedrate = old_feedrate;
1996
+
1986 1997
       stepper.synchronize();
1987 1998
 
1988 1999
       #if ENABLED(Z_MIN_PROBE_ENDSTOP)
@@ -3829,9 +3840,8 @@ inline void gcode_G28() {
3829 3840
       // TODO: clear the leveling matrix or the planner will be set incorrectly
3830 3841
       setup_for_endstop_move(); // Too late. Must be done before deploying.
3831 3842
 
3832
-      feedrate = homing_feedrate[Z_AXIS];
3833
-
3834 3843
       run_z_probe();
3844
+
3835 3845
       SERIAL_PROTOCOLPGM("Bed X: ");
3836 3846
       SERIAL_PROTOCOL(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER + 0.0001);
3837 3847
       SERIAL_PROTOCOLPGM(" Y: ");

Loading…
Cancel
Save