Browse Source

Allow Zero Endstops (e.g., for CNC) (#21120)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
deirdreobyrne 4 years ago
parent
commit
468e437390
No account linked to committer's email address

+ 2
- 2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

1118
   }
1118
   }
1119
 
1119
 
1120
   // If X or Y are not valid, use center of the bed values
1120
   // If X or Y are not valid, use center of the bed values
1121
-  if (!WITHIN(sx, X_MIN_BED, X_MAX_BED)) sx = X_CENTER;
1122
-  if (!WITHIN(sy, Y_MIN_BED, Y_MAX_BED)) sy = Y_CENTER;
1121
+  if (!COORDINATE_OKAY(sx, X_MIN_BED, X_MAX_BED)) sx = X_CENTER;
1122
+  if (!COORDINATE_OKAY(sy, Y_MIN_BED, Y_MAX_BED)) sy = Y_CENTER;
1123
 
1123
 
1124
   if (err_flag) return UBL_ERR;
1124
   if (err_flag) return UBL_ERR;
1125
 
1125
 

+ 15
- 7
Marlin/src/gcode/bedlevel/G26.cpp View File

319
           s.x = _GET_MESH_X(  i  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
319
           s.x = _GET_MESH_X(  i  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
320
           e.x = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
320
           e.x = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
321
 
321
 
322
-          LIMIT(s.x, X_MIN_POS + 1, X_MAX_POS - 1);
323
-          s.y = e.y = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
324
-          LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1);
322
+          #if HAS_ENDSTOPS
323
+            LIMIT(s.x, X_MIN_POS + 1, X_MAX_POS - 1);
324
+            s.y = e.y = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
325
+            LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1);
326
+          #else
327
+            s.y = e.y = _GET_MESH_Y(j);
328
+          #endif
325
 
329
 
326
           if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
330
           if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
327
             print_line_from_here_to_there(s, e);
331
             print_line_from_here_to_there(s, e);
339
             s.y = _GET_MESH_Y(  j  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
343
             s.y = _GET_MESH_Y(  j  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
340
             e.y = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
344
             e.y = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
341
 
345
 
342
-            s.x = e.x = constrain(_GET_MESH_X(i), X_MIN_POS + 1, X_MAX_POS - 1);
343
-            LIMIT(s.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
344
-            LIMIT(e.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
346
+            #if HAS_ENDSTOPS
347
+              s.x = e.x = constrain(_GET_MESH_X(i), X_MIN_POS + 1, X_MAX_POS - 1);
348
+              LIMIT(s.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
349
+              LIMIT(e.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
350
+            #else
351
+              s.x = e.x = _GET_MESH_X(i);
352
+            #endif
345
 
353
 
346
             if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
354
             if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y))
347
               print_line_from_here_to_there(s, e);
355
               print_line_from_here_to_there(s, e);
826
           #if IS_KINEMATIC
834
           #if IS_KINEMATIC
827
             // Check to make sure this segment is entirely on the bed, skip if not.
835
             // Check to make sure this segment is entirely on the bed, skip if not.
828
             if (!position_is_reachable(p) || !position_is_reachable(q)) continue;
836
             if (!position_is_reachable(p) || !position_is_reachable(q)) continue;
829
-          #else
837
+          #elif HAS_ENDSTOPS
830
             LIMIT(p.x, X_MIN_POS + 1, X_MAX_POS - 1); // Prevent hitting the endstops
838
             LIMIT(p.x, X_MIN_POS + 1, X_MAX_POS - 1); // Prevent hitting the endstops
831
             LIMIT(p.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
839
             LIMIT(p.y, Y_MIN_POS + 1, Y_MAX_POS - 1);
832
             LIMIT(q.x, X_MIN_POS + 1, X_MAX_POS - 1);
840
             LIMIT(q.x, X_MIN_POS + 1, X_MAX_POS - 1);

+ 1
- 1
Marlin/src/gcode/calibrate/M48.cpp View File

202
               if (verbose_level > 3)
202
               if (verbose_level > 3)
203
                 SERIAL_ECHOLNPAIR_P(PSTR("Moving inward: X"), next_pos.x, SP_Y_STR, next_pos.y);
203
                 SERIAL_ECHOLNPAIR_P(PSTR("Moving inward: X"), next_pos.x, SP_Y_STR, next_pos.y);
204
             }
204
             }
205
-          #else
205
+          #elif HAS_ENDSTOPS
206
             // For a rectangular bed just keep the probe in bounds
206
             // For a rectangular bed just keep the probe in bounds
207
             LIMIT(next_pos.x, X_MIN_POS, X_MAX_POS);
207
             LIMIT(next_pos.x, X_MIN_POS, X_MAX_POS);
208
             LIMIT(next_pos.y, Y_MIN_POS, Y_MAX_POS);
208
             LIMIT(next_pos.y, Y_MIN_POS, Y_MAX_POS);

+ 7
- 0
Marlin/src/inc/Conditionals_LCD.h View File

1195
     #define TOUCH_ORIENTATION    TOUCH_LANDSCAPE
1195
     #define TOUCH_ORIENTATION    TOUCH_LANDSCAPE
1196
   #endif
1196
   #endif
1197
 #endif
1197
 #endif
1198
+
1199
+#if ANY(USE_XMIN_PLUG, USE_YMIN_PLUG, USE_ZMIN_PLUG, USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG)
1200
+  #define HAS_ENDSTOPS 1
1201
+  #define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H)
1202
+#else
1203
+  #define COORDINATE_OKAY(N,L,H) true
1204
+#endif

+ 35
- 33
Marlin/src/inc/SanityCheck.h View File

2016
   && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
2016
   && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) )
2017
 #define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
2017
 #define _AXIS_PLUG_UNUSED_TEST(A) (_PLUG_UNUSED_TEST(A,X) && _PLUG_UNUSED_TEST(A,Y) && _PLUG_UNUSED_TEST(A,Z))
2018
 
2018
 
2019
-// At least 3 endstop plugs must be used
2020
-#if _AXIS_PLUG_UNUSED_TEST(X)
2021
-  #error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
2022
-#endif
2023
-#if _AXIS_PLUG_UNUSED_TEST(Y)
2024
-  #error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
2025
-#endif
2026
-#if _AXIS_PLUG_UNUSED_TEST(Z)
2027
-  #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
2028
-#endif
2029
-
2030
-// Delta and Cartesian use 3 homing endstops
2031
-#if NONE(IS_SCARA, SPI_ENDSTOPS)
2032
-  #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
2033
-    #error "Enable USE_XMIN_PLUG when homing X to MIN."
2034
-  #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
2035
-    #error "Enable USE_XMAX_PLUG when homing X to MAX."
2036
-  #elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
2037
-    #error "Enable USE_YMIN_PLUG when homing Y to MIN."
2038
-  #elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
2039
-    #error "Enable USE_YMAX_PLUG when homing Y to MAX."
2040
-  #endif
2041
-#endif
2042
-
2043
-// Z homing direction and plug usage flags
2044
-#if Z_HOME_DIR < 0 && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
2045
-  #error "Enable USE_ZMIN_PLUG when homing Z to MIN."
2046
-#elif Z_HOME_DIR > 0 && ENABLED(USE_PROBE_FOR_Z_HOMING)
2047
-  #error "Z_HOME_DIR must be -1 when homing Z with the probe."
2048
-#elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
2049
-  #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
2050
-#elif Z_HOME_DIR > 0 && DISABLED(USE_ZMAX_PLUG)
2051
-  #error "Enable USE_ZMAX_PLUG when homing Z to MAX."
2019
+// A machine with endstops must have a minimum of 3
2020
+#if HAS_ENDSTOPS
2021
+  #if _AXIS_PLUG_UNUSED_TEST(X)
2022
+    #error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG."
2023
+  #endif
2024
+  #if _AXIS_PLUG_UNUSED_TEST(Y)
2025
+    #error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG."
2026
+  #endif
2027
+  #if _AXIS_PLUG_UNUSED_TEST(Z)
2028
+    #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG."
2029
+  #endif
2030
+
2031
+  // Delta and Cartesian use 3 homing endstops
2032
+  #if NONE(IS_SCARA, SPI_ENDSTOPS)
2033
+    #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
2034
+      #error "Enable USE_XMIN_PLUG when homing X to MIN."
2035
+    #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
2036
+      #error "Enable USE_XMAX_PLUG when homing X to MAX."
2037
+    #elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
2038
+      #error "Enable USE_YMIN_PLUG when homing Y to MIN."
2039
+    #elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
2040
+      #error "Enable USE_YMAX_PLUG when homing Y to MAX."
2041
+    #endif
2042
+  #endif
2043
+
2044
+  // Z homing direction and plug usage flags
2045
+  #if Z_HOME_DIR < 0 && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE)
2046
+    #error "Enable USE_ZMIN_PLUG when homing Z to MIN."
2047
+  #elif Z_HOME_DIR > 0 && ENABLED(USE_PROBE_FOR_Z_HOMING)
2048
+    #error "Z_HOME_DIR must be -1 when homing Z with the probe."
2049
+  #elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS)
2050
+    #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING."
2051
+  #elif Z_HOME_DIR > 0 && DISABLED(USE_ZMAX_PLUG)
2052
+    #error "Enable USE_ZMAX_PLUG when homing Z to MAX."
2053
+  #endif
2052
 #endif
2054
 #endif
2053
 
2055
 
2054
 #if BOTH(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING)
2056
 #if BOTH(HOME_Z_FIRST, USE_PROBE_FOR_Z_HOMING)

+ 3
- 9
Marlin/src/libs/L64XX/L64XX_Marlin.cpp View File

446
       position_max = X_center + displacement;
446
       position_max = X_center + displacement;
447
       echo_min_max('X', position_min, position_max);
447
       echo_min_max('X', position_min, position_max);
448
       if (false
448
       if (false
449
-        #ifdef X_MIN_POS
449
+        #if HAS_ENDSTOPS
450
           || position_min < (X_MIN_POS)
450
           || position_min < (X_MIN_POS)
451
-        #endif
452
-        #ifdef X_MAX_POS
453
           || position_max > (X_MAX_POS)
451
           || position_max > (X_MAX_POS)
454
         #endif
452
         #endif
455
       ) {
453
       ) {
463
       position_max = Y_center + displacement;
461
       position_max = Y_center + displacement;
464
       echo_min_max('Y', position_min, position_max);
462
       echo_min_max('Y', position_min, position_max);
465
       if (false
463
       if (false
466
-        #ifdef Y_MIN_POS
464
+        #if HAS_ENDSTOPS
467
           || position_min < (Y_MIN_POS)
465
           || position_min < (Y_MIN_POS)
468
-        #endif
469
-        #ifdef Y_MAX_POS
470
           || position_max > (Y_MAX_POS)
466
           || position_max > (Y_MAX_POS)
471
         #endif
467
         #endif
472
       ) {
468
       ) {
480
       position_max = Z_center + displacement;
476
       position_max = Z_center + displacement;
481
       echo_min_max('Z', position_min, position_max);
477
       echo_min_max('Z', position_min, position_max);
482
       if (false
478
       if (false
483
-        #ifdef Z_MIN_POS
479
+        #if HAS_ENDSTOPS
484
           || position_min < (Z_MIN_POS)
480
           || position_min < (Z_MIN_POS)
485
-        #endif
486
-        #ifdef Z_MAX_POS
487
           || position_max > (Z_MAX_POS)
481
           || position_max > (Z_MAX_POS)
488
         #endif
482
         #endif
489
       ) {
483
       ) {

+ 631
- 634
Marlin/src/module/motion.cpp
File diff suppressed because it is too large
View File


+ 47
- 24
Marlin/src/module/motion.h View File

284
  * Homing and Trusted Axes
284
  * Homing and Trusted Axes
285
  */
285
  */
286
 constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
286
 constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
287
-extern uint8_t axis_homed, axis_trusted;
288
 
287
 
289
-void homeaxis(const AxisEnum axis);
290
 void set_axis_is_at_home(const AxisEnum axis);
288
 void set_axis_is_at_home(const AxisEnum axis);
291
-void set_axis_never_homed(const AxisEnum axis);
292
-uint8_t axes_should_home(uint8_t axis_bits=0x07);
293
-bool homing_needed_error(uint8_t axis_bits=0x07);
294
-
295
-FORCE_INLINE bool axis_was_homed(const AxisEnum axis)     { return TEST(axis_homed, axis); }
296
-FORCE_INLINE bool axis_is_trusted(const AxisEnum axis)    { return TEST(axis_trusted, axis); }
297
-FORCE_INLINE bool axis_should_home(const AxisEnum axis)   { return (axes_should_home() & _BV(axis)) != 0; }
298
-FORCE_INLINE bool no_axes_homed()                         { return !axis_homed; }
299
-FORCE_INLINE bool all_axes_homed()                        { return xyz_bits == (axis_homed & xyz_bits); }
300
-FORCE_INLINE bool homing_needed()                         { return !all_axes_homed(); }
301
-FORCE_INLINE bool all_axes_trusted()                      { return xyz_bits == (axis_trusted & xyz_bits); }
302
-FORCE_INLINE void set_axis_homed(const AxisEnum axis)     { SBI(axis_homed, axis); }
303
-FORCE_INLINE void set_axis_unhomed(const AxisEnum axis)   { CBI(axis_homed, axis); }
304
-FORCE_INLINE void set_axis_trusted(const AxisEnum axis)   { SBI(axis_trusted, axis); }
305
-FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
306
-FORCE_INLINE void set_all_homed()                         { axis_homed = axis_trusted = xyz_bits; }
307
-FORCE_INLINE void set_all_unhomed()                       { axis_homed = axis_trusted = 0; }
289
+
290
+#if HAS_ENDSTOPS
291
+  /**
292
+   * axis_homed
293
+   *   Flags that each linear axis was homed.
294
+   *   XYZ on cartesian, ABC on delta, ABZ on SCARA.
295
+   *
296
+   * axis_trusted
297
+   *   Flags that the position is trusted in each linear axis. Set when homed.
298
+   *   Cleared whenever a stepper powers off, potentially losing its position.
299
+   */
300
+  extern uint8_t axis_homed, axis_trusted;
301
+  void homeaxis(const AxisEnum axis);
302
+  void set_axis_never_homed(const AxisEnum axis);
303
+  uint8_t axes_should_home(uint8_t axis_bits=0x07);
304
+  bool homing_needed_error(uint8_t axis_bits=0x07);
305
+  FORCE_INLINE void set_axis_unhomed(const AxisEnum axis)   { CBI(axis_homed, axis); }
306
+  FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
307
+  FORCE_INLINE void set_all_unhomed()                       { axis_homed = axis_trusted = 0; }
308
+  FORCE_INLINE void set_axis_homed(const AxisEnum axis)     { SBI(axis_homed, axis); }
309
+  FORCE_INLINE void set_axis_trusted(const AxisEnum axis)   { SBI(axis_trusted, axis); }
310
+  FORCE_INLINE void set_all_homed()                         { axis_homed = axis_trusted = xyz_bits; }
311
+#else
312
+  constexpr uint8_t axis_homed = xyz_bits, axis_trusted = xyz_bits; // Zero-endstop machines are always homed and trusted
313
+  FORCE_INLINE void homeaxis(const AxisEnum axis)           {}
314
+  FORCE_INLINE void set_axis_never_homed(const AxisEnum)    {}
315
+  FORCE_INLINE uint8_t axes_should_home(uint8_t=0x07)       { return false; }
316
+  FORCE_INLINE bool homing_needed_error(uint8_t=0x07)       { return false; }
317
+  FORCE_INLINE void set_axis_unhomed(const AxisEnum axis)   {}
318
+  FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) {}
319
+  FORCE_INLINE void set_all_unhomed()                       {}
320
+  FORCE_INLINE void set_axis_homed(const AxisEnum axis)     {}
321
+  FORCE_INLINE void set_axis_trusted(const AxisEnum axis)   {}
322
+  FORCE_INLINE void set_all_homed()                         {}
323
+#endif
324
+
325
+FORCE_INLINE bool axis_was_homed(const AxisEnum axis)       { return TEST(axis_homed, axis); }
326
+FORCE_INLINE bool axis_is_trusted(const AxisEnum axis)      { return TEST(axis_trusted, axis); }
327
+FORCE_INLINE bool axis_should_home(const AxisEnum axis)     { return (axes_should_home() & _BV(axis)) != 0; }
328
+FORCE_INLINE bool no_axes_homed()                           { return !axis_homed; }
329
+FORCE_INLINE bool all_axes_homed()                          { return xyz_bits == (axis_homed & xyz_bits); }
330
+FORCE_INLINE bool homing_needed()                           { return !all_axes_homed(); }
331
+FORCE_INLINE bool all_axes_trusted()                        { return xyz_bits == (axis_trusted & xyz_bits); }
308
 
332
 
309
 #if ENABLED(NO_MOTION_BEFORE_HOMING)
333
 #if ENABLED(NO_MOTION_BEFORE_HOMING)
310
   #define MOTION_CONDITIONS (IsRunning() && !homing_needed_error())
334
   #define MOTION_CONDITIONS (IsRunning() && !homing_needed_error())
360
 /**
384
 /**
361
  * position_is_reachable family of functions
385
  * position_is_reachable family of functions
362
  */
386
  */
363
-
364
 #if IS_KINEMATIC // (DELTA or SCARA)
387
 #if IS_KINEMATIC // (DELTA or SCARA)
365
 
388
 
366
   #if HAS_SCARA_OFFSET
389
   #if HAS_SCARA_OFFSET
390
 
413
 
391
   // Return true if the given position is within the machine bounds.
414
   // Return true if the given position is within the machine bounds.
392
   inline bool position_is_reachable(const float &rx, const float &ry) {
415
   inline bool position_is_reachable(const float &rx, const float &ry) {
393
-    if (!WITHIN(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false;
416
+    if (!COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false;
394
     #if ENABLED(DUAL_X_CARRIAGE)
417
     #if ENABLED(DUAL_X_CARRIAGE)
395
       if (active_extruder)
418
       if (active_extruder)
396
-        return WITHIN(rx, X2_MIN_POS - fslop, X2_MAX_POS + fslop);
419
+        return COORDINATE_OKAY(rx, X2_MIN_POS - fslop, X2_MAX_POS + fslop);
397
       else
420
       else
398
-        return WITHIN(rx, X1_MIN_POS - fslop, X1_MAX_POS + fslop);
421
+        return COORDINATE_OKAY(rx, X1_MIN_POS - fslop, X1_MAX_POS + fslop);
399
     #else
422
     #else
400
-      return WITHIN(rx, X_MIN_POS - fslop, X_MAX_POS + fslop);
423
+      return COORDINATE_OKAY(rx, X_MIN_POS - fslop, X_MAX_POS + fslop);
401
     #endif
424
     #endif
402
   }
425
   }
403
   inline bool position_is_reachable(const xy_pos_t &pos) { return position_is_reachable(pos.x, pos.y); }
426
   inline bool position_is_reachable(const xy_pos_t &pos) { return position_is_reachable(pos.x, pos.y); }

+ 4
- 4
Marlin/src/module/planner.h View File

564
     #if ENABLED(SKEW_CORRECTION)
564
     #if ENABLED(SKEW_CORRECTION)
565
 
565
 
566
       FORCE_INLINE static void skew(float &cx, float &cy, const float &cz) {
566
       FORCE_INLINE static void skew(float &cx, float &cy, const float &cz) {
567
-        if (WITHIN(cx, X_MIN_POS + 1, X_MAX_POS) && WITHIN(cy, Y_MIN_POS + 1, Y_MAX_POS)) {
567
+        if (COORDINATE_OKAY(cx, X_MIN_POS + 1, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS + 1, Y_MAX_POS)) {
568
           const float sx = cx - cy * skew_factor.xy - cz * (skew_factor.xz - (skew_factor.xy * skew_factor.yz)),
568
           const float sx = cx - cy * skew_factor.xy - cz * (skew_factor.xz - (skew_factor.xy * skew_factor.yz)),
569
                       sy = cy - cz * skew_factor.yz;
569
                       sy = cy - cz * skew_factor.yz;
570
-          if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) {
570
+          if (COORDINATE_OKAY(sx, X_MIN_POS, X_MAX_POS) && COORDINATE_OKAY(sy, Y_MIN_POS, Y_MAX_POS)) {
571
             cx = sx; cy = sy;
571
             cx = sx; cy = sy;
572
           }
572
           }
573
         }
573
         }
575
       FORCE_INLINE static void skew(xyz_pos_t &raw) { skew(raw.x, raw.y, raw.z); }
575
       FORCE_INLINE static void skew(xyz_pos_t &raw) { skew(raw.x, raw.y, raw.z); }
576
 
576
 
577
       FORCE_INLINE static void unskew(float &cx, float &cy, const float &cz) {
577
       FORCE_INLINE static void unskew(float &cx, float &cy, const float &cz) {
578
-        if (WITHIN(cx, X_MIN_POS, X_MAX_POS) && WITHIN(cy, Y_MIN_POS, Y_MAX_POS)) {
578
+        if (COORDINATE_OKAY(cx, X_MIN_POS, X_MAX_POS) && COORDINATE_OKAY(cy, Y_MIN_POS, Y_MAX_POS)) {
579
           const float sx = cx + cy * skew_factor.xy + cz * skew_factor.xz,
579
           const float sx = cx + cy * skew_factor.xy + cz * skew_factor.xz,
580
                       sy = cy + cz * skew_factor.yz;
580
                       sy = cy + cz * skew_factor.yz;
581
-          if (WITHIN(sx, X_MIN_POS, X_MAX_POS) && WITHIN(sy, Y_MIN_POS, Y_MAX_POS)) {
581
+          if (COORDINATE_OKAY(sx, X_MIN_POS, X_MAX_POS) && COORDINATE_OKAY(sy, Y_MIN_POS, Y_MAX_POS)) {
582
             cx = sx; cy = sy;
582
             cx = sx; cy = sy;
583
           }
583
           }
584
         }
584
         }

+ 4
- 4
Marlin/src/module/probe.h View File

92
        */
92
        */
93
       static bool can_reach(const float &rx, const float &ry) {
93
       static bool can_reach(const float &rx, const float &ry) {
94
         return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
94
         return position_is_reachable(rx - offset_xy.x, ry - offset_xy.y)
95
-            && WITHIN(rx, min_x() - fslop, max_x() + fslop)
96
-            && WITHIN(ry, min_y() - fslop, max_y() + fslop);
95
+            && COORDINATE_OKAY(rx, min_x() - fslop, max_x() + fslop)
96
+            && COORDINATE_OKAY(ry, min_y() - fslop, max_y() + fslop);
97
       }
97
       }
98
 
98
 
99
     #endif
99
     #endif
206
         #if IS_KINEMATIC
206
         #if IS_KINEMATIC
207
           return HYPOT2(x, y) <= sq(probe_radius(default_probe_xy_offset));
207
           return HYPOT2(x, y) <= sq(probe_radius(default_probe_xy_offset));
208
         #else
208
         #else
209
-          return WITHIN(x, _min_x(default_probe_xy_offset) - fslop, _max_x(default_probe_xy_offset) + fslop)
210
-              && WITHIN(y, _min_y(default_probe_xy_offset) - fslop, _max_y(default_probe_xy_offset) + fslop);
209
+          return COORDINATE_OKAY(x, _min_x(default_probe_xy_offset) - fslop, _max_x(default_probe_xy_offset) + fslop)
210
+              && COORDINATE_OKAY(y, _min_y(default_probe_xy_offset) - fslop, _max_y(default_probe_xy_offset) + fslop);
211
         #endif
211
         #endif
212
       }
212
       }
213
 
213
 

+ 8
- 0
buildroot/tests/teensy31-tests View File

11
 exec_test $1 $2 "Teensy3.1 with default config" "$3"
11
 exec_test $1 $2 "Teensy3.1 with default config" "$3"
12
 
12
 
13
 #
13
 #
14
+# Zero endstops, as with a CNC
15
+#
16
+restore_configs
17
+opt_set MOTHERBOARD BOARD_TEENSY31_32
18
+opt_disable USE_XMIN_PLUG USE_YMIN_PLUG USE_ZMIN_PLUG
19
+exec_test $1 $2 "Teensy3.1 with Zero Endstops" "$3"
20
+
21
+#
14
 # Test many features together
22
 # Test many features together
15
 #
23
 #
16
 restore_configs
24
 restore_configs

Loading…
Cancel
Save