ソースを参照

Improve probe logging

Scott Lahteine 6年前
コミット
b90f54b0fc
1個のファイルの変更29行の追加11行の削除
  1. 29
    11
      Marlin/src/module/probe.cpp

+ 29
- 11
Marlin/src/module/probe.cpp ファイルの表示

554
  *
554
  *
555
  * @return The raw Z position where the probe was triggered
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
   #if ENABLED(DEBUG_LEVELING_FEATURE)
559
   #if ENABLED(DEBUG_LEVELING_FEATURE)
560
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
560
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position);
568
   #if MULTIPLE_PROBING == 2
568
   #if MULTIPLE_PROBING == 2
569
 
569
 
570
     // Do a first probe at the fast speed
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
     float first_probe_z = current_position[Z_AXIS];
581
     float first_probe_z = current_position[Z_AXIS];
574
 
582
 
598
     for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
606
     for (uint8_t p = MULTIPLE_PROBING + 1; --p;) {
599
   #endif
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
   #if MULTIPLE_PROBING > 2
620
   #if MULTIPLE_PROBING > 2
605
       probes_total += current_position[Z_AXIS];
621
       probes_total += current_position[Z_AXIS];
610
   #if MULTIPLE_PROBING > 2
626
   #if MULTIPLE_PROBING > 2
611
 
627
 
612
     // Return the average value of all probes
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
   #elif MULTIPLE_PROBING == 2
631
   #elif MULTIPLE_PROBING == 2
616
 
632
 
624
     #endif
640
     #endif
625
 
641
 
626
     // Return a weighted average of the fast and slow probes
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
   #else
645
   #else
630
 
646
 
631
     // Return the single probe result
647
     // Return the single probe result
632
-    return current_position[Z_AXIS];
648
+    const float measured_z = current_position[Z_AXIS];
633
 
649
 
634
   #endif
650
   #endif
635
 
651
 
636
   #if ENABLED(DEBUG_LEVELING_FEATURE)
652
   #if ENABLED(DEBUG_LEVELING_FEATURE)
637
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
653
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
638
   #endif
654
   #endif
655
+
656
+  return measured_z;
639
 }
657
 }
640
 
658
 
641
 /**
659
 /**
705
     SERIAL_EOL();
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
   feedrate_mm_s = old_feedrate_mm_s;
726
   feedrate_mm_s = old_feedrate_mm_s;
713
 
727
 
714
   if (isnan(measured_z)) {
728
   if (isnan(measured_z)) {
717
     SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
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
   return measured_z;
738
   return measured_z;
721
 }
739
 }
722
 
740
 

読み込み中…
キャンセル
保存