Browse Source

Improve probe logging

Scott Lahteine 6 years ago
parent
commit
b90f54b0fc
1 changed files with 29 additions and 11 deletions
  1. 29
    11
      Marlin/src/module/probe.cpp

+ 29
- 11
Marlin/src/module/probe.cpp View File

@@ -554,7 +554,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
554 554
  *
555 555
  * @return The raw Z position where the probe was triggered
556 556
  */
557
-  static float run_z_probe() {
557
+static float run_z_probe() {
558 558
 
559 559
   #if ENABLED(DEBUG_LEVELING_FEATURE)
560 560
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
@@ -568,7 +568,15 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
568 568
   #if MULTIPLE_PROBING == 2
569 569
 
570 570
     // Do a first probe at the fast speed
571
-    if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) return NAN;
571
+    if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) {
572
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
573
+        if (DEBUGGING(LEVELING)) {
574
+          SERIAL_ECHOLNPGM("FAST Probe fail!");
575
+          DEBUG_POS("<<< run_z_probe", current_position);
576
+        }
577
+      #endif
578
+      return NAN;
579
+    }
572 580
 
573 581
     float first_probe_z = current_position[Z_AXIS];
574 582
 
@@ -598,8 +606,16 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
598 606
     for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
599 607
   #endif
600 608
 
601
-      // Move down slowly to find bed, not too far
602
-      if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) return NAN;
609
+      // move down slowly to find bed
610
+      if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
611
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
612
+          if (DEBUGGING(LEVELING)) {
613
+            SERIAL_ECHOLNPGM("SLOW Probe fail!");
614
+            DEBUG_POS("<<< run_z_probe", current_position);
615
+          }
616
+        #endif
617
+        return NAN;
618
+      }
603 619
 
604 620
   #if MULTIPLE_PROBING > 2
605 621
       probes_total += current_position[Z_AXIS];
@@ -610,7 +626,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
610 626
   #if MULTIPLE_PROBING > 2
611 627
 
612 628
     // Return the average value of all probes
613
-    return probes_total * (1.0 / (MULTIPLE_PROBING));
629
+    const float measured_z = probes_total * (1.0 / (MULTIPLE_PROBING));
614 630
 
615 631
   #elif MULTIPLE_PROBING == 2
616 632
 
@@ -624,18 +640,20 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
624 640
     #endif
625 641
 
626 642
     // Return a weighted average of the fast and slow probes
627
-    return (z2 * 3.0 + first_probe_z * 2.0) * 0.2;
643
+    const float measured_z = (z2 * 3.0 + first_probe_z * 2.0) * 0.2;
628 644
 
629 645
   #else
630 646
 
631 647
     // Return the single probe result
632
-    return current_position[Z_AXIS];
648
+    const float measured_z = current_position[Z_AXIS];
633 649
 
634 650
   #endif
635 651
 
636 652
   #if ENABLED(DEBUG_LEVELING_FEATURE)
637 653
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
638 654
   #endif
655
+
656
+  return measured_z;
639 657
 }
640 658
 
641 659
 /**
@@ -705,10 +723,6 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
705 723
     SERIAL_EOL();
706 724
   }
707 725
 
708
-  #if ENABLED(DEBUG_LEVELING_FEATURE)
709
-    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt");
710
-  #endif
711
-
712 726
   feedrate_mm_s = old_feedrate_mm_s;
713 727
 
714 728
   if (isnan(measured_z)) {
@@ -717,6 +731,10 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/
717 731
     SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
718 732
   }
719 733
 
734
+  #if ENABLED(DEBUG_LEVELING_FEATURE)
735
+    if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt");
736
+  #endif
737
+
720 738
   return measured_z;
721 739
 }
722 740
 

Loading…
Cancel
Save