Make position_is_reachable() smarter about IDEX machines`

On many IDEX machines the allowed travel of the X1 carraige and X2 carraige does not perfectly overlap.

This helps the issue.   But more work needs to be done at the higher level.  (For example the X1_MAX_POS should probably be factored into G26's mesh validation pattern.)
This commit is contained in:
Roxy-3D 2018-08-21 19:12:26 -05:00 committed by GitHub
parent 97f6396b25
commit cd9868f442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -267,9 +267,21 @@ void homeaxis(const AxisEnum axis);
// Return true if the given position is within the machine bounds. // Return true if the given position is within the machine bounds.
inline bool position_is_reachable(const float &rx, const float &ry) { inline bool position_is_reachable(const float &rx, const float &ry) {
// Add 0.001 margin to deal with float imprecision #if ENABLED(DUAL_X_CARRIAGE)
return WITHIN(rx, X_MIN_POS - 0.001f, X_MAX_POS + 0.001f) if (active_extruder == 0) {
&& WITHIN(ry, Y_MIN_POS - 0.001f, Y_MAX_POS + 0.001f); // 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);
}
#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);
#endif
} }
#if HAS_BED_PROBE #if HAS_BED_PROBE