Browse Source

Tweak ABL logging, document probing

Scott Lahteine 5 years ago
parent
commit
130e36d766

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

43
  * Extrapolate a single point from its neighbors
43
  * Extrapolate a single point from its neighbors
44
  */
44
  */
45
 static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
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
   if (DEBUGGING(LEVELING)) {
47
   if (DEBUGGING(LEVELING)) {
47
     DEBUG_ECHOPGM("Extrapolate [");
48
     DEBUG_ECHOPGM("Extrapolate [");
48
     if (x < 10) DEBUG_CHAR(' ');
49
     if (x < 10) DEBUG_CHAR(' ');
54
     DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
55
     DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
55
     DEBUG_ECHOLNPGM("]");
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
   // Get X neighbors, Y neighbors, and XY neighbors
59
   // Get X neighbors, Y neighbors, and XY neighbors
63
   const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;
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
   // Restore state after probing
958
   // Restore state after probing
959
   if (!faux) restore_feedrate_and_scaling();
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
   #if HAS_BED_PROBE && defined(Z_AFTER_PROBING)
964
   #if HAS_BED_PROBE && defined(Z_AFTER_PROBING)
967
     probe.move_z_after_probing();
965
     probe.move_z_after_probing();
975
 
973
 
976
   report_current_position();
974
   report_current_position();
977
 
975
 
976
+  if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
977
+
978
   G29_RETURN(isnan(measured_z));
978
   G29_RETURN(isnan(measured_z));
979
 }
979
 }
980
 
980
 

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

459
   const char Probe::msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
459
   const char Probe::msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
460
 #endif
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
   #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
475
   #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
466
     // Wait for bed to heat back up between probing points
476
     // Wait for bed to heat back up between probing points
536
   // Tell the planner where we actually are
546
   // Tell the planner where we actually are
537
   sync_plan_position();
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
   return !probe_triggered;
551
   return !probe_triggered;
542
 }
552
 }
561
   #if TOTAL_PROBING == 2
571
   #if TOTAL_PROBING == 2
562
 
572
 
563
     // Do a first probe at the fast speed
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
       if (DEBUGGING(LEVELING)) {
575
       if (DEBUGGING(LEVELING)) {
566
         DEBUG_ECHOLNPGM("FAST Probe fail!");
576
         DEBUG_ECHOLNPGM("FAST Probe fail!");
567
         DEBUG_POS("<<< run_z_probe", current_position);
577
         DEBUG_POS("<<< run_z_probe", current_position);
583
     const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0);
593
     const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0);
584
     if (current_position.z > z) {
594
     if (current_position.z > z) {
585
       // Probe down fast. If the probe never triggered, raise for probe clearance
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
         do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
597
         do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
588
     }
598
     }
589
   #endif
599
   #endif
604
   #endif
614
   #endif
605
     {
615
     {
606
       // Probe downward slowly to find the bed
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
         if (DEBUGGING(LEVELING)) {
618
         if (DEBUGGING(LEVELING)) {
609
           DEBUG_ECHOLNPGM("SLOW Probe fail!");
619
           DEBUG_ECHOLNPGM("SLOW Probe fail!");
610
           DEBUG_POS("<<< run_z_probe", current_position);
620
           DEBUG_POS("<<< run_z_probe", current_position);

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

162
   #endif
162
   #endif
163
 
163
 
164
 private:
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
   static void do_z_raise(const float z_raise);
166
   static void do_z_raise(const float z_raise);
167
   static float run_z_probe();
167
   static float run_z_probe();
168
 };
168
 };

Loading…
Cancel
Save