Browse Source

Adjust BLTouch probe behavior

Addressing #4855
- Have the pin deploy only immediately before probing
- Have the pin retract immediately after every probe
Scott Lahteine 8 years ago
parent
commit
51e42a2d77
1 changed files with 29 additions and 3 deletions
  1. 29
    3
      Marlin/Marlin_main.cpp

+ 29
- 3
Marlin/Marlin_main.cpp View File

1866
   #define DEPLOY_PROBE() set_probe_deployed(true)
1866
   #define DEPLOY_PROBE() set_probe_deployed(true)
1867
   #define STOW_PROBE() set_probe_deployed(false)
1867
   #define STOW_PROBE() set_probe_deployed(false)
1868
 
1868
 
1869
+  #if ENABLED(BLTOUCH)
1870
+    FORCE_INLINE void set_bltouch_deployed(const bool &deploy) {
1871
+      servo[Z_ENDSTOP_SERVO_NR].move(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW);
1872
+    }
1873
+  #endif
1874
+
1869
   // returns false for ok and true for failure
1875
   // returns false for ok and true for failure
1870
   static bool set_probe_deployed(bool deploy) {
1876
   static bool set_probe_deployed(bool deploy) {
1871
 
1877
 
1881
     // Make room for probe
1887
     // Make room for probe
1882
     do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT);
1888
     do_probe_raise(_Z_PROBE_DEPLOY_HEIGHT);
1883
 
1889
 
1884
-    // Check BLTOUCH probe status for an error
1890
+    // When deploying make sure BLTOUCH is not already triggered
1885
     #if ENABLED(BLTOUCH)
1891
     #if ENABLED(BLTOUCH)
1886
-      if (TEST_BLTOUCH()) { stop(); return true; }
1892
+      if (deploy && TEST_BLTOUCH()) { stop(); return true; }
1887
     #endif
1893
     #endif
1888
 
1894
 
1889
     #if ENABLED(Z_PROBE_SLED)
1895
     #if ENABLED(Z_PROBE_SLED)
1911
 
1917
 
1912
           dock_sled(!deploy);
1918
           dock_sled(!deploy);
1913
 
1919
 
1914
-        #elif HAS_Z_SERVO_ENDSTOP
1920
+        #elif HAS_Z_SERVO_ENDSTOP && DISABLED(BLTOUCH)
1915
 
1921
 
1916
           servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[deploy ? 0 : 1]);
1922
           servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[deploy ? 0 : 1]);
1917
 
1923
 
1948
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
1954
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
1949
     #endif
1955
     #endif
1950
 
1956
 
1957
+    // Deploy BLTouch at the start of any probe
1958
+    #if ENABLED(BLTOUCH)
1959
+      set_bltouch_deployed(true);
1960
+    #endif
1961
+
1951
     // Move down until probe triggered
1962
     // Move down until probe triggered
1952
     do_blocking_move_to_z(LOGICAL_Z_POSITION(z), MMM_TO_MMS(fr_mm_m));
1963
     do_blocking_move_to_z(LOGICAL_Z_POSITION(z), MMM_TO_MMS(fr_mm_m));
1953
 
1964
 
1965
+    // Retract BLTouch immediately after a probe
1966
+    #if ENABLED(BLTOUCH)
1967
+      set_bltouch_deployed(false);
1968
+    #endif
1969
+
1954
     // Clear endstop flags
1970
     // Clear endstop flags
1955
     endstops.hit_on_purpose();
1971
     endstops.hit_on_purpose();
1956
 
1972
 
2182
  */
2198
  */
2183
 
2199
 
2184
 static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
2200
 static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
2201
+
2202
+  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
2203
+    set_bltouch_deployed(true);
2204
+  #endif
2205
+
2185
   current_position[axis] = 0;
2206
   current_position[axis] = 0;
2186
   sync_plan_position();
2207
   sync_plan_position();
2187
   current_position[axis] = where;
2208
   current_position[axis] = where;
2188
   planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], (fr_mm_s != 0.0) ? fr_mm_s : homing_feedrate_mm_s[axis], active_extruder);
2209
   planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], (fr_mm_s != 0.0) ? fr_mm_s : homing_feedrate_mm_s[axis], active_extruder);
2189
   stepper.synchronize();
2210
   stepper.synchronize();
2211
+
2212
+  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
2213
+    set_bltouch_deployed(false);
2214
+  #endif
2215
+
2190
   endstops.hit_on_purpose();
2216
   endstops.hit_on_purpose();
2191
 }
2217
 }
2192
 
2218
 

Loading…
Cancel
Save