Browse Source

Apply home offsets to probing, Z Safe Homing (#19423)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
InsanityAutomation 4 years ago
committed by GitHub
parent
commit
6375829448
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  2. 10
      Marlin/src/gcode/calibrate/G28.cpp
  3. 12
      Marlin/src/gcode/geometry/M206_M428.cpp
  4. 4
      Marlin/src/module/motion.h
  5. 52
      Marlin/src/module/probe.h

26
Marlin/src/gcode/bedlevel/abl/G29.cpp

@ -361,32 +361,24 @@ G29_TYPE GcodeSuite::G29() {
if (parser.seen('H')) {
const int16_t size = (int16_t)parser.value_linear_units();
probe_position_lf.set(
_MAX(X_CENTER - size / 2, x_min),
_MAX(Y_CENTER - size / 2, y_min)
);
probe_position_rb.set(
_MIN(probe_position_lf.x + size, x_max),
_MIN(probe_position_lf.y + size, y_max)
);
probe_position_lf.set(_MAX((X_CENTER) - size / 2, x_min), _MAX((Y_CENTER) - size / 2, y_min));
probe_position_rb.set(_MIN(probe_position_lf.x + size, x_max), _MIN(probe_position_lf.y + size, y_max));
}
else {
probe_position_lf.set(
parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
);
probe_position_rb.set(
parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
);
probe_position_lf.set(parser.linearval('L', x_min), parser.linearval('F', y_min));
probe_position_rb.set(parser.linearval('R', x_max), parser.linearval('B', y_max));
}
if (!probe.good_bounds(probe_position_lf, probe_position_rb)) {
if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPAIR("G29 L", probe_position_lf.x, " R", probe_position_rb.x,
" F", probe_position_lf.y, " B", probe_position_rb.y);
}
SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
G29_RETURN(false);
}
// probe at the points of a lattice grid
// Probe at the points of a lattice grid
gridSpacing.set((probe_position_rb.x - probe_position_lf.x) / (abl_grid_points.x - 1),
(probe_position_rb.y - probe_position_lf.y) / (abl_grid_points.y - 1));

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

@ -126,7 +126,15 @@
* Move the Z probe (or just the nozzle) to the safe homing point
* (Z is already at the right height)
*/
destination.set(safe_homing_xy, current_position.z);
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
#if HAS_HOME_OFFSET
xy_float_t okay_homing_xy = safe_homing_xy;
okay_homing_xy -= home_offset;
#else
constexpr xy_float_t okay_homing_xy = safe_homing_xy;
#endif
destination.set(okay_homing_xy, current_position.z);
TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);

12
Marlin/src/gcode/geometry/M206_M428.cpp

@ -28,6 +28,13 @@
#include "../../module/motion.h"
#include "../../lcd/marlinui.h"
#include "../../libs/buzzer.h"
#include "../../MarlinCore.h"
extern const char SP_Y_STR[], SP_Z_STR[];
void m206_report() {
SERIAL_ECHOLNPAIR_P(PSTR("M206 X"), home_offset.x, SP_Y_STR, home_offset.y, SP_Z_STR, home_offset.z);
}
/**
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
@ -46,7 +53,10 @@ void GcodeSuite::M206() {
if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
#endif
report_current_position();
if (!parser.seen("XYZ"))
m206_report();
else
report_current_position();
}
/**

4
Marlin/src/module/motion.h

@ -78,10 +78,6 @@ extern xyz_pos_t cartes;
#define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
#endif
#if ENABLED(Z_SAFE_HOMING)
constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
#endif
/**
* Feed rates are often configured with mm/m
* but the planner and stepper like mm/s units.

52
Marlin/src/module/probe.h

@ -133,53 +133,37 @@ public:
#if HAS_BED_PROBE || HAS_LEVELING
#if IS_KINEMATIC
static constexpr float printable_radius = (
#if ENABLED(DELTA)
DELTA_PRINTABLE_RADIUS
#elif IS_SCARA
SCARA_PRINTABLE_RADIUS
#endif
TERN_(DELTA, DELTA_PRINTABLE_RADIUS)
TERN_(IS_SCARA, SCARA_PRINTABLE_RADIUS)
);
static inline float probe_radius() {
return printable_radius - _MAX(PROBING_MARGIN, HYPOT(offset_xy.x, offset_xy.y));
}
#endif
static inline float min_x() {
return (
#if IS_KINEMATIC
(X_CENTER) - probe_radius()
#else
_MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x)
#endif
);
return TERN(IS_KINEMATIC,
(X_CENTER) - probe_radius(),
_MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x)
) - TERN0(NOZZLE_AS_PROBE, home_offset.x);
}
static inline float max_x() {
return (
#if IS_KINEMATIC
(X_CENTER) + probe_radius()
#else
_MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x)
#endif
);
return TERN(IS_KINEMATIC,
(X_CENTER) + probe_radius(),
_MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x)
) - TERN0(NOZZLE_AS_PROBE, home_offset.x);
}
static inline float min_y() {
return (
#if IS_KINEMATIC
(Y_CENTER) - probe_radius()
#else
_MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y)
#endif
);
return TERN(IS_KINEMATIC,
(Y_CENTER) - probe_radius(),
_MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y)
) - TERN0(NOZZLE_AS_PROBE, home_offset.y);
}
static inline float max_y() {
return (
#if IS_KINEMATIC
(Y_CENTER) + probe_radius()
#else
_MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y)
#endif
);
return TERN(IS_KINEMATIC,
(Y_CENTER) + probe_radius(),
_MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y)
) - TERN0(NOZZLE_AS_PROBE, home_offset.y);
}
#if NEEDS_THREE_PROBE_POINTS

Loading…
Cancel
Save