Browse Source

Generalized probe raise, use for after probing

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

+ 19
- 20
Marlin/Marlin_main.cpp View File

1691
     do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z);
1691
     do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z);
1692
   }
1692
   }
1693
 
1693
 
1694
-  inline void raise_z_after_probing() {
1695
-    #if Z_RAISE_AFTER_PROBING > 0
1696
-      #if ENABLED(DEBUG_LEVELING_FEATURE)
1697
-        if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("raise_z_after_probing()");
1698
-      #endif
1699
-      do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING);
1700
-    #endif
1701
-  }
1702
-#endif //HAS_BED_PROBE
1703
-
1704
-#if HAS_Z_SERVO_ENDSTOP
1705
-
1706
   /**
1694
   /**
1707
-   * Raise Z to a minimum height to make room for a servo to move
1695
+   * Raise Z to a minimum height to make room for a probe to move
1708
    *
1696
    *
1709
    * zprobe_zoffset: Negative of the Z height where the probe engages
1697
    * zprobe_zoffset: Negative of the Z height where the probe engages
1710
-   *         z_dest: The before / after probing raise distance
1698
+   *        z_raise: The probing raise distance
1711
    *
1699
    *
1712
    * The zprobe_zoffset is negative for a switch below the nozzle, so
1700
    * The zprobe_zoffset is negative for a switch below the nozzle, so
1713
    * multiply by Z_HOME_DIR (-1) to move enough away from the bed.
1701
    * multiply by Z_HOME_DIR (-1) to move enough away from the bed.
1714
    */
1702
    */
1715
-  void raise_z_for_servo(float z_dest) {
1716
-    z_dest += home_offset[Z_AXIS];
1703
+  inline void do_probe_raise(float z_raise) {
1704
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
1705
+      if (DEBUGGING(LEVELING)) {
1706
+        SERIAL_ECHOPAIR("do_probe_raise(", z_raise);
1707
+        SERIAL_ECHOLNPGM(")");
1708
+      }
1709
+    #endif
1710
+    float z_dest = home_offset[Z_AXIS] + z_raise;
1717
 
1711
 
1718
     if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
1712
     if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
1719
       z_dest -= zprobe_zoffset;
1713
       z_dest -= zprobe_zoffset;
1720
 
1714
 
1721
     if (z_dest > current_position[Z_AXIS])
1715
     if (z_dest > current_position[Z_AXIS])
1722
-      do_blocking_move_to_z(z_dest); // also updates current_position
1716
+      do_blocking_move_to_z(z_dest);
1723
   }
1717
   }
1724
 
1718
 
1725
-#endif
1719
+  inline void raise_z_after_probing() {
1720
+    #if Z_RAISE_AFTER_PROBING > 0
1721
+      do_probe_raise(Z_RAISE_AFTER_PROBING);
1722
+    #endif
1723
+  }
1724
+#endif //HAS_BED_PROBE
1726
 
1725
 
1727
 #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
1726
 #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
1728
   static void axis_unhomed_error(bool xyz=false) {
1727
   static void axis_unhomed_error(bool xyz=false) {
1801
     #elif HAS_Z_SERVO_ENDSTOP
1800
     #elif HAS_Z_SERVO_ENDSTOP
1802
 
1801
 
1803
       // Make room for Z Servo
1802
       // Make room for Z Servo
1804
-      raise_z_for_servo(Z_RAISE_BEFORE_PROBING);
1803
+      do_probe_raise(Z_RAISE_BEFORE_PROBING);
1805
 
1804
 
1806
       // Engage Z Servo endstop if enabled
1805
       // Engage Z Servo endstop if enabled
1807
       DEPLOY_Z_SERVO();
1806
       DEPLOY_Z_SERVO();
1903
     #elif HAS_Z_SERVO_ENDSTOP
1902
     #elif HAS_Z_SERVO_ENDSTOP
1904
 
1903
 
1905
       // Make room for the servo
1904
       // Make room for the servo
1906
-      raise_z_for_servo(Z_RAISE_AFTER_PROBING);
1905
+      do_probe_raise(Z_RAISE_AFTER_PROBING);
1907
 
1906
 
1908
       // Change the Z servo angle
1907
       // Change the Z servo angle
1909
       STOW_Z_SERVO();
1908
       STOW_Z_SERVO();

Loading…
Cancel
Save