Browse Source

Patch G30 to use raise_z_for_servo (PR#73)

Scott Lahteine 9 years ago
parent
commit
e3b1e08777
1 changed files with 23 additions and 10 deletions
  1. 23
    10
      Marlin/Marlin_main.cpp

+ 23
- 10
Marlin/Marlin_main.cpp View File

1594
 
1594
 
1595
   #endif // DELTA
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
 #endif // ENABLE_AUTO_BED_LEVELING
1607
 #endif // ENABLE_AUTO_BED_LEVELING
1598
 
1608
 
1599
 
1609
 
2796
 
2806
 
2797
   #if DISABLED(Z_PROBE_SLED)
2807
   #if DISABLED(Z_PROBE_SLED)
2798
 
2808
 
2809
+    /**
2810
+     * G30: Do a single Z probe at the current XY
2811
+     */
2799
     inline void gcode_G30() {
2812
     inline void gcode_G30() {
2813
+      #if HAS_SERVO_ENDSTOPS
2814
+        raise_z_for_servo();
2815
+      #endif
2800
       deploy_z_probe(); // Engage Z Servo endstop if available
2816
       deploy_z_probe(); // Engage Z Servo endstop if available
2817
+
2801
       st_synchronize();
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
       setup_for_endstop_move();
2820
       setup_for_endstop_move();
2804
 
2821
 
2805
       feedrate = homing_feedrate[Z_AXIS];
2822
       feedrate = homing_feedrate[Z_AXIS];
2814
       SERIAL_EOL;
2831
       SERIAL_EOL;
2815
 
2832
 
2816
       clean_up_after_endstop_move();
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
   #endif //!Z_PROBE_SLED
2841
   #endif //!Z_PROBE_SLED
4567
 
4588
 
4568
 #if ENABLED(ENABLE_AUTO_BED_LEVELING) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY))
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
    * M401: Engage Z Servo endstop if available
4592
    * M401: Engage Z Servo endstop if available
4580
    */
4593
    */

Loading…
Cancel
Save