🐛 Fix G33, Delta radii, reachable (#22795)
This commit is contained in:
committed by
Scott Lahteine
parent
39a81d167e
commit
656034d2d9
@ -768,14 +768,11 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
||||
|
||||
// On delta keep Z below clip height or do_blocking_move_to will abort
|
||||
xyz_pos_t npos = { rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, current_position.z), current_position.z) };
|
||||
if (probe_relative) { // The given position is in terms of the probe
|
||||
if (!can_reach(npos)) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
|
||||
return NAN;
|
||||
}
|
||||
npos -= offset_xy; // Get the nozzle position
|
||||
if (!can_reach(npos, probe_relative)) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
|
||||
return NAN;
|
||||
}
|
||||
else if (!position_is_reachable(npos)) return NAN; // The given position is in terms of the nozzle
|
||||
if (probe_relative) npos -= offset_xy; // Get the nozzle position
|
||||
|
||||
// Move the probe to the starting XYZ
|
||||
do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
|
||||
|
@ -77,13 +77,20 @@ public:
|
||||
#if HAS_PROBE_XY_OFFSET
|
||||
// Return true if the both nozzle and the probe can reach the given point.
|
||||
// Note: This won't work on SCARA since the probe offset rotates with the arm.
|
||||
static bool can_reach(const_float_t rx, const_float_t ry) {
|
||||
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y) // The nozzle can go where it needs to go?
|
||||
&& position_is_reachable(rx, ry, ABS(PROBING_MARGIN)); // Can the nozzle also go near there?
|
||||
static bool can_reach(const_float_t rx, const_float_t ry, const bool probe_relative=true) {
|
||||
if (probe_relative) {
|
||||
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y) // The nozzle can go where it needs to go?
|
||||
&& position_is_reachable(rx, ry, PROBING_MARGIN); // Can the probe also go near there?
|
||||
}
|
||||
else {
|
||||
return position_is_reachable(rx, ry)
|
||||
&& position_is_reachable(rx + offset_xy.x, ry + offset_xy.y, PROBING_MARGIN);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static bool can_reach(const_float_t rx, const_float_t ry) {
|
||||
return position_is_reachable(rx, ry, PROBING_MARGIN);
|
||||
static bool can_reach(const_float_t rx, const_float_t ry, const bool=true) {
|
||||
return position_is_reachable(rx, ry)
|
||||
&& position_is_reachable(rx, ry, PROBING_MARGIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -96,10 +103,17 @@ public:
|
||||
* Example: For a probe offset of -10,+10, then for the probe to reach 0,0 the
|
||||
* nozzle must be be able to reach +10,-10.
|
||||
*/
|
||||
static bool can_reach(const_float_t rx, const_float_t ry) {
|
||||
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
|
||||
&& COORDINATE_OKAY(rx, min_x() - fslop, max_x() + fslop)
|
||||
&& COORDINATE_OKAY(ry, min_y() - fslop, max_y() + fslop);
|
||||
static bool can_reach(const_float_t rx, const_float_t ry, const bool probe_relative=true) {
|
||||
if (probe_relative) {
|
||||
return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
|
||||
&& COORDINATE_OKAY(rx, min_x() - fslop, max_x() + fslop)
|
||||
&& COORDINATE_OKAY(ry, min_y() - fslop, max_y() + fslop);
|
||||
}
|
||||
else {
|
||||
return position_is_reachable(rx, ry)
|
||||
&& COORDINATE_OKAY(rx + offset_xy.x, min_x() - fslop, max_x() + fslop)
|
||||
&& COORDINATE_OKAY(ry + offset_xy.y, min_y() - fslop, max_y() + fslop);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -120,7 +134,7 @@ public:
|
||||
|
||||
static bool set_deployed(const bool) { return false; }
|
||||
|
||||
static bool can_reach(const_float_t rx, const_float_t ry) { return position_is_reachable(rx, ry); }
|
||||
static bool can_reach(const_float_t rx, const_float_t ry, const bool=true) { return position_is_reachable(rx, ry); }
|
||||
|
||||
#endif
|
||||
|
||||
@ -132,7 +146,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool can_reach(const xy_pos_t &pos) { return can_reach(pos.x, pos.y); }
|
||||
static bool can_reach(const xy_pos_t &pos, const bool probe_relative=true) { return can_reach(pos.x, pos.y, probe_relative); }
|
||||
|
||||
static bool good_bounds(const xy_pos_t &lf, const xy_pos_t &rb) {
|
||||
return (
|
||||
@ -161,30 +175,30 @@ public:
|
||||
TERN_(DELTA, DELTA_PRINTABLE_RADIUS)
|
||||
TERN_(IS_SCARA, SCARA_PRINTABLE_RADIUS)
|
||||
);
|
||||
static constexpr float probe_radius(const xy_pos_t &probe_offset_xy = offset_xy) {
|
||||
static constexpr float probe_radius(const xy_pos_t &probe_offset_xy=offset_xy) {
|
||||
return printable_radius - _MAX(PROBING_MARGIN, HYPOT(probe_offset_xy.x, probe_offset_xy.y));
|
||||
}
|
||||
#endif
|
||||
|
||||
static constexpr float _min_x(const xy_pos_t &probe_offset_xy = offset_xy) {
|
||||
static constexpr float _min_x(const xy_pos_t &probe_offset_xy=offset_xy) {
|
||||
return TERN(IS_KINEMATIC,
|
||||
(X_CENTER) - probe_radius(probe_offset_xy),
|
||||
_MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + probe_offset_xy.x)
|
||||
);
|
||||
}
|
||||
static constexpr float _max_x(const xy_pos_t &probe_offset_xy = offset_xy) {
|
||||
static constexpr float _max_x(const xy_pos_t &probe_offset_xy=offset_xy) {
|
||||
return TERN(IS_KINEMATIC,
|
||||
(X_CENTER) + probe_radius(probe_offset_xy),
|
||||
_MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + probe_offset_xy.x)
|
||||
);
|
||||
}
|
||||
static constexpr float _min_y(const xy_pos_t &probe_offset_xy = offset_xy) {
|
||||
static constexpr float _min_y(const xy_pos_t &probe_offset_xy=offset_xy) {
|
||||
return TERN(IS_KINEMATIC,
|
||||
(Y_CENTER) - probe_radius(probe_offset_xy),
|
||||
_MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + probe_offset_xy.y)
|
||||
);
|
||||
}
|
||||
static constexpr float _max_y(const xy_pos_t &probe_offset_xy = offset_xy) {
|
||||
static constexpr float _max_y(const xy_pos_t &probe_offset_xy=offset_xy) {
|
||||
return TERN(IS_KINEMATIC,
|
||||
(Y_CENTER) + probe_radius(probe_offset_xy),
|
||||
_MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + probe_offset_xy.y)
|
||||
|
Reference in New Issue
Block a user