|
@@ -236,6 +236,7 @@ void homeaxis(const AxisEnum axis);
|
236
|
236
|
|
237
|
237
|
#if IS_KINEMATIC // (DELTA or SCARA)
|
238
|
238
|
|
|
239
|
+ // Return true if the given point is within the printable area
|
239
|
240
|
inline bool position_is_reachable(const float &rx, const float &ry) {
|
240
|
241
|
#if ENABLED(DELTA)
|
241
|
242
|
return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
|
|
@@ -251,28 +252,35 @@ void homeaxis(const AxisEnum axis);
|
251
|
252
|
#endif
|
252
|
253
|
}
|
253
|
254
|
|
|
255
|
+ // Return true if the both nozzle and the probe can reach the given point.
|
|
256
|
+ // Note: This won't work on SCARA since the probe offset rotates with the arm.
|
254
|
257
|
inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
|
255
|
|
-
|
256
|
|
- // Both the nozzle and the probe must be able to reach the point.
|
257
|
|
- // This won't work on SCARA since the probe offset rotates with the arm.
|
258
|
|
-
|
259
|
258
|
return position_is_reachable(rx, ry)
|
260
|
259
|
&& position_is_reachable(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ry - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
261
|
260
|
}
|
262
|
261
|
|
263
|
262
|
#else // CARTESIAN
|
264
|
263
|
|
|
264
|
+ // Return true if the given position is within the machine bounds.
|
265
|
265
|
inline bool position_is_reachable(const float &rx, const float &ry) {
|
266
|
266
|
// Add 0.001 margin to deal with float imprecision
|
267
|
267
|
return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
|
268
|
268
|
&& WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
|
269
|
269
|
}
|
270
|
270
|
|
|
271
|
+ /**
|
|
272
|
+ * Return whether the given position is within the bed, and whether the nozzle
|
|
273
|
+ * can reach the position required to put the probe at the given position.
|
|
274
|
+ *
|
|
275
|
+ * Example: For a probe offset of -10,+10, then for the probe to reach 0,0 the
|
|
276
|
+ * nozzle must be be able to reach +10,-10.
|
|
277
|
+ */
|
271
|
278
|
inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
|
272
|
|
- const float nx = rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ry - (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
273
|
|
- return position_is_reachable(rx, ry)
|
274
|
|
- && WITHIN(nx, X_MIN_BED - 0.001, X_MAX_BED + 0.001)
|
275
|
|
- && WITHIN(ny, Y_MIN_BED - 0.001, Y_MAX_BED + 0.001);
|
|
279
|
+ const float nx = rx - (X_PROBE_OFFSET_FROM_EXTRUDER),
|
|
280
|
+ ny = ry - (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
281
|
+ return position_is_reachable(nx, ny)
|
|
282
|
+ && WITHIN(rx, X_MIN_BED - 0.001, X_MAX_BED + 0.001)
|
|
283
|
+ && WITHIN(ry, Y_MIN_BED - 0.001, Y_MAX_BED + 0.001);
|
276
|
284
|
}
|
277
|
285
|
|
278
|
286
|
#endif // CARTESIAN
|