1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 20:18:52 +00:00

Tweak ABL logging, document probing

This commit is contained in:
Scott Lahteine 2020-02-08 17:47:54 -06:00
parent 5d3cfbdc9b
commit 130e36d766
4 changed files with 22 additions and 15 deletions

View File

@ -43,6 +43,7 @@ bed_mesh_t z_values;
* Extrapolate a single point from its neighbors * Extrapolate a single point from its neighbors
*/ */
static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) { static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
if (!isnan(z_values[x][y])) return;
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
DEBUG_ECHOPGM("Extrapolate ["); DEBUG_ECHOPGM("Extrapolate [");
if (x < 10) DEBUG_CHAR(' '); 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
DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' '); DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
DEBUG_ECHOLNPGM("]"); DEBUG_ECHOLNPGM("]");
} }
if (!isnan(z_values[x][y])) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" (done)");
return; // Don't overwrite good values.
}
// Get X neighbors, Y neighbors, and XY neighbors // Get X neighbors, Y neighbors, and XY neighbors
const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir; const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;

View File

@ -958,10 +958,8 @@ G29_TYPE GcodeSuite::G29() {
// Restore state after probing // Restore state after probing
if (!faux) restore_feedrate_and_scaling(); if (!faux) restore_feedrate_and_scaling();
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29"); // Sync the planner from the current_position
if (planner.leveling_active) sync_plan_position();
if (planner.leveling_active)
sync_plan_position();
#if HAS_BED_PROBE && defined(Z_AFTER_PROBING) #if HAS_BED_PROBE && defined(Z_AFTER_PROBING)
probe.move_z_after_probing(); probe.move_z_after_probing();
@ -975,6 +973,8 @@ G29_TYPE GcodeSuite::G29() {
report_current_position(); report_current_position();
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29");
G29_RETURN(isnan(measured_z)); G29_RETURN(isnan(measured_z));
} }

View File

@ -459,8 +459,18 @@ bool Probe::set_deployed(const bool deploy) {
const char Probe::msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n"; const char Probe::msg_wait_for_bed_heating[25] PROGMEM = "Wait for bed heating...\n";
#endif #endif
bool Probe::move_to_z(const float z, const feedRate_t fr_mm_s) { /**
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> Probe::move_to_z", current_position); * @brief Move down until the probe triggers or the low limit is reached
*
* @details Used by run_z_probe to get each bed Z height measurement.
* Sets current_position.z to the height where the probe triggered
* (according to the Z stepper count). The float Z is propagated
* back to the planner.position to preempt any rounding error.
*
* @return TRUE if the probe failed to trigger.
*/
bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> Probe::probe_down_to_z", current_position);
#if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER) #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER)
// Wait for bed to heat back up between probing points // 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) {
// Tell the planner where we actually are // Tell the planner where we actually are
sync_plan_position(); sync_plan_position();
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< Probe::move_to_z", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("<<< Probe::probe_down_to_z", current_position);
return !probe_triggered; return !probe_triggered;
} }
@ -561,7 +571,7 @@ float Probe::run_z_probe() {
#if TOTAL_PROBING == 2 #if TOTAL_PROBING == 2
// Do a first probe at the fast speed // Do a first probe at the fast speed
if (move_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) { if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) {
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM("FAST Probe fail!"); DEBUG_ECHOLNPGM("FAST Probe fail!");
DEBUG_POS("<<< run_z_probe", current_position); DEBUG_POS("<<< run_z_probe", current_position);
@ -583,7 +593,7 @@ float Probe::run_z_probe() {
const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0); const float z = Z_CLEARANCE_DEPLOY_PROBE + 5.0 + (offset.z < 0 ? -offset.z : 0);
if (current_position.z > z) { if (current_position.z > z) {
// Probe down fast. If the probe never triggered, raise for probe clearance // Probe down fast. If the probe never triggered, raise for probe clearance
if (!move_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) if (!probe_down_to_z(z, MMM_TO_MMS(Z_PROBE_SPEED_FAST)))
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
} }
#endif #endif
@ -604,7 +614,7 @@ float Probe::run_z_probe() {
#endif #endif
{ {
// Probe downward slowly to find the bed // Probe downward slowly to find the bed
if (move_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) { if (probe_down_to_z(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) {
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM("SLOW Probe fail!"); DEBUG_ECHOLNPGM("SLOW Probe fail!");
DEBUG_POS("<<< run_z_probe", current_position); DEBUG_POS("<<< run_z_probe", current_position);

View File

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