Explorar el Código

Split the software endstop capability by axis.

Jeff Eberl hace 7 años
padre
commit
b206f70693

+ 22
- 2
Marlin/Configuration.h Ver fichero

785
 #define Y_MAX_POS Y_BED_SIZE
785
 #define Y_MAX_POS Y_BED_SIZE
786
 #define Z_MAX_POS 200
786
 #define Z_MAX_POS 200
787
 
787
 
788
-// If enabled, axes won't move below MIN_POS in response to movement commands.
788
+/**
789
+ * Software Endstops
790
+ *
791
+ * - Prevent moves outside the set machine bounds.
792
+ * - Individual axes can be disabled, if desired.
793
+ * - X and Y only apply to Cartesian robots.
794
+ * - Use 'M211' to set software endstops on/off or report current state
795
+ */
796
+
797
+// Min software endstops constrain movement within minimum coordinate bounds
789
 #define MIN_SOFTWARE_ENDSTOPS
798
 #define MIN_SOFTWARE_ENDSTOPS
790
-// If enabled, axes won't move above MAX_POS in response to movement commands.
799
+#if ENABLED(MIN_SOFTWARE_ENDSTOPS)
800
+  #define MIN_SOFTWARE_ENDSTOP_X
801
+  #define MIN_SOFTWARE_ENDSTOP_Y
802
+  #define MIN_SOFTWARE_ENDSTOP_Z
803
+#endif
804
+
805
+// Max software endstops constrain movement within maximum coordinate bounds
791
 #define MAX_SOFTWARE_ENDSTOPS
806
 #define MAX_SOFTWARE_ENDSTOPS
807
+#if ENABLED(MAX_SOFTWARE_ENDSTOPS)
808
+  #define MAX_SOFTWARE_ENDSTOP_X
809
+  #define MAX_SOFTWARE_ENDSTOP_Y
810
+  #define MAX_SOFTWARE_ENDSTOP_Z
811
+#endif
792
 
812
 
793
 /**
813
 /**
794
  * Filament Runout Sensor
814
  * Filament Runout Sensor

+ 11
- 1
Marlin/src/inc/Conditionals_post.h Ver fichero

793
   #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF))
793
   #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF))
794
 
794
 
795
   /**
795
   /**
796
-   * Delta radius/rod trimmers/angle trimmers
796
+   * Only constrain Z on DELTA / SCARA machines
797
+   */
798
+  #if IS_KINEMATIC
799
+    #undef MIN_SOFTWARE_ENDSTOP_X
800
+    #undef MIN_SOFTWARE_ENDSTOP_Y
801
+    #undef MAX_SOFTWARE_ENDSTOP_X
802
+    #undef MAX_SOFTWARE_ENDSTOP_Y
803
+  #endif
804
+
805
+  /**
806
+   * Delta endstops, radius/rod trimmers, angle trimmers
797
    */
807
    */
798
   #if ENABLED(DELTA)
808
   #if ENABLED(DELTA)
799
     #ifndef DELTA_CALIBRATION_RADIUS
809
     #ifndef DELTA_CALIBRATION_RADIUS

+ 19
- 0
Marlin/src/inc/SanityCheck.h Ver fichero

255
   "Movement bounds ([XY]_MIN_POS, [XY]_MAX_POS) are too narrow to contain [XY]_BED_SIZE.");
255
   "Movement bounds ([XY]_MIN_POS, [XY]_MAX_POS) are too narrow to contain [XY]_BED_SIZE.");
256
 
256
 
257
 /**
257
 /**
258
+ * Granular software endstops (Marlin >= 1.1.7)
259
+ */
260
+#if ENABLED(MIN_SOFTWARE_ENDSTOPS) && DISABLED(MIN_SOFTWARE_ENDSTOP_Z)
261
+  #if IS_KINEMATIC
262
+    #error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z."
263
+  #elif DISABLED(MIN_SOFTWARE_ENDSTOP_X) && DISABLED(MIN_SOFTWARE_ENDSTOP_Y)
264
+    #error "MIN_SOFTWARE_ENDSTOPS requires at least one of the MIN_SOFTWARE_ENDSTOP_[XYZ] options."
265
+  #endif
266
+#endif
267
+
268
+#if ENABLED(MAX_SOFTWARE_ENDSTOPS) && DISABLED(MAX_SOFTWARE_ENDSTOP_Z)
269
+  #if IS_KINEMATIC
270
+    #error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z."
271
+  #elif DISABLED(MAX_SOFTWARE_ENDSTOP_X) && DISABLED(MAX_SOFTWARE_ENDSTOP_Y)
272
+    #error "MAX_SOFTWARE_ENDSTOPS requires at least one of the MAX_SOFTWARE_ENDSTOP_[XYZ] options."
273
+  #endif
274
+#endif
275
+
276
+/**
258
  * Progress Bar
277
  * Progress Bar
259
  */
278
  */
260
 #if ENABLED(LCD_PROGRESS_BAR)
279
 #if ENABLED(LCD_PROGRESS_BAR)

+ 28
- 10
Marlin/src/lcd/ultralcd.cpp Ver fichero

2834
       float min = current_position[axis] - 1000,
2834
       float min = current_position[axis] - 1000,
2835
             max = current_position[axis] + 1000;
2835
             max = current_position[axis] + 1000;
2836
 
2836
 
2837
-      #if HAS_SOFTWARE_ENDSTOPS
2838
-        // Limit to software endstops, if enabled
2839
-        if (soft_endstops_enabled) {
2840
-          #if ENABLED(MIN_SOFTWARE_ENDSTOPS)
2841
-            min = soft_endstop_min[axis];
2842
-          #endif
2843
-          #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
2844
-            max = soft_endstop_max[axis];
2845
-          #endif
2837
+      // Limit to software endstops, if enabled
2838
+      #if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
2839
+        if (soft_endstops_enabled) switch (axis) {
2840
+          case X_AXIS:
2841
+            #if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
2842
+              min = soft_endstop_min[X_AXIS];
2843
+            #endif
2844
+            #if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
2845
+              max = soft_endstop_max[X_AXIS];
2846
+            #endif
2847
+            break;
2848
+          case Y_AXIS:
2849
+            #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
2850
+              min = soft_endstop_min[Y_AXIS];
2851
+            #endif
2852
+            #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
2853
+              max = soft_endstop_max[Y_AXIS];
2854
+            #endif
2855
+            break;
2856
+          case Z_AXIS:
2857
+            #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
2858
+              min = soft_endstop_min[Z_AXIS];
2859
+            #endif
2860
+            #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
2861
+              max = soft_endstop_max[Z_AXIS];
2862
+            #endif
2863
+            break;
2846
         }
2864
         }
2847
-      #endif
2865
+      #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
2848
 
2866
 
2849
       // Delta limits XY based on the current offset from center
2867
       // Delta limits XY based on the current offset from center
2850
       // This assumes the center is 0,0
2868
       // This assumes the center is 0,0

+ 17
- 18
Marlin/src/module/motion.cpp Ver fichero

456
 
456
 
457
   /**
457
   /**
458
    * Constrain the given coordinates to the software endstops.
458
    * Constrain the given coordinates to the software endstops.
459
+   *
460
+   * NOTE: This will only apply to Z on DELTA and SCARA. XY is
461
+   *       constrained to a circle on these kinematic systems.
459
    */
462
    */
460
-
461
-  // NOTE: This makes no sense for delta beds other than Z-axis.
462
-  //       For delta the X/Y would need to be clamped at
463
-  //       DELTA_PRINTABLE_RADIUS from center of bed, but delta
464
-  //       now enforces is_position_reachable for X/Y regardless
465
-  //       of HAS_SOFTWARE_ENDSTOPS, so that enforcement would be
466
-  //       redundant here.
467
-
468
   void clamp_to_software_endstops(float target[XYZ]) {
463
   void clamp_to_software_endstops(float target[XYZ]) {
469
     if (!soft_endstops_enabled) return;
464
     if (!soft_endstops_enabled) return;
470
-    #if ENABLED(MIN_SOFTWARE_ENDSTOPS)
471
-      #if DISABLED(DELTA)
472
-        NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
473
-        NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
474
-      #endif
465
+    #if ENABLED(MIN_SOFTWARE_ENDSTOP_X)
466
+      NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]);
467
+    #endif
468
+    #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y)
469
+      NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]);
470
+    #endif
471
+    #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z)
475
       NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]);
472
       NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]);
476
     #endif
473
     #endif
477
-    #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
478
-      #if DISABLED(DELTA)
479
-        NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
480
-        NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
481
-      #endif
474
+    #if ENABLED(MAX_SOFTWARE_ENDSTOP_X)
475
+      NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]);
476
+    #endif
477
+    #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y)
478
+      NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]);
479
+    #endif
480
+    #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
482
       NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]);
481
       NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]);
483
     #endif
482
     #endif
484
   }
483
   }

Loading…
Cancelar
Guardar