From b1537135e4abaf6c0dd85aa00160f63306d8a83f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 11 Apr 2023 18:18:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20BLTouch=20extra=20clearance=20fo?= =?UTF-8?q?r=20PROBE=5FPT=5FRAISE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/probe.cpp | 64 ++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 7aa6595e289..0f2fca119c6 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -943,45 +943,45 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S)); #if ENABLED(BD_SENSOR) + return current_position.z - bdl.read(); // Difference between Z-home-relative Z and sensor reading - #endif - float measured_z = NAN; - if (!deploy()) { - measured_z = run_z_probe(sanity_check) + offset.z; - TERN_(HAS_PTC, ptc.apply_compensation(measured_z)); - TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy)); - } + #else // !BD_SENSOR - // Deploy succeeded and a successful measurement was done. - // Raise and/or stow the probe depending on 'raise_after' and settings. - if (!isnan(measured_z)) { - const ProbePtRaise raise_type = (TERN0(BLTOUCH, !bltouch.high_speed_mode) && raise_after == PROBE_PT_RAISE) ? PROBE_PT_STOW : raise_after; - switch (raise_type) { - default: break; - case PROBE_PT_RAISE: - do_z_clearance(Z_CLEARANCE_BETWEEN_PROBES); - break; - case PROBE_PT_STOW: case PROBE_PT_LAST_STOW: - if (stow()) measured_z = NAN; // Error on stow? - break; + float measured_z = deploy() ? NAN : run_z_probe(sanity_check) + offset.z; + + // Deploy succeeded and a successful measurement was done. + // Raise and/or stow the probe depending on 'raise_after' and settings. + if (!isnan(measured_z)) { + switch (raise_after) { + default: break; + case PROBE_PT_RAISE: + do_z_clearance(Z_PROBE_SAFE_CLEARANCE); + break; + case PROBE_PT_STOW: case PROBE_PT_LAST_STOW: + if (stow()) measured_z = NAN; // Error on stow? + break; + } } - if (verbose_level > 2) - SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z); - } + // If any error occurred stow the probe and set an alert + if (isnan(measured_z)) { + stow(); + LCD_MESSAGE(MSG_LCD_PROBING_FAILED); + #if DISABLED(G29_RETRY_AND_RECOVER) + SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED); + #endif + } + else { + TERN_(HAS_PTC, ptc.apply_compensation(measured_z)); + TERN_(X_AXIS_TWIST_COMPENSATION, measured_z += xatc.compensation(npos + offset_xy)); + if (verbose_level > 2 || DEBUGGING(LEVELING)) + SERIAL_ECHOLNPGM("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z); + } - // If any error occurred stow the probe and set an alert - if (isnan(measured_z)) { - stow(); - LCD_MESSAGE(MSG_LCD_PROBING_FAILED); - #if DISABLED(G29_RETRY_AND_RECOVER) - SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED); - #endif - } - DEBUG_ECHOLNPGM("measured_z: ", measured_z); + return measured_z; - return measured_z; + #endif // !BD_SENSOR } #if HAS_Z_SERVO_PROBE