Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
51e42a2d77
1 muutettua tiedostoa jossa 29 lisäystä ja 3 poistoa
  1. 29
    3
      Marlin/Marlin_main.cpp

+ 29
- 3
Marlin/Marlin_main.cpp Näytä tiedosto

@@ -1866,6 +1866,12 @@ static void clean_up_after_endstop_or_probe_move() {
1866 1866
   #define DEPLOY_PROBE() set_probe_deployed(true)
1867 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 1875
   // returns false for ok and true for failure
1870 1876
   static bool set_probe_deployed(bool deploy) {
1871 1877
 
@@ -1881,9 +1887,9 @@ static void clean_up_after_endstop_or_probe_move() {
1881 1887
     // Make room for probe
1882 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 1891
     #if ENABLED(BLTOUCH)
1886
-      if (TEST_BLTOUCH()) { stop(); return true; }
1892
+      if (deploy && TEST_BLTOUCH()) { stop(); return true; }
1887 1893
     #endif
1888 1894
 
1889 1895
     #if ENABLED(Z_PROBE_SLED)
@@ -1911,7 +1917,7 @@ static void clean_up_after_endstop_or_probe_move() {
1911 1917
 
1912 1918
           dock_sled(!deploy);
1913 1919
 
1914
-        #elif HAS_Z_SERVO_ENDSTOP
1920
+        #elif HAS_Z_SERVO_ENDSTOP && DISABLED(BLTOUCH)
1915 1921
 
1916 1922
           servo[Z_ENDSTOP_SERVO_NR].move(z_servo_angle[deploy ? 0 : 1]);
1917 1923
 
@@ -1948,9 +1954,19 @@ static void clean_up_after_endstop_or_probe_move() {
1948 1954
       if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
1949 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 1962
     // Move down until probe triggered
1952 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 1970
     // Clear endstop flags
1955 1971
     endstops.hit_on_purpose();
1956 1972
 
@@ -2182,11 +2198,21 @@ static void clean_up_after_endstop_or_probe_move() {
2182 2198
  */
2183 2199
 
2184 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 2206
   current_position[axis] = 0;
2186 2207
   sync_plan_position();
2187 2208
   current_position[axis] = where;
2188 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 2210
   stepper.synchronize();
2211
+
2212
+  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
2213
+    set_bltouch_deployed(false);
2214
+  #endif
2215
+
2190 2216
   endstops.hit_on_purpose();
2191 2217
 }
2192 2218
 

Loading…
Peruuta
Tallenna