|
|
|
@ -36,6 +36,9 @@
|
|
|
|
|
#include "../module/scara.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Error margin to work around float imprecision
|
|
|
|
|
constexpr float slop = 0.0001;
|
|
|
|
|
|
|
|
|
|
extern bool relative_mode;
|
|
|
|
|
|
|
|
|
|
extern float current_position[XYZE], // High-level current tool position
|
|
|
|
@ -267,20 +270,14 @@ void homeaxis(const AxisEnum axis);
|
|
|
|
|
|
|
|
|
|
// Return true if the given position is within the machine bounds.
|
|
|
|
|
inline bool position_is_reachable(const float &rx, const float &ry) {
|
|
|
|
|
if (!WITHIN(ry, Y_MIN_POS - slop, Y_MAX_POS + slop)) return false;
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
|
if (active_extruder == 0) {
|
|
|
|
|
// Add 0.001 margin to deal with float imprecision
|
|
|
|
|
return WITHIN(rx, X1_MIN_POS - 0.001f, X1_MAX_POS + 0.001f)
|
|
|
|
|
&& WITHIN(ry, Y_MIN_POS - 0.001f, Y_MAX_POS + 0.001f);
|
|
|
|
|
} else {
|
|
|
|
|
// Add 0.001 margin to deal with float imprecision
|
|
|
|
|
return WITHIN(rx, X2_MIN_POS - 0.001f, X2_MAX_POS + 0.001f)
|
|
|
|
|
&& WITHIN(ry, Y_MIN_POS - 0.001f, Y_MAX_POS + 0.001f);
|
|
|
|
|
}
|
|
|
|
|
if (active_extruder)
|
|
|
|
|
return WITHIN(rx, X2_MIN_POS - slop, X2_MAX_POS + slop);
|
|
|
|
|
else
|
|
|
|
|
return WITHIN(rx, X1_MIN_POS - slop, X1_MAX_POS + slop);
|
|
|
|
|
#else
|
|
|
|
|
// Add 0.001 margin to deal with float imprecision
|
|
|
|
|
return WITHIN(rx, X_MIN_POS - 0.001f, X_MAX_POS + 0.001f)
|
|
|
|
|
&& WITHIN(ry, Y_MIN_POS - 0.001f, Y_MAX_POS + 0.001f);
|
|
|
|
|
return WITHIN(rx, X_MIN_POS - slop, X_MAX_POS + slop);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -294,8 +291,8 @@ void homeaxis(const AxisEnum axis);
|
|
|
|
|
*/
|
|
|
|
|
inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
|
|
|
|
|
return position_is_reachable(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ry - (Y_PROBE_OFFSET_FROM_EXTRUDER))
|
|
|
|
|
&& WITHIN(rx, MIN_PROBE_X - 0.001f, MAX_PROBE_X + 0.001f)
|
|
|
|
|
&& WITHIN(ry, MIN_PROBE_Y - 0.001f, MAX_PROBE_Y + 0.001f);
|
|
|
|
|
&& WITHIN(rx, MIN_PROBE_X - slop, MAX_PROBE_X + slop)
|
|
|
|
|
&& WITHIN(ry, MIN_PROBE_Y - slop, MAX_PROBE_Y + slop);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|