From 6a35ab6557f8450845379c90724dc14b55be4b0c Mon Sep 17 00:00:00 2001 From: Marcio T Date: Sat, 14 Oct 2023 22:54:54 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Z=5FPROBE=5FERROR=5FTOLERANCE=20(ex?= =?UTF-8?q?pose)=20(#26229)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 8 +++++++- Marlin/src/module/probe.cpp | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 821f34cf4c..33810011cf 100644 --- a/Marlin/Configuration.h +++ b/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 diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 6d45a6c309..2706ca5070 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/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 diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 989965d6d8..deeb53942b 100644 --- a/Marlin/src/module/probe.cpp +++ b/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, ", ...)");