1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

Homing backoff per-axis / delta Z (#14789)

This commit is contained in:
InsanityAutomation 2019-07-31 21:50:23 -04:00 committed by Scott Lahteine
parent 0c035c0a7a
commit 6f8b8c394d
3 changed files with 19 additions and 9 deletions

View File

@ -391,15 +391,6 @@ void GcodeSuite::G28(const bool always_home_all) {
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
#ifdef HOMING_BACKOFF_MM
endstops.enable(false);
constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0,
backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0,
backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0;
if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z);
if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y);
#endif
endstops.not_homing(); endstops.not_homing();
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE) #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)

View File

@ -423,6 +423,9 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) { void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) {
do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s); do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
} }
void do_blocking_move_to_y(const float &ry, const float &fr_mm_s/*=0.0*/) {
do_blocking_move_to(current_position[Y_AXIS], ry, current_position[Z_AXIS], fr_mm_s);
}
void do_blocking_move_to_z(const float &rz, const float &fr_mm_s/*=0.0*/) { void do_blocking_move_to_z(const float &rz, const float &fr_mm_s/*=0.0*/) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], rz, fr_mm_s); do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], rz, fr_mm_s);
} }
@ -1599,6 +1602,21 @@ void homeaxis(const AxisEnum axis) {
if (axis == Z_AXIS && STOW_PROBE()) return; if (axis == Z_AXIS && STOW_PROBE()) return;
#endif #endif
#ifdef HOMING_BACKOFF_MM
constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
const AxisEnum backoff_mm = endstop_backoff[
#if ENABLED(DELTA)
Z_AXIS
#else
axis
#endif
];
if (backoff_mm) {
current_position[axis] -= ABS(backoff_mm) * axis_home_dir;
line_to_current_position();
}
#endif
// Clear retracted status if homing the Z axis // Clear retracted status if homing the Z axis
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
if (axis == Z_AXIS) fwretract.current_hop = 0.0; if (axis == Z_AXIS) fwretract.current_hop = 0.0;

View File

@ -185,6 +185,7 @@ void prepare_move_to_destination();
*/ */
void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s=0); void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s=0);
void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0); void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0);
void do_blocking_move_to_y(const float &ry, const float &fr_mm_s=0);
void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0); void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0);
void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0); void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0);