Browse Source

Fix position_is_reachable_by_probe typo, add comment

Fix #10029
Scott Lahteine 7 years ago
parent
commit
6d9ea7e184
1 changed files with 16 additions and 8 deletions
  1. 16
    8
      Marlin/src/module/motion.h

+ 16
- 8
Marlin/src/module/motion.h View File

236
 
236
 
237
 #if IS_KINEMATIC // (DELTA or SCARA)
237
 #if IS_KINEMATIC // (DELTA or SCARA)
238
 
238
 
239
+  // Return true if the given point is within the printable area
239
   inline bool position_is_reachable(const float &rx, const float &ry) {
240
   inline bool position_is_reachable(const float &rx, const float &ry) {
240
     #if ENABLED(DELTA)
241
     #if ENABLED(DELTA)
241
       return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
242
       return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
251
     #endif
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
   inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
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
     return position_is_reachable(rx, ry)
258
     return position_is_reachable(rx, ry)
260
         && position_is_reachable(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ry - (Y_PROBE_OFFSET_FROM_EXTRUDER));
259
         && position_is_reachable(rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ry - (Y_PROBE_OFFSET_FROM_EXTRUDER));
261
   }
260
   }
262
 
261
 
263
 #else // CARTESIAN
262
 #else // CARTESIAN
264
 
263
 
264
+   // Return true if the given position is within the machine bounds.
265
   inline bool position_is_reachable(const float &rx, const float &ry) {
265
   inline bool position_is_reachable(const float &rx, const float &ry) {
266
     // Add 0.001 margin to deal with float imprecision
266
     // Add 0.001 margin to deal with float imprecision
267
     return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
267
     return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
268
         && WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
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
   inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
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
 #endif // CARTESIAN
286
 #endif // CARTESIAN

Loading…
Cancel
Save