Document, adjust some homing code
This commit is contained in:
parent
5b33afb1dd
commit
a87e5197cf
|
@ -58,7 +58,7 @@ void ZStepperAlign::reset_to_default() {
|
||||||
"Z_STEPPER_ALIGN_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
"Z_STEPPER_ALIGN_XY point " STRINGIFY(N) " is not reachable with the default NOZZLE_TO_PROBE offset and PROBING_MARGIN.")
|
||||||
VALIDATE_ALIGN_POINT(0); VALIDATE_ALIGN_POINT(1); VALIDATE_ALIGN_POINT(2); VALIDATE_ALIGN_POINT(3);
|
VALIDATE_ALIGN_POINT(0); VALIDATE_ALIGN_POINT(1); VALIDATE_ALIGN_POINT(2); VALIDATE_ALIGN_POINT(3);
|
||||||
|
|
||||||
#else // !defined(Z_STEPPER_ALIGN_XY)
|
#else // !Z_STEPPER_ALIGN_XY
|
||||||
|
|
||||||
const xy_pos_t xy_init[] = {
|
const xy_pos_t xy_init[] = {
|
||||||
#if NUM_Z_STEPPER_DRIVERS >= 3 // First probe point...
|
#if NUM_Z_STEPPER_DRIVERS >= 3 // First probe point...
|
||||||
|
@ -99,7 +99,7 @@ void ZStepperAlign::reset_to_default() {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !defined(Z_STEPPER_ALIGN_XY)
|
#endif // !Z_STEPPER_ALIGN_XY
|
||||||
|
|
||||||
COPY(xy, xy_init);
|
COPY(xy, xy_init);
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -373,19 +373,19 @@ bool Probe::set_deployed(const bool deploy) {
|
||||||
// Fix-mounted probe should only raise for deploy
|
// Fix-mounted probe should only raise for deploy
|
||||||
// unless PAUSE_BEFORE_DEPLOY_STOW is enabled
|
// unless PAUSE_BEFORE_DEPLOY_STOW is enabled
|
||||||
#if EITHER(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) && DISABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
#if EITHER(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE) && DISABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
||||||
const bool deploy_stow_condition = deploy;
|
const bool z_raise_wanted = deploy;
|
||||||
#else
|
#else
|
||||||
constexpr bool deploy_stow_condition = true;
|
constexpr bool z_raise_wanted = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For beds that fall when Z is powered off only raise for trusted Z
|
// For beds that fall when Z is powered off only raise for trusted Z
|
||||||
#if ENABLED(UNKNOWN_Z_NO_RAISE)
|
#if ENABLED(UNKNOWN_Z_NO_RAISE)
|
||||||
const bool unknown_condition = axis_is_trusted(Z_AXIS);
|
const bool z_is_trusted = axis_is_trusted(Z_AXIS);
|
||||||
#else
|
#else
|
||||||
constexpr float unknown_condition = true;
|
constexpr float z_is_trusted = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (deploy_stow_condition && unknown_condition)
|
if (z_is_trusted && z_raise_wanted)
|
||||||
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
|
do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE));
|
||||||
|
|
||||||
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
|
#if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY)
|
||||||
|
|
Loading…
Reference in a new issue