🧑‍💻 Probe flag in do_z_clearance

This commit is contained in:
Scott Lahteine
2023-04-11 18:43:01 -05:00
parent 185961f898
commit f53217b2c5
6 changed files with 18 additions and 25 deletions

View File

@@ -916,15 +916,14 @@ void set_message_with_feedback(FSTR_P const fstr) {
echo_and_take_a_measurement(); echo_and_take_a_measurement();
const float z1 = measure_point_with_encoder(); const float z1 = measure_point_with_encoder();
do_blocking_move_to_z(current_position.z + SIZE_OF_LITTLE_RAISE); do_z_clearance_by(SIZE_OF_LITTLE_RAISE);
planner.synchronize();
SERIAL_ECHOPGM("Remove shim"); SERIAL_ECHOPGM("Remove shim");
LCD_MESSAGE(MSG_UBL_BC_REMOVE); LCD_MESSAGE(MSG_UBL_BC_REMOVE);
echo_and_take_a_measurement(); echo_and_take_a_measurement();
const float z2 = measure_point_with_encoder(); const float z2 = measure_point_with_encoder();
do_blocking_move_to_z(current_position.z + Z_CLEARANCE_BETWEEN_PROBES); do_z_clearance_by(Z_CLEARANCE_BETWEEN_PROBES);
const float thickness = ABS(z1 - z2); const float thickness = ABS(z1 - z2);

View File

@@ -792,15 +792,18 @@ void do_blocking_move_to_x(const_float_t rx, const_feedRate_t fr_mm_s/*=0.0*/) {
fr_mm_s fr_mm_s
); );
} }
void do_z_clearance(const_float_t zclear, const bool lower_allowed/*=false*/) { void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, ", ", lower_allowed, ")"); UNUSED(with_probe);
const float zdest = _MIN(zclear, Z_MAX_POS); float zdest = zclear;
if (zdest == current_position.z || (!lower_allowed && zdest < current_position.z)) return; TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z);
NOMORE(zdest, Z_MAX_POS);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")");
if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return;
do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS)));
} }
void do_z_clearance_by(const_float_t zclear) { void do_z_clearance_by(const_float_t zclear) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")");
do_z_clearance(current_position.z + zclear); do_z_clearance(current_position.z + zclear, false);
} }
#endif #endif

View File

@@ -403,10 +403,10 @@ void remember_feedrate_scaling_off();
void restore_feedrate_and_scaling(); void restore_feedrate_and_scaling();
#if HAS_Z_AXIS #if HAS_Z_AXIS
void do_z_clearance(const_float_t zclear, const bool lower_allowed=false); void do_z_clearance(const_float_t zclear, const bool with_probe=true, const bool lower_allowed=false);
void do_z_clearance_by(const_float_t zclear); void do_z_clearance_by(const_float_t zclear);
#else #else
inline void do_z_clearance(float, bool=false) {} inline void do_z_clearance(float, bool=true, bool=false) {}
inline void do_z_clearance_by(float) {} inline void do_z_clearance_by(float) {}
#endif #endif

View File

@@ -349,17 +349,6 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
#endif // HAS_QUIET_PROBING #endif // HAS_QUIET_PROBING
/**
* 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_ECHOLNPGM("Probe::do_z_raise(", z_raise, ")");
float z_dest = z_raise;
const float zoffs = DIFF_TERN(HAS_HOTEND_OFFSET, offset.z, hotend_offset[active_extruder].z);
if (zoffs < 0) z_dest -= zoffs;
do_z_clearance(z_dest);
}
FORCE_INLINE void probe_specific_action(const bool deploy) { FORCE_INLINE void probe_specific_action(const bool deploy) {
DEBUG_SECTION(log_psa, "Probe::probe_specific_action", DEBUGGING(LEVELING)); DEBUG_SECTION(log_psa, "Probe::probe_specific_action", DEBUGGING(LEVELING));
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
@@ -522,8 +511,11 @@ bool Probe::set_deployed(const bool deploy, const bool no_return/*=false*/) {
constexpr bool z_raise_wanted = true; constexpr bool z_raise_wanted = true;
#endif #endif
if (z_raise_wanted) if (z_raise_wanted) {
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE)); const float zdest = DIFF_TERN(HAS_HOTEND_OFFSET, _MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE), hotend_offset[active_extruder].z);
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z to ", zdest);
do_z_clearance(zdest);
}
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) { if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) {

View File

@@ -352,7 +352,6 @@ public:
private: private:
static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s); static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s);
static void do_z_raise(const float z_raise);
static float run_z_probe(const bool sanity_check=true); static float run_z_probe(const bool sanity_check=true);
}; };

View File

@@ -982,7 +982,7 @@ volatile bool Temperature::raw_temps_ready = false;
planner.sync_fan_speeds(fan_speed); planner.sync_fan_speeds(fan_speed);
#endif #endif
do_z_clearance(MPC_TUNING_END_Z); do_z_clearance(MPC_TUNING_END_Z, false);
TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true);
} }