|
@ -1293,23 +1293,17 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { |
|
|
void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) { |
|
|
void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t fr_mm_s=0.0) { |
|
|
DEBUG_SECTION(log_move, "do_homing_move", DEBUGGING(LEVELING)); |
|
|
DEBUG_SECTION(log_move, "do_homing_move", DEBUGGING(LEVELING)); |
|
|
|
|
|
|
|
|
const feedRate_t real_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); |
|
|
const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); |
|
|
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) { |
|
|
if (DEBUGGING(LEVELING)) { |
|
|
DEBUG_ECHOPAIR("...(", axis_codes[axis], ", ", distance, ", "); |
|
|
DEBUG_ECHOPAIR("...(", axis_codes[axis], ", ", distance, ", "); |
|
|
if (fr_mm_s) |
|
|
if (fr_mm_s) |
|
|
DEBUG_ECHO(fr_mm_s); |
|
|
DEBUG_ECHO(fr_mm_s); |
|
|
else |
|
|
else |
|
|
DEBUG_ECHOPAIR("[", real_fr_mm_s, "]"); |
|
|
DEBUG_ECHOPAIR("[", home_fr_mm_s, "]"); |
|
|
DEBUG_ECHOLNPGM(")"); |
|
|
DEBUG_ECHOLNPGM(")"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ALL(HOMING_Z_WITH_PROBE, HAS_HEATED_BED, WAIT_FOR_BED_HEATER) |
|
|
|
|
|
// Wait for bed to heat back up between probing points
|
|
|
|
|
|
if (axis == Z_AXIS && distance < 0) |
|
|
|
|
|
thermalManager.wait_for_bed_heating(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Only do some things when moving towards an endstop
|
|
|
// Only do some things when moving towards an endstop
|
|
|
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS) |
|
|
const int8_t axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS) |
|
|
? x_home_dir(active_extruder) : home_dir(axis); |
|
|
? x_home_dir(active_extruder) : home_dir(axis); |
|
@ -1321,9 +1315,14 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t |
|
|
|
|
|
|
|
|
if (is_home_dir) { |
|
|
if (is_home_dir) { |
|
|
|
|
|
|
|
|
#if HOMING_Z_WITH_PROBE && HAS_QUIET_PROBING |
|
|
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS)) { |
|
|
if (axis == Z_AXIS) probe.set_probing_paused(true); |
|
|
#if ALL(HAS_HEATED_BED, WAIT_FOR_BED_HEATER) |
|
|
#endif |
|
|
// Wait for bed to heat back up between probing points
|
|
|
|
|
|
thermalManager.wait_for_bed_heating(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_QUIET_PROBING, probe.set_probing_paused(true)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Disable stealthChop if used. Enable diag1 pin on driver.
|
|
|
// Disable stealthChop if used. Enable diag1 pin on driver.
|
|
|
TERN_(SENSORLESS_HOMING, stealth_states = start_sensorless_homing_per_axis(axis)); |
|
|
TERN_(SENSORLESS_HOMING, stealth_states = start_sensorless_homing_per_axis(axis)); |
|
@ -1334,7 +1333,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t |
|
|
current_position[axis] = 0; |
|
|
current_position[axis] = 0; |
|
|
sync_plan_position(); |
|
|
sync_plan_position(); |
|
|
current_position[axis] = distance; |
|
|
current_position[axis] = distance; |
|
|
line_to_current_position(real_fr_mm_s); |
|
|
line_to_current_position(home_fr_mm_s); |
|
|
#else |
|
|
#else |
|
|
// Get the ABC or XYZ positions in mm
|
|
|
// Get the ABC or XYZ positions in mm
|
|
|
abce_pos_t target = planner.get_axis_positions_mm(); |
|
|
abce_pos_t target = planner.get_axis_positions_mm(); |
|
@ -1352,7 +1351,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const feedRate_t |
|
|
#if HAS_DIST_MM_ARG |
|
|
#if HAS_DIST_MM_ARG |
|
|
, cart_dist_mm |
|
|
, cart_dist_mm |
|
|
#endif |
|
|
#endif |
|
|
, real_fr_mm_s, active_extruder |
|
|
, home_fr_mm_s, active_extruder |
|
|
); |
|
|
); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -1571,7 +1570,9 @@ void homeaxis(const AxisEnum axis) { |
|
|
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS) |
|
|
const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS) |
|
|
? x_home_dir(active_extruder) : home_dir(axis); |
|
|
? x_home_dir(active_extruder) : home_dir(axis); |
|
|
|
|
|
|
|
|
// Homing Z towards the bed? Deploy the Z probe or endstop.
|
|
|
//
|
|
|
|
|
|
// Homing Z with a probe? Raise Z (maybe) and deploy the Z probe.
|
|
|
|
|
|
//
|
|
|
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy())) |
|
|
if (TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && probe.deploy())) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
@ -1586,23 +1587,34 @@ void homeaxis(const AxisEnum axis) { |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// Fast move towards endstop until triggered
|
|
|
//
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:"); |
|
|
// Deploy BLTouch or tare the probe just before probing
|
|
|
|
|
|
//
|
|
|
#if HOMING_Z_WITH_PROBE |
|
|
#if HOMING_Z_WITH_PROBE |
|
|
if (axis == Z_AXIS) { |
|
|
if (axis == Z_AXIS) { |
|
|
if (TERN0(BLTOUCH, bltouch.deploy())) return; |
|
|
if (TERN0(BLTOUCH, bltouch.deploy())) return; // BLTouch was deployed above, but get the alarm state.
|
|
|
if (TERN0(PROBE_TARE, probe.tare())) return; |
|
|
if (TERN0(PROBE_TARE, probe.tare())) return; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
// Back away to prevent an early X/Y sensorless trigger
|
|
|
|
|
|
//
|
|
|
#if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM) |
|
|
#if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM) |
|
|
const xy_float_t backoff = SENSORLESS_BACKOFF_MM; |
|
|
const xy_float_t backoff = SENSORLESS_BACKOFF_MM; |
|
|
if (((ENABLED(X_SENSORLESS) && axis == X_AXIS) || (ENABLED(Y_SENSORLESS) && axis == Y_AXIS)) && backoff[axis]) |
|
|
if ((TERN0(X_SENSORLESS, axis == X_AXIS) || TERN0(Y_SENSORLESS, axis == Y_AXIS)) && backoff[axis]) { |
|
|
do_homing_move(axis, -ABS(backoff[axis]) * axis_home_dir, homing_feedrate(axis)); |
|
|
const float backoff_length = -ABS(backoff[axis]) * axis_home_dir; |
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Sensorless backoff: ", backoff_length, "mm"); |
|
|
|
|
|
do_homing_move(axis, backoff_length, homing_feedrate(axis)); |
|
|
|
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
do_homing_move(axis, 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir); |
|
|
//
|
|
|
|
|
|
// Fast move towards endstop until triggered
|
|
|
|
|
|
//
|
|
|
|
|
|
const float move_length = 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir; |
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Home Fast: ", move_length, "mm"); |
|
|
|
|
|
do_homing_move(axis, move_length); |
|
|
|
|
|
|
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) |
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) |
|
|
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
|
|
|
if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
|
|
@ -1617,7 +1629,7 @@ void homeaxis(const AxisEnum axis) { |
|
|
// If a second homing move is configured...
|
|
|
// If a second homing move is configured...
|
|
|
if (bump) { |
|
|
if (bump) { |
|
|
// Move away from the endstop by the axis HOMING_BUMP_MM
|
|
|
// Move away from the endstop by the axis HOMING_BUMP_MM
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:"); |
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Move Away: ", -bump, "mm"); |
|
|
do_homing_move(axis, -bump |
|
|
do_homing_move(axis, -bump |
|
|
#if HOMING_Z_WITH_PROBE |
|
|
#if HOMING_Z_WITH_PROBE |
|
|
, MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_SPEED_FAST : 0) |
|
|
, MMM_TO_MMS(axis == Z_AXIS ? Z_PROBE_SPEED_FAST : 0) |
|
@ -1639,14 +1651,14 @@ void homeaxis(const AxisEnum axis) { |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// Slow move towards endstop until triggered
|
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:"); |
|
|
|
|
|
|
|
|
|
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) |
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH_SLOW_MODE) |
|
|
if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
|
|
|
if (axis == Z_AXIS && bltouch.deploy()) return; // Intermediate DEPLOY (in LOW SPEED MODE)
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis)); |
|
|
// Slow move towards endstop until triggered
|
|
|
|
|
|
const float rebump = bump * 2; |
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Re-bump: ", rebump, "mm"); |
|
|
|
|
|
do_homing_move(axis, rebump, get_homing_bump_feedrate(axis)); |
|
|
|
|
|
|
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) |
|
|
#if BOTH(HOMING_Z_WITH_PROBE, BLTOUCH) |
|
|
if (axis == Z_AXIS) bltouch.stow(); // The final STOW
|
|
|
if (axis == Z_AXIS) bltouch.stow(); // The final STOW
|
|
|