Browse Source

✨ Z_PROBE_ERROR_TOLERANCE (expose) (#26229)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Marcio T 1 year ago
parent
commit
6a35ab6557
3 changed files with 10 additions and 3 deletions
  1. 1 0
      Marlin/Configuration.h
  2. 7 1
      Marlin/src/inc/Conditionals_LCD.h
  3. 2 2
      Marlin/src/module/probe.cpp

+ 1 - 0
Marlin/Configuration.h

@@ -1636,6 +1636,7 @@
 #define Z_CLEARANCE_DEPLOY_PROBE   10 // (mm) Z Clearance for Deploy/Stow
 #define Z_CLEARANCE_BETWEEN_PROBES  5 // (mm) Z Clearance between probe points
 #define Z_CLEARANCE_MULTI_PROBE     5 // (mm) Z Clearance between multiple probes
+#define Z_PROBE_ERROR_TOLERANCE     3 // (mm) Tolerance for early trigger (<= -probe.offset.z + ZPET)
 //#define Z_AFTER_PROBING           5 // (mm) Z position after probing is done
 
 #define Z_PROBE_LOW_POINT          -2 // (mm) Farthest distance below the trigger-point to go before stopping

+ 7 - 1
Marlin/src/inc/Conditionals_LCD.h

@@ -1445,6 +1445,9 @@
   #ifndef Z_CLEARANCE_MULTI_PROBE
     #define Z_CLEARANCE_MULTI_PROBE 5
   #endif
+  #ifndef Z_PROBE_ERROR_TOLERANCE
+    #define Z_PROBE_ERROR_TOLERANCE Z_CLEARANCE_MULTI_PROBE
+  #endif
   #if MULTIPLE_PROBING > 1
     #if EXTRA_PROBING > 0
       #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
@@ -1459,9 +1462,9 @@
   #undef Z_MIN_PROBE_REPEATABILITY_TEST
   #undef HOMING_Z_WITH_PROBE
   #undef Z_CLEARANCE_MULTI_PROBE
+  #undef Z_PROBE_ERROR_TOLERANCE
   #undef MULTIPLE_PROBING
   #undef EXTRA_PROBING
-  #undef Z_CLEARANCE_DEPLOY_PROBE
   #undef Z_PROBE_OFFSET_RANGE_MIN
   #undef Z_PROBE_OFFSET_RANGE_MAX
   #undef PAUSE_BEFORE_DEPLOY_STOW
@@ -1477,6 +1480,9 @@
   #undef NOZZLE_TO_PROBE_OFFSET
 #endif
 
+#ifndef Z_CLEARANCE_DEPLOY_PROBE
+  #define Z_CLEARANCE_DEPLOY_PROBE 10
+#endif
 #ifndef Z_PROBE_LOW_POINT
   #define Z_PROBE_LOW_POINT -5
 #endif

+ 2 - 2
Marlin/src/module/probe.cpp

@@ -735,7 +735,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
  *
  * @param sanity_check Flag to compare the probe result with the expected result
  *                     based on the probe Z offset. If the result is too far away
- *                     (more than 2mm too early) then consider it an error.
+ *                     (more than Z_PROBE_ERROR_TOLERANCE too early) then throw an error.
  * @param z_min_point Override the minimum probing height (-2mm), to allow deeper probing.
  * @param z_clearance Z clearance to apply on probe failure.
  *
@@ -747,7 +747,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/, const_float_t z_min_p
   const float zoffs = SUM_TERN(HAS_HOTEND_OFFSET, -offset.z, hotend_offset[active_extruder].z);
 
   auto try_to_probe = [&](PGM_P const plbl, const_float_t z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck) -> bool {
-    constexpr float error_tolerance = 2.0f;
+    constexpr float error_tolerance = Z_PROBE_ERROR_TOLERANCE;
     if (DEBUGGING(LEVELING)) {
       DEBUG_ECHOPGM_P(plbl);
       DEBUG_ECHOLNPGM("> try_to_probe(..., ", z_probe_low_point, ", ", fr_mm_s, ", ...)");