Pārlūkot izejas kodu

Add Z_PROBE_LOW_POINT to prevent damage

Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
8b8ad14178

+ 2
- 0
Marlin/Configuration.h Parādīt failu

@@ -777,6 +777,8 @@
777 777
 #define Z_CLEARANCE_BETWEEN_PROBES  5 // Z Clearance between probe points
778 778
 //#define Z_AFTER_PROBING           5 // Z position after probing is done
779 779
 
780
+#define Z_PROBE_LOW_POINT          -2 // Farthest distance below the trigger-point to go before stopping
781
+
780 782
 // For M851 give a range for adjusting the Z probe offset
781 783
 #define Z_PROBE_OFFSET_RANGE_MIN -20
782 784
 #define Z_PROBE_OFFSET_RANGE_MAX 20

+ 2
- 0
Marlin/src/config/default/Configuration.h Parādīt failu

@@ -777,6 +777,8 @@
777 777
 #define Z_CLEARANCE_BETWEEN_PROBES  5 // Z Clearance between probe points
778 778
 //#define Z_AFTER_PROBING           5 // Z position after probing is done
779 779
 
780
+#define Z_PROBE_LOW_POINT          -2 // Farthest distance below the trigger-point to go before stopping
781
+
780 782
 // For M851 give a range for adjusting the Z probe offset
781 783
 #define Z_PROBE_OFFSET_RANGE_MIN -20
782 784
 #define Z_PROBE_OFFSET_RANGE_MAX 20

+ 1
- 1
Marlin/src/gcode/calibrate/G33.cpp Parādīt failu

@@ -137,7 +137,7 @@ static void G33_cleanup(
137 137
 
138 138
 inline float calibration_probe(const float nx, const float ny, const bool stow) {
139 139
   #if HAS_BED_PROBE
140
-    return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
140
+    return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true);
141 141
   #else
142 142
     UNUSED(stow);
143 143
     return lcd_probe_pt(nx, ny);

+ 4
- 0
Marlin/src/inc/SanityCheck.h Parādīt failu

@@ -780,6 +780,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
780 780
     #error "MULTIPLE_PROBING must be >= 2."
781 781
   #endif
782 782
 
783
+  #if Z_PROBE_LOW_POINT > 0
784
+    #error "Z_PROBE_LOW_POINT must be less than or equal to 0."
785
+  #endif
786
+
783 787
 #else
784 788
 
785 789
   /**

+ 28
- 7
Marlin/src/module/probe.cpp Parādīt failu

@@ -539,17 +539,34 @@ static bool do_probe_move(const float z, const float fr_mm_m) {
539 539
  *
540 540
  * @return The raw Z position where the probe was triggered
541 541
  */
542
-static float run_z_probe() {
542
+#define HAS_CALIBRATION_PROBE (ENABLED(DELTA_AUTO_CALIBRATION) && Z_PROBE_LOW_POINT < 0)
543
+static float run_z_probe(
544
+  #if HAS_CALIBRATION_PROBE
545
+    const bool is_calibration
546
+  #endif
547
+) {
543 548
 
544 549
   #if ENABLED(DEBUG_LEVELING_FEATURE)
545 550
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
546 551
   #endif
547 552
 
553
+  #if Z_PROBE_LOW_POINT < 0
554
+    // Stop the probe before it goes too low to prevent damage.
555
+    // If Z isn't known or this is a "calibration probe" then probe to -10mm.
556
+    #if !HAS_CALIBRATION_PROBE
557
+      constexpr bool is_calibration = false;
558
+    #endif
559
+    const float z_probe_low_point = !is_calibration && axis_known_position[Z_AXIS] ? -zprobe_zoffset + Z_PROBE_LOW_POINT : -10.0;
560
+  #else
561
+    // Assertively move down in all cases
562
+    constexpr float z_probe_low_point = -10.0;
563
+  #endif
564
+
548 565
   // Double-probing does a fast probe followed by a slow probe
549 566
   #if MULTIPLE_PROBING == 2
550 567
 
551 568
     // Do a first probe at the fast speed
552
-    if (do_probe_move(-10, Z_PROBE_SPEED_FAST)) return NAN;
569
+    if (do_probe_move(z_probe_low_point, Z_PROBE_SPEED_FAST)) return NAN;
553 570
 
554 571
     float first_probe_z = current_position[Z_AXIS];
555 572
 
@@ -580,7 +597,7 @@ static float run_z_probe() {
580 597
   #endif
581 598
 
582 599
       // Move down slowly to find bed, not too far
583
-      if (do_probe_move(-10, Z_PROBE_SPEED_SLOW)) return NAN;
600
+      if (do_probe_move(z_probe_low_point, Z_PROBE_SPEED_SLOW)) return NAN;
584 601
 
585 602
   #if MULTIPLE_PROBING > 2
586 603
       probes_total += current_position[Z_AXIS];
@@ -628,14 +645,14 @@ static float run_z_probe() {
628 645
  *   - Raise to the BETWEEN height
629 646
  * - Return the probed Z position
630 647
  */
631
-float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/) {
648
+float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool is_calibration/*=false*/) {
632 649
   #if ENABLED(DEBUG_LEVELING_FEATURE)
633 650
     if (DEBUGGING(LEVELING)) {
634 651
       SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx));
635 652
       SERIAL_ECHOPAIR(", ", LOGICAL_Y_POSITION(ry));
636 653
       SERIAL_ECHOPAIR(", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none");
637 654
       SERIAL_ECHOPAIR(", ", int(verbose_level));
638
-      SERIAL_ECHOPAIR(", ", probe_relative ? "probe" : "nozzle");
655
+      SERIAL_ECHOPAIR(", ", is_calibration ? "nozzle" : "probe");
639 656
       SERIAL_ECHOLNPGM("_relative)");
640 657
       DEBUG_POS("", current_position);
641 658
     }
@@ -643,7 +660,7 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
643 660
 
644 661
   // TODO: Adapt for SCARA, where the offset rotates
645 662
   float nx = rx, ny = ry;
646
-  if (probe_relative) {
663
+  if (!is_calibration) {
647 664
     if (!position_is_reachable_by_probe(rx, ry)) return NAN;  // The given position is in terms of the probe
648 665
     nx -= (X_PROBE_OFFSET_FROM_EXTRUDER);                     // Get the nozzle position
649 666
     ny -= (Y_PROBE_OFFSET_FROM_EXTRUDER);
@@ -667,7 +684,11 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
667 684
 
668 685
   float measured_z = NAN;
669 686
   if (!DEPLOY_PROBE()) {
670
-    measured_z = run_z_probe() + zprobe_zoffset;
687
+    measured_z = run_z_probe(
688
+      #if HAS_CALIBRATION_PROBE
689
+        is_calibration
690
+      #endif
691
+    ) + zprobe_zoffset;
671 692
 
672 693
     if (raise_after == PROBE_PT_RAISE)
673 694
       do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));

+ 1
- 1
Marlin/src/module/probe.h Parādīt failu

@@ -40,7 +40,7 @@
40 40
     PROBE_PT_STOW,  // Do a complete stow after run_z_probe
41 41
     PROBE_PT_RAISE  // Raise to "between" clearance after run_z_probe
42 42
   };
43
-  float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool probe_relative=true);
43
+  float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after=PROBE_PT_NONE, const uint8_t verbose_level=0, const bool is_calibration=false);
44 44
   #define DEPLOY_PROBE() set_probe_deployed(true)
45 45
   #define STOW_PROBE() set_probe_deployed(false)
46 46
 #else

Notiek ielāde…
Atcelt
Saglabāt