Browse Source

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

pull/1/head
InsanityAutomation 5 years ago
committed by Scott Lahteine
parent
commit
6f8b8c394d
  1. 9
      Marlin/src/gcode/calibrate/G28.cpp
  2. 18
      Marlin/src/module/motion.cpp
  3. 1
      Marlin/src/module/motion.h

9
Marlin/src/gcode/calibrate/G28.cpp

@ -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)

18
Marlin/src/module/motion.cpp

@ -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;

1
Marlin/src/module/motion.h

@ -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);

Loading…
Cancel
Save