Browse Source

Tweak ABL logging, document probing

Scott Lahteine 4 years ago
parent
commit
130e36d766

+ 1
- 4
Marlin/src/feature/bedlevel/abl/abl.cpp View File

@@ -43,6 +43,7 @@ bed_mesh_t z_values;
43 43
  * Extrapolate a single point from its neighbors
44 44
  */
45 45
 static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
46
+  if (!isnan(z_values[x][y])) return;
46 47
   if (DEBUGGING(LEVELING)) {
47 48
     DEBUG_ECHOPGM("Extrapolate [");
48 49
     if (x < 10) DEBUG_CHAR(' ');
@@ -54,10 +55,6 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
54 55
     DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
55 56
     DEBUG_ECHOLNPGM("]");
56 57
   }
57
-  if (!isnan(z_values[x][y])) {
58
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" (done)");
59
-    return;  // Don't overwrite good values.
60
-  }
61 58
 
62 59
   // Get X neighbors, Y neighbors, and XY neighbors
63 60
   const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;

+ 4
- 4
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -958,10 +958,8 @@ G29_TYPE GcodeSuite::G29() {
958 958
   // Restore state after probing
959 959
   if (!faux) restore_feedrate_and_scaling();
960 960
 
961
-  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
962
-
963
-  if (planner.leveling_active)
964
-    sync_plan_position();
961
+  // Sync the planner from the current_position
962
+  if (planner.leveling_active) sync_plan_position();
965 963
 
966 964
   #if HAS_BED_PROBE && defined(Z_AFTER_PROBING)
967 965
     probe.move_z_after_probing();
@@ -975,6 +973,8 @@ G29_TYPE GcodeSuite::G29() {
975 973
 
976 974
   report_current_position();
977 975
 
976
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
977
+
978 978
   G29_RETURN(isnan(measured_z));
979 979
 }
980 980
 

+ 16
- 6
Marlin/src/module/probe.cpp View File

@@ -459,8 +459,18 @@ bool Probe::set_deployed(const bool deploy) {
459 459
   const char Probe::msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
460 460
 #endif
461 461
 
462
-bool Probe::move_to_z(const float z, const feedRate_t fr_mm_s) {
463
-  if (DEBUGGING(LEVELING)) DEBUG_POS(">>> Probe::move_to_z", current_position);
462
+/**
463
+ * @brief Move down until the probe triggers or the low limit is reached
464
+ *
465
+ * @details Used by run_z_probe to get each bed Z height measurement.
466
+ *          Sets current_position.z to the height where the probe triggered
467
+ *          (according to the Z stepper count). The float Z is propagated
468
+ *          back to the planner.position to preempt any rounding error.
469
+ *
470
+ * @return TRUE if the probe failed to trigger.
471
+ */
472
+bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
473
+  if (DEBUGGING(LEVELING)) DEBUG_POS(">>> Probe::probe_down_to_z", current_position);
464 474
 
465 475
   #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
466 476
     // Wait for bed to heat back up between probing points
@@ -536,7 +546,7 @@ bool Probe::move_to_z(const float z, const feedRate_t fr_mm_s) {
536 546
   // Tell the planner where we actually are
537 547
   sync_plan_position();
538 548
 
539
-  if (DEBUGGING(LEVELING)) DEBUG_POS("<<< Probe::move_to_z", current_position);
549
+  if (DEBUGGING(LEVELING)) DEBUG_POS("<<< Probe::probe_down_to_z", current_position);
540 550
 
541 551
   return !probe_triggered;
542 552
 }
@@ -561,7 +571,7 @@ float Probe::run_z_probe() {
561 571
   #if TOTAL_PROBING == 2
562 572
 
563 573
     // Do a first probe at the fast speed
564
-    if (move_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))) {
565 575
       if (DEBUGGING(LEVELING)) {
566 576
         DEBUG_ECHOLNPGM("FAST Probe fail!");
567 577
         DEBUG_POS("<<< run_z_probe", current_position);
@@ -583,7 +593,7 @@ float Probe::run_z_probe() {
583 593
     const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0);
584 594
     if (current_position.z > z) {
585 595
       // Probe down fast. If the probe never triggered, raise for probe clearance
586
-      if (!move_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
596
+      if (!probe_down_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
587 597
         do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
588 598
     }
589 599
   #endif
@@ -604,7 +614,7 @@ float Probe::run_z_probe() {
604 614
   #endif
605 615
     {
606 616
       // Probe downward slowly to find the bed
607
-      if (move_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
617
+      if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
608 618
         if (DEBUGGING(LEVELING)) {
609 619
           DEBUG_ECHOLNPGM("SLOW Probe fail!");
610 620
           DEBUG_POS("<<< run_z_probe", current_position);

+ 1
- 1
Marlin/src/module/probe.h View File

@@ -162,7 +162,7 @@ public:
162 162
   #endif
163 163
 
164 164
 private:
165
-  static bool move_to_z(const float z, const feedRate_t fr_mm_s);
165
+  static bool probe_down_to_z(const float z, const feedRate_t fr_mm_s);
166 166
   static void do_z_raise(const float z_raise);
167 167
   static float run_z_probe();
168 168
 };

Loading…
Cancel
Save