@@ -504,9 +504,9 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
504
504
float Probe::run_z_probe (const bool sanity_check/* =true*/ ) {
505
505
DEBUG_SECTION (log_probe, " Probe::run_z_probe" , DEBUGGING (LEVELING));
506
506
507
- auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance ) {
508
- #if ENABLED(FIX_MOUNTED_PROBE)
509
- if ((0 == READ (OPTO_SWITCH_PIN)))
507
+ auto tare_probe = []( bool force ) {
508
+ #if ENABLED(FIX_MOUNTED_PROBE) && PIN_EXISTS(OPTO_SWITCH)
509
+ if ((0 == READ (OPTO_SWITCH_PIN)) || force )
510
510
{
511
511
SERIAL_ECHOLN (" FIX_MOUNTED_PROBE: Taring the probe" );
512
512
WRITE (COM_PIN, HIGH);
@@ -515,6 +515,10 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
515
515
delay (200 );
516
516
}
517
517
#endif
518
+ };
519
+
520
+ auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) {
521
+ tare_probe (/* force: */ false );
518
522
519
523
// Do a first probe at the fast speed
520
524
const bool probe_fail = probe_down_to_z (z_probe_low_point, fr_mm_s), // No probe trigger?
@@ -551,15 +555,21 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
551
555
// Raise to give the probe clearance
552
556
do_blocking_move_to_z (current_position.z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS (Z_PROBE_SPEED_FAST));
553
557
558
+ // Tare probe to reset
559
+ tare_probe (/* force: */ true );
554
560
#elif Z_PROBE_SPEED_FAST != Z_PROBE_SPEED_SLOW
555
561
556
562
// If the nozzle is well over the travel height then
557
563
// move down quickly before doing the slow probe
558
564
const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0 );
559
565
if (current_position.z > z) {
560
566
// Probe down fast. If the probe never triggered, raise for probe clearance
561
- if (!probe_down_to_z (z, MMM_TO_MMS (Z_PROBE_SPEED_FAST)))
567
+ if (!probe_down_to_z (z, MMM_TO_MMS (Z_PROBE_SPEED_FAST))) {
562
568
do_blocking_move_to_z (current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS (Z_PROBE_SPEED_FAST));
569
+
570
+ // Tare probe to reset
571
+ tare_probe (/* force: */ true );
572
+ }
563
573
}
564
574
#endif
565
575
@@ -579,6 +589,8 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
579
589
#endif
580
590
{
581
591
// Probe downward slowly to find the bed
592
+ tare_probe (/* force: */ false );
593
+
582
594
if (try_to_probe (PSTR (" SLOW" ), z_probe_low_point, MMM_TO_MMS (Z_PROBE_SPEED_SLOW),
583
595
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
584
596
@@ -607,7 +619,11 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
607
619
#if EXTRA_PROBING > 0
608
620
< TOTAL_PROBING - 1
609
621
#endif
610
- ) do_blocking_move_to_z (z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS (Z_PROBE_SPEED_FAST));
622
+ ) {
623
+ do_blocking_move_to_z (z + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS (Z_PROBE_SPEED_FAST));
624
+
625
+ tare_probe (/* force: */ true );
626
+ }
611
627
#endif
612
628
}
613
629
0 commit comments