소스 검색

Patch G30 to use raise_z_for_servo (PR#73)

Scott Lahteine 9 년 전
부모
커밋
e3b1e08777
1개의 변경된 파일23개의 추가작업 그리고 10개의 파일을 삭제
  1. 23
    10
      Marlin/Marlin_main.cpp

+ 23
- 10
Marlin/Marlin_main.cpp 파일 보기

@@ -1594,6 +1594,16 @@ static void setup_for_endstop_move() {
1594 1594
 
1595 1595
   #endif // DELTA
1596 1596
 
1597
+  #if HAS_SERVO_ENDSTOPS && DISABLED(Z_PROBE_SLED)
1598
+
1599
+    void raise_z_for_servo() {
1600
+      float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING;
1601
+      z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos;
1602
+      if (zpos < z_dest) do_blocking_move_to_z(z_dest); // also updates current_position
1603
+    }
1604
+
1605
+  #endif
1606
+
1597 1607
 #endif // ENABLE_AUTO_BED_LEVELING
1598 1608
 
1599 1609
 
@@ -2796,10 +2806,17 @@ inline void gcode_G28() {
2796 2806
 
2797 2807
   #if DISABLED(Z_PROBE_SLED)
2798 2808
 
2809
+    /**
2810
+     * G30: Do a single Z probe at the current XY
2811
+     */
2799 2812
     inline void gcode_G30() {
2813
+      #if HAS_SERVO_ENDSTOPS
2814
+        raise_z_for_servo();
2815
+      #endif
2800 2816
       deploy_z_probe(); // Engage Z Servo endstop if available
2817
+
2801 2818
       st_synchronize();
2802
-      // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
2819
+      // TODO: clear the leveling matrix or the planner will be set incorrectly
2803 2820
       setup_for_endstop_move();
2804 2821
 
2805 2822
       feedrate = homing_feedrate[Z_AXIS];
@@ -2814,7 +2831,11 @@ inline void gcode_G28() {
2814 2831
       SERIAL_EOL;
2815 2832
 
2816 2833
       clean_up_after_endstop_move();
2817
-      stow_z_probe(); // Retract Z Servo endstop if available
2834
+
2835
+      #if HAS_SERVO_ENDSTOPS
2836
+        raise_z_for_servo();
2837
+      #endif
2838
+      stow_z_probe(false); // Retract Z Servo endstop if available
2818 2839
     }
2819 2840
 
2820 2841
   #endif //!Z_PROBE_SLED
@@ -4567,14 +4588,6 @@ inline void gcode_M400() { st_synchronize(); }
4567 4588
 
4568 4589
 #if ENABLED(ENABLE_AUTO_BED_LEVELING) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY))
4569 4590
 
4570
-  #if HAS_SERVO_ENDSTOPS
4571
-    void raise_z_for_servo() {
4572
-      float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING;
4573
-      z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos;
4574
-      if (zpos < z_dest) do_blocking_move_to_z(z_dest); // also updates current_position
4575
-    }
4576
-  #endif
4577
-
4578 4591
   /**
4579 4592
    * M401: Engage Z Servo endstop if available
4580 4593
    */

Loading…
취소
저장