@@ -702,29 +702,35 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
702
702
* @details Used by probe_at_point to get the bed Z height at the current XY.
703
703
* Leaves current_position.z at the height where the probe triggered.
704
704
*
705
+ * @param sanity_check Flag to compare the probe result with the expected result
706
+ * based on the probe Z offset. If the result is too far away
707
+ * (more than 2mm too early) then consider it an error.
708
+ *
705
709
* @return The Z position of the bed at the current XY or NAN on error.
706
710
*/
707
711
float Probe::run_z_probe (const bool sanity_check/* =true*/ ) {
708
712
DEBUG_SECTION (log_probe, " Probe::run_z_probe" , DEBUGGING (LEVELING));
709
713
710
714
const float zoffs = SUM_TERN (HAS_HOTEND_OFFSET, -offset.z , hotend_offset[active_extruder].z );
711
715
712
- auto try_to_probe = [&](PGM_P const plbl, const_float_t z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) -> bool {
713
- if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" try_to_probe(..., " , z_probe_low_point, " , " , fr_mm_s, " , " , scheck, " , " , clearance);
716
+ 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 {
717
+ constexpr float error_tolerance = 2 .0f ;
718
+ if (DEBUGGING (LEVELING)) {
719
+ DEBUG_ECHOPGM_P (plbl);
720
+ DEBUG_ECHOLNPGM (" > try_to_probe(..., " , z_probe_low_point, " , " , fr_mm_s, " , ...)" );
721
+ }
714
722
715
723
// Tare the probe, if supported
716
724
if (TERN0 (PROBE_TARE, tare ())) return true ;
717
725
718
726
// Do a first probe at the fast speed
719
- const bool probe_fail = probe_down_to_z (z_probe_low_point, fr_mm_s), // No probe trigger?
720
- early_fail = (scheck && current_position.z > zoffs + clearance); // Probe triggered too high?
727
+ const bool probe_fail = probe_down_to_z (z_probe_low_point, fr_mm_s), // No probe trigger?
728
+ early_fail = (scheck && current_position.z > zoffs + error_tolerance); // Probe triggered too high?
721
729
#if ENABLED(DEBUG_LEVELING_FEATURE)
722
730
if (DEBUGGING (LEVELING) && (probe_fail || early_fail)) {
723
- DEBUG_ECHOPGM_P (plbl);
724
- DEBUG_ECHOPGM (" Probe fail! -" );
725
- if (probe_fail) DEBUG_ECHOPGM (" No trigger." );
726
- if (early_fail) DEBUG_ECHOPGM (" Triggered early." );
727
- DEBUG_EOL ();
731
+ DEBUG_ECHOPGM (" Probe fail! - " );
732
+ if (probe_fail) DEBUG_ECHOLNPGM (" No trigger." );
733
+ if (early_fail) DEBUG_ECHOLNPGM (" Triggered early (above " , zoffs + error_tolerance, " mm)" );
728
734
}
729
735
#else
730
736
UNUSED (plbl);
@@ -733,7 +739,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
733
739
};
734
740
735
741
// Stop the probe before it goes too low to prevent damage.
736
- // If Z isn't known then probe to -10mm.
742
+ // For known Z probe below the expected trigger point, otherwise -10mm.
737
743
const float z_probe_low_point = axis_is_trusted (Z_AXIS) ? zoffs + Z_PROBE_LOW_POINT : -10 .0f ;
738
744
739
745
if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" Probe Low Point: " , z_probe_low_point);
@@ -745,9 +751,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
745
751
if (TERN0 (PROBE_TARE, tare ())) return NAN;
746
752
747
753
// Do a first probe at the fast speed
748
- if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" Fast Probe:" );
749
- if (try_to_probe (PSTR (" FAST" ), z_probe_low_point, z_probe_fast_mm_s,
750
- sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
754
+ if (try_to_probe (PSTR (" FAST" ), z_probe_low_point, z_probe_fast_mm_s, sanity_check)) return NAN;
751
755
752
756
const float z1 = DIFF_TERN (HAS_DELTA_SENSORLESS_PROBING, current_position.z , largest_sensorless_adj);
753
757
if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" 1st Probe Z:" , z1);
@@ -787,8 +791,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
787
791
788
792
// Probe downward slowly to find the bed
789
793
if (DEBUGGING (LEVELING)) DEBUG_ECHOLNPGM (" Slow Probe:" );
790
- if (try_to_probe (PSTR (" SLOW" ), z_probe_low_point, MMM_TO_MMS (Z_PROBE_FEEDRATE_SLOW),
791
- sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
794
+ if (try_to_probe (PSTR (" SLOW" ), z_probe_low_point, MMM_TO_MMS (Z_PROBE_FEEDRATE_SLOW), sanity_check)) return NAN;
792
795
793
796
TERN_ (MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe ());
794
797
0 commit comments