From f293d61d3d26bb529c856b0283c5887f89900aa6 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 8 Mar 2019 18:52:14 +0100 Subject: [PATCH] faster Z probe: move Z 150um relatively to last measurement. If PINDA is triggered at the beginning of measurement, move Z 500um higher and repeat measurement --- Firmware/mesh_bed_calibration.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 9b3c78f1d..7b53e2859 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -967,15 +967,29 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i #endif //TMC2130 for (uint8_t i = 0; i < n_iter; ++ i) { - // Move up the retract distance. - current_position[Z_AXIS] += .5f; - go_to_current(homing_feedrate[Z_AXIS]/60); - // Move back down slowly to find bed. + + current_position[Z_AXIS] += 0.15; + float z_bckp = current_position[Z_AXIS]; + go_to_current(homing_feedrate[Z_AXIS]/60); + // Move back down slowly to find bed. current_position[Z_AXIS] = minimum_z; go_to_current(homing_feedrate[Z_AXIS]/(4*60)); // we have to let the planner know where we are right now as it is not where we said to go. update_current_position_z(); - if (! endstop_z_hit_on_purpose()) + //printf_P(PSTR("Zs: %f, Z: %f, delta Z: %f"), z_bckp, current_position[Z_AXIS], (z_bckp - current_position[Z_AXIS])); + if (abs(current_position[Z_AXIS] - z_bckp) < 0.025) { + printf_P(PSTR("PINDA triggered immediately, move Z higher and repeat measurement\n")); + current_position[Z_AXIS] += 0.5; + go_to_current(homing_feedrate[Z_AXIS]/60); + current_position[Z_AXIS] = minimum_z; + go_to_current(homing_feedrate[Z_AXIS]/(4*60)); + // we have to let the planner know where we are right now as it is not where we said to go. + update_current_position_z(); + } + + + + if (! endstop_z_hit_on_purpose()) goto error; #ifdef TMC2130 if (READ(Z_TMC2130_DIAG) != 0) goto error; //crash Z detected @@ -2748,7 +2762,7 @@ void go_home_with_z_lift() current_position[Y_AXIS] = Y_MIN_POS+0.2; // Clamp to the physical coordinates. world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); - go_to_current(homing_feedrate[X_AXIS]/60); + go_to_current(homing_feedrate[X_AXIS]/20); // Third move up to a safe height. current_position[Z_AXIS] = Z_MIN_POS; go_to_current(homing_feedrate[Z_AXIS]/60);