Consolidate probe clearance, add section debug (#18576)

* Better section / function log
* Add do_z_clearance motion function
This commit is contained in:
Scott Lahteine
2020-07-08 21:44:21 -05:00
committed by GitHub
parent 0eab9fc08c
commit 73fc0778b8
18 changed files with 132 additions and 131 deletions

View File

@ -260,15 +260,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
* Raise Z to a minimum height to make room for a probe to move
*/
void Probe::do_z_raise(const float z_raise) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probe::move_z(", z_raise, ")");
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probe::do_z_raise(", z_raise, ")");
float z_dest = z_raise;
if (offset.z < 0) z_dest -= offset.z;
NOMORE(z_dest, Z_MAX_POS);
if (z_dest > current_position.z)
do_blocking_move_to_z(z_dest);
do_z_clearance(z_dest);
}
FORCE_INLINE void probe_specific_action(const bool deploy) {
@ -410,16 +405,6 @@ bool Probe::set_deployed(const bool deploy) {
return false;
}
#ifdef Z_AFTER_PROBING
// After probing move to a preferred Z position
void Probe::move_z_after_probing() {
if (current_position.z != Z_AFTER_PROBING) {
do_blocking_move_to_z(Z_AFTER_PROBING);
current_position.z = Z_AFTER_PROBING;
}
}
#endif
/**
* @brief Used by run_z_probe to do a single Z probe move.
*
@ -439,7 +424,7 @@ bool Probe::set_deployed(const bool deploy) {
* @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);
DEBUG_SECTION(log_probe, "Probe::probe_down_to_z", DEBUGGING(LEVELING));
#if BOTH(HAS_HEATED_BED, WAIT_FOR_BED_HEATER)
thermalManager.wait_for_bed_heating();
@ -499,8 +484,6 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
// Tell the planner where we actually are
sync_plan_position();
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< Probe::probe_down_to_z", current_position);
return !probe_triggered;
}
@ -513,8 +496,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
* @return The Z position of the bed at the current XY or NAN on error.
*/
float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> Probe::run_z_probe", current_position);
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
auto try_to_probe = [&](PGM_P const plbl, const float &z_probe_low_point, const feedRate_t fr_mm_s, const bool scheck, const float clearance) {
// Do a first probe at the fast speed
@ -527,7 +509,6 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
if (probe_fail) DEBUG_ECHOPGM(" No trigger.");
if (early_fail) DEBUG_ECHOPGM(" Triggered early.");
DEBUG_EOL();
DEBUG_POS("<<< run_z_probe", current_position);
}
#else
UNUSED(plbl);
@ -651,8 +632,6 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
#endif
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
return measured_z;
}
@ -666,9 +645,11 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
* - Return the probed Z position
*/
float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/, const bool sanity_check/*=true*/) {
DEBUG_SECTION(log_probe, "Probe::probe_at_point", DEBUGGING(LEVELING));
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPAIR(
">>> Probe::probe_at_point(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry),
"...(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry),
", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none",
", ", int(verbose_level),
", ", probe_relative ? "probe" : "nozzle", "_relative)"
@ -729,8 +710,6 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
#endif
}
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< Probe::probe_at_point");
return measured_z;
}