Browse Source

Better probe fail handling (#16811)

InsanityAutomation 5 years ago
parent
commit
84b6e11bd5
No account linked to committer's email address
2 changed files with 24 additions and 14 deletions
  1. 2
    1
      Marlin/src/feature/bltouch.h
  2. 22
    13
      Marlin/src/module/probe.cpp

+ 2
- 1
Marlin/src/feature/bltouch.h View File

91
   FORCE_INLINE static void mode_conv_5V()        { mode_conv_proc(true); }
91
   FORCE_INLINE static void mode_conv_5V()        { mode_conv_proc(true); }
92
   FORCE_INLINE static void mode_conv_OD()        { mode_conv_proc(false); }
92
   FORCE_INLINE static void mode_conv_OD()        { mode_conv_proc(false); }
93
 
93
 
94
+  static bool triggered();
95
+
94
 private:
96
 private:
95
   FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
97
   FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
96
   FORCE_INLINE static bool _stow_query_alarm()   { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
98
   FORCE_INLINE static bool _stow_query_alarm()   { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
97
 
99
 
98
   static void clear();
100
   static void clear();
99
   static bool command(const BLTCommand cmd, const millis_t &ms);
101
   static bool command(const BLTCommand cmd, const millis_t &ms);
100
-  static bool triggered();
101
   static bool deploy_proc();
102
   static bool deploy_proc();
102
   static bool stow_proc();
103
   static bool stow_proc();
103
   static bool status_proc();
104
   static bool status_proc();

+ 22
- 13
Marlin/src/module/probe.cpp View File

571
   #if TOTAL_PROBING == 2
571
   #if TOTAL_PROBING == 2
572
 
572
 
573
     // Do a first probe at the fast speed
573
     // Do a first probe at the fast speed
574
-    if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) {
574
+    if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))         // No probe trigger?
575
+      || current_position.z > -offset.z + _MAX(Z_CLEARANCE_BETWEEN_PROBES, 4) / 2  // Probe triggered too high?
576
+    ) {
575
       if (DEBUGGING(LEVELING)) {
577
       if (DEBUGGING(LEVELING)) {
576
         DEBUG_ECHOLNPGM("FAST Probe fail!");
578
         DEBUG_ECHOLNPGM("FAST Probe fail!");
577
         DEBUG_POS("<<< run_z_probe", current_position);
579
         DEBUG_POS("<<< run_z_probe", current_position);
614
   #endif
616
   #endif
615
     {
617
     {
616
       // Probe downward slowly to find the bed
618
       // Probe downward slowly to find the bed
617
-      if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
619
+      if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))      // No probe trigger?
620
+        || current_position.z > -offset.z + _MAX(Z_CLEARANCE_MULTI_PROBE, 4) / 2  // Probe triggered too high?
621
+      ) {
618
         if (DEBUGGING(LEVELING)) {
622
         if (DEBUGGING(LEVELING)) {
619
           DEBUG_ECHOLNPGM("SLOW Probe fail!");
623
           DEBUG_ECHOLNPGM("SLOW Probe fail!");
620
           DEBUG_POS("<<< run_z_probe", current_position);
624
           DEBUG_POS("<<< run_z_probe", current_position);
716
     DEBUG_POS("", current_position);
720
     DEBUG_POS("", current_position);
717
   }
721
   }
718
 
722
 
723
+  #if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
724
+    if (bltouch.triggered()) bltouch._reset();
725
+  #endif
726
+
719
   // TODO: Adapt for SCARA, where the offset rotates
727
   // TODO: Adapt for SCARA, where the offset rotates
720
   xyz_pos_t npos = { rx, ry };
728
   xyz_pos_t npos = { rx, ry };
721
   if (probe_relative) {                                     // The given position is in terms of the probe
729
   if (probe_relative) {                                     // The given position is in terms of the probe
743
   do_blocking_move_to(npos);
751
   do_blocking_move_to(npos);
744
 
752
 
745
   float measured_z = NAN;
753
   float measured_z = NAN;
746
-  if (!deploy()) {
747
-    measured_z = run_z_probe() + offset.z;
748
-
754
+  if (!deploy()) measured_z = run_z_probe() + offset.z;
755
+  if (!isnan(measured_z)) {
749
     const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
756
     const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
750
-    if (big_raise || raise_after == PROBE_PT_RAISE)
751
-      do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
757
+    if (big_raise || raise_after == PROBE_PT_RAISE) {
758
+      if (current_position.z < Z_PROBE_OFFSET_RANGE_MAX) // Only raise when in probing range (else error)
759
+        do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
760
+    }
752
     else if (raise_after == PROBE_PT_STOW)
761
     else if (raise_after == PROBE_PT_STOW)
753
-      if (stow()) measured_z = NAN;
754
-  }
762
+      if (stow()) measured_z = NAN;   // Error on stow?
755
 
763
 
756
-  if (verbose_level > 2) {
757
-    SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3);
758
-    SERIAL_ECHOPAIR_F(   " Y: ", LOGICAL_Y_POSITION(ry), 3);
759
-    SERIAL_ECHOLNPAIR_F( " Z: ", measured_z, 3);
764
+    if (verbose_level > 2) {
765
+      SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3);
766
+      SERIAL_ECHOPAIR_F(   " Y: ", LOGICAL_Y_POSITION(ry), 3);
767
+      SERIAL_ECHOLNPAIR_F( " Z: ", measured_z, 3);
768
+    }
760
   }
769
   }
761
 
770
 
762
   feedrate_mm_s = old_feedrate_mm_s;
771
   feedrate_mm_s = old_feedrate_mm_s;

Loading…
Cancel
Save