Browse Source

Better probe fail handling (#16811)

pull/1/head
InsanityAutomation 5 years ago
committed by GitHub
parent
commit
84b6e11bd5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      Marlin/src/feature/bltouch.h
  2. 25
      Marlin/src/module/probe.cpp

3
Marlin/src/feature/bltouch.h

@ -91,13 +91,14 @@ public:
FORCE_INLINE static void mode_conv_5V() { mode_conv_proc(true); } FORCE_INLINE static void mode_conv_5V() { mode_conv_proc(true); }
FORCE_INLINE static void mode_conv_OD() { mode_conv_proc(false); } FORCE_INLINE static void mode_conv_OD() { mode_conv_proc(false); }
static bool triggered();
private: private:
FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); } FORCE_INLINE static bool _deploy_query_alarm() { return command(BLTOUCH_DEPLOY, BLTOUCH_DEPLOY_DELAY); }
FORCE_INLINE static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); } FORCE_INLINE static bool _stow_query_alarm() { return command(BLTOUCH_STOW, BLTOUCH_STOW_DELAY); }
static void clear(); static void clear();
static bool command(const BLTCommand cmd, const millis_t &ms); static bool command(const BLTCommand cmd, const millis_t &ms);
static bool triggered();
static bool deploy_proc(); static bool deploy_proc();
static bool stow_proc(); static bool stow_proc();
static bool status_proc(); static bool status_proc();

25
Marlin/src/module/probe.cpp

@ -571,7 +571,9 @@ 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 (probe_down_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)) // No probe trigger?
|| current_position.z > -offset.z + _MAX(Z_CLEARANCE_BETWEEN_PROBES, 4) / 2 // Probe triggered too high?
) {
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);
@ -614,7 +616,9 @@ float Probe::run_z_probe() {
#endif #endif
{ {
// Probe downward slowly to find the bed // Probe downward slowly to find the bed
if (probe_down_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)) // No probe trigger?
|| current_position.z > -offset.z + _MAX(Z_CLEARANCE_MULTI_PROBE, 4) / 2 // Probe triggered too high?
) {
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);
@ -716,6 +720,10 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
DEBUG_POS("", current_position); DEBUG_POS("", current_position);
} }
#if BOTH(BLTOUCH, BLTOUCH_HS_MODE)
if (bltouch.triggered()) bltouch._reset();
#endif
// TODO: Adapt for SCARA, where the offset rotates // TODO: Adapt for SCARA, where the offset rotates
xyz_pos_t npos = { rx, ry }; xyz_pos_t npos = { rx, ry };
if (probe_relative) { // The given position is in terms of the probe if (probe_relative) { // The given position is in terms of the probe
@ -743,21 +751,22 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
do_blocking_move_to(npos); do_blocking_move_to(npos);
float measured_z = NAN; float measured_z = NAN;
if (!deploy()) { if (!deploy()) measured_z = run_z_probe() + offset.z;
measured_z = run_z_probe() + offset.z; if (!isnan(measured_z)) {
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE; const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
if (big_raise || raise_after == PROBE_PT_RAISE) if (big_raise || raise_after == PROBE_PT_RAISE) {
if (current_position.z < Z_PROBE_OFFSET_RANGE_MAX) // Only raise when in probing range (else error)
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), MMM_TO_MMS(Z_PROBE_SPEED_FAST)); do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
else if (raise_after == PROBE_PT_STOW)
if (stow()) measured_z = NAN;
} }
else if (raise_after == PROBE_PT_STOW)
if (stow()) measured_z = NAN; // Error on stow?
if (verbose_level > 2) { if (verbose_level > 2) {
SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3); SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3);
SERIAL_ECHOPAIR_F( " Y: ", LOGICAL_Y_POSITION(ry), 3); SERIAL_ECHOPAIR_F( " Y: ", LOGICAL_Y_POSITION(ry), 3);
SERIAL_ECHOLNPAIR_F( " Z: ", measured_z, 3); SERIAL_ECHOLNPAIR_F( " Z: ", measured_z, 3);
} }
}
feedrate_mm_s = old_feedrate_mm_s; feedrate_mm_s = old_feedrate_mm_s;

Loading…
Cancel
Save