diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index f3c9f3a818..e83aa409b9 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -29,12 +29,23 @@ #define _AXIS(A) (A##_AXIS) -#define _XMIN_ 100 -#define _YMIN_ 200 -#define _ZMIN_ 300 -#define _XMAX_ 101 -#define _YMAX_ 201 -#define _ZMAX_ 301 +#define _XMIN_ 100 +#define _YMIN_ 200 +#define _ZMIN_ 300 +#define _XMAX_ 101 +#define _YMAX_ 201 +#define _ZMAX_ 301 +#define _XDIAG_ 102 +#define _YDIAG_ 202 +#define _ZDIAG_ 302 +#define _E0DIAG_ 400 +#define _E1DIAG_ 401 +#define _E2DIAG_ 402 +#define _E3DIAG_ 403 +#define _E4DIAG_ 404 +#define _E5DIAG_ 405 +#define _E6DIAG_ 406 +#define _E7DIAG_ 407 #define _FORCE_INLINE_ __attribute__((__always_inline__)) __inline__ #define FORCE_INLINE __attribute__((always_inline)) inline diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 5b9ba7c683..85d2557f93 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -679,48 +679,110 @@ #if X_HOME_DIR > 0 #if X2_USE_ENDSTOP == _XMIN_ #define X2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define X2_MAX_PIN X_MIN_PIN #elif X2_USE_ENDSTOP == _XMAX_ #define X2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define X2_MAX_PIN X_MAX_PIN #elif X2_USE_ENDSTOP == _YMIN_ #define X2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define X2_MAX_PIN Y_MIN_PIN #elif X2_USE_ENDSTOP == _YMAX_ #define X2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define X2_MAX_PIN Y_MAX_PIN #elif X2_USE_ENDSTOP == _ZMIN_ #define X2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define X2_MAX_PIN Z_MIN_PIN #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define X2_MAX_PIN Z_MAX_PIN #else #define X2_MAX_ENDSTOP_INVERTING false #endif + #ifndef X2_MAX_PIN + #if X2_USE_ENDSTOP == _XMIN_ + #define X2_MAX_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MAX_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MAX_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MAX_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MAX_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MAX_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MAX_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MAX_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MAX_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MAX_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MAX_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MAX_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MAX_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MAX_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MAX_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MAX_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MAX_PIN E7_DIAG_PIN + #endif + #endif #define X2_MIN_ENDSTOP_INVERTING false #else #if X2_USE_ENDSTOP == _XMIN_ #define X2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define X2_MIN_PIN X_MIN_PIN #elif X2_USE_ENDSTOP == _XMAX_ #define X2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define X2_MIN_PIN X_MAX_PIN #elif X2_USE_ENDSTOP == _YMIN_ #define X2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define X2_MIN_PIN Y_MIN_PIN #elif X2_USE_ENDSTOP == _YMAX_ #define X2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define X2_MIN_PIN Y_MAX_PIN #elif X2_USE_ENDSTOP == _ZMIN_ #define X2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define X2_MIN_PIN Z_MIN_PIN #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define X2_MIN_PIN Z_MAX_PIN #else #define X2_MIN_ENDSTOP_INVERTING false #endif + #ifndef X2_MIN_PIN + #if X2_USE_ENDSTOP == _XMIN_ + #define X2_MIN_PIN X_MIN_PIN + #elif X2_USE_ENDSTOP == _XMAX_ + #define X2_MIN_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _YMIN_ + #define X2_MIN_PIN Y_MIN_PIN + #elif X2_USE_ENDSTOP == _YMAX_ + #define X2_MIN_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _ZMIN_ + #define X2_MIN_PIN Z_MIN_PIN + #elif X2_USE_ENDSTOP == _ZMAX_ + #define X2_MIN_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _XDIAG_ + #define X2_MIN_PIN X_DIAG_PIN + #elif X2_USE_ENDSTOP == _YDIAG_ + #define X2_MIN_PIN Y_DIAG_PIN + #elif X2_USE_ENDSTOP == _ZDIAG_ + #define X2_MIN_PIN Z_DIAG_PIN + #elif X2_USE_ENDSTOP == _E0DIAG_ + #define X2_MIN_PIN E0_DIAG_PIN + #elif X2_USE_ENDSTOP == _E1DIAG_ + #define X2_MIN_PIN E1_DIAG_PIN + #elif X2_USE_ENDSTOP == _E2DIAG_ + #define X2_MIN_PIN E2_DIAG_PIN + #elif X2_USE_ENDSTOP == _E3DIAG_ + #define X2_MIN_PIN E3_DIAG_PIN + #elif X2_USE_ENDSTOP == _E4DIAG_ + #define X2_MIN_PIN E4_DIAG_PIN + #elif X2_USE_ENDSTOP == _E5DIAG_ + #define X2_MIN_PIN E5_DIAG_PIN + #elif X2_USE_ENDSTOP == _E6DIAG_ + #define X2_MIN_PIN E6_DIAG_PIN + #elif X2_USE_ENDSTOP == _E7DIAG_ + #define X2_MIN_PIN E7_DIAG_PIN + #endif + #endif #define X2_MAX_ENDSTOP_INVERTING false #endif #endif @@ -732,48 +794,110 @@ #if Y_HOME_DIR > 0 #if Y2_USE_ENDSTOP == _XMIN_ #define Y2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Y2_MAX_PIN X_MIN_PIN #elif Y2_USE_ENDSTOP == _XMAX_ #define Y2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Y2_MAX_PIN X_MAX_PIN #elif Y2_USE_ENDSTOP == _YMIN_ #define Y2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Y2_MAX_PIN Y_MIN_PIN #elif Y2_USE_ENDSTOP == _YMAX_ #define Y2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Y2_MAX_PIN Y_MAX_PIN #elif Y2_USE_ENDSTOP == _ZMIN_ #define Y2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Y2_MAX_PIN Z_MIN_PIN #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Y2_MAX_PIN Z_MAX_PIN #else #define Y2_MAX_ENDSTOP_INVERTING false #endif + #ifndef Y2_MAX_PIN + #if Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MAX_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MAX_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MAX_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MAX_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MAX_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MAX_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MAX_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MAX_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MAX_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MAX_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MAX_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MAX_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MAX_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MAX_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MAX_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MAX_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MAX_PIN E7_DIAG_PIN + #endif + #endif #define Y2_MIN_ENDSTOP_INVERTING false #else #if Y2_USE_ENDSTOP == _XMIN_ #define Y2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Y2_MIN_PIN X_MIN_PIN #elif Y2_USE_ENDSTOP == _XMAX_ #define Y2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Y2_MIN_PIN X_MAX_PIN #elif Y2_USE_ENDSTOP == _YMIN_ #define Y2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Y2_MIN_PIN Y_MIN_PIN #elif Y2_USE_ENDSTOP == _YMAX_ #define Y2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Y2_MIN_PIN Y_MAX_PIN #elif Y2_USE_ENDSTOP == _ZMIN_ #define Y2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Y2_MIN_PIN Z_MIN_PIN #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Y2_MIN_PIN Z_MAX_PIN #else #define Y2_MIN_ENDSTOP_INVERTING false #endif + #ifndef Y2_MIN_PIN + #if Y2_USE_ENDSTOP == _XMIN_ + #define Y2_MIN_PIN X_MIN_PIN + #elif Y2_USE_ENDSTOP == _XMAX_ + #define Y2_MIN_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _YMIN_ + #define Y2_MIN_PIN Y_MIN_PIN + #elif Y2_USE_ENDSTOP == _YMAX_ + #define Y2_MIN_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZMIN_ + #define Y2_MIN_PIN Z_MIN_PIN + #elif Y2_USE_ENDSTOP == _ZMAX_ + #define Y2_MIN_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _XDIAG_ + #define Y2_MIN_PIN X_DIAG_PIN + #elif Y2_USE_ENDSTOP == _YDIAG_ + #define Y2_MIN_PIN Y_DIAG_PIN + #elif Y2_USE_ENDSTOP == _ZDIAG_ + #define Y2_MIN_PIN Z_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E0DIAG_ + #define Y2_MIN_PIN E0_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E1DIAG_ + #define Y2_MIN_PIN E1_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E2DIAG_ + #define Y2_MIN_PIN E2_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E3DIAG_ + #define Y2_MIN_PIN E3_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E4DIAG_ + #define Y2_MIN_PIN E4_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E5DIAG_ + #define Y2_MIN_PIN E5_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E6DIAG_ + #define Y2_MIN_PIN E6_DIAG_PIN + #elif Y2_USE_ENDSTOP == _E7DIAG_ + #define Y2_MIN_PIN E7_DIAG_PIN + #endif + #endif #define Y2_MAX_ENDSTOP_INVERTING false #endif #endif @@ -786,48 +910,110 @@ #if Z_HOME_DIR > 0 #if Z2_USE_ENDSTOP == _XMIN_ #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z2_MAX_PIN X_MIN_PIN #elif Z2_USE_ENDSTOP == _XMAX_ #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z2_MAX_PIN X_MAX_PIN #elif Z2_USE_ENDSTOP == _YMIN_ #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z2_MAX_PIN Y_MIN_PIN #elif Z2_USE_ENDSTOP == _YMAX_ #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z2_MAX_PIN Y_MAX_PIN #elif Z2_USE_ENDSTOP == _ZMIN_ #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z2_MAX_PIN Z_MIN_PIN #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z2_MAX_PIN Z_MAX_PIN #else #define Z2_MAX_ENDSTOP_INVERTING false #endif + #ifndef Z2_MAX_PIN + #if Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MAX_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MAX_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MAX_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MAX_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MAX_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MAX_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MAX_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MAX_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MAX_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MAX_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MAX_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MAX_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MAX_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MAX_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MAX_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MAX_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MAX_PIN E7_DIAG_PIN + #endif + #endif #define Z2_MIN_ENDSTOP_INVERTING false #else #if Z2_USE_ENDSTOP == _XMIN_ #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z2_MIN_PIN X_MIN_PIN #elif Z2_USE_ENDSTOP == _XMAX_ #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z2_MIN_PIN X_MAX_PIN #elif Z2_USE_ENDSTOP == _YMIN_ #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z2_MIN_PIN Y_MIN_PIN #elif Z2_USE_ENDSTOP == _YMAX_ #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z2_MIN_PIN Y_MAX_PIN #elif Z2_USE_ENDSTOP == _ZMIN_ #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z2_MIN_PIN Z_MIN_PIN #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z2_MIN_PIN Z_MAX_PIN #else #define Z2_MIN_ENDSTOP_INVERTING false #endif + #ifndef Z2_MIN_PIN + #if Z2_USE_ENDSTOP == _XMIN_ + #define Z2_MIN_PIN X_MIN_PIN + #elif Z2_USE_ENDSTOP == _XMAX_ + #define Z2_MIN_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _YMIN_ + #define Z2_MIN_PIN Y_MIN_PIN + #elif Z2_USE_ENDSTOP == _YMAX_ + #define Z2_MIN_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZMIN_ + #define Z2_MIN_PIN Z_MIN_PIN + #elif Z2_USE_ENDSTOP == _ZMAX_ + #define Z2_MIN_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _XDIAG_ + #define Z2_MIN_PIN X_DIAG_PIN + #elif Z2_USE_ENDSTOP == _YDIAG_ + #define Z2_MIN_PIN Y_DIAG_PIN + #elif Z2_USE_ENDSTOP == _ZDIAG_ + #define Z2_MIN_PIN Z_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E0DIAG_ + #define Z2_MIN_PIN E0_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E1DIAG_ + #define Z2_MIN_PIN E1_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E2DIAG_ + #define Z2_MIN_PIN E2_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E3DIAG_ + #define Z2_MIN_PIN E3_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E4DIAG_ + #define Z2_MIN_PIN E4_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E5DIAG_ + #define Z2_MIN_PIN E5_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E6DIAG_ + #define Z2_MIN_PIN E6_DIAG_PIN + #elif Z2_USE_ENDSTOP == _E7DIAG_ + #define Z2_MIN_PIN E7_DIAG_PIN + #endif + #endif #define Z2_MAX_ENDSTOP_INVERTING false #endif @@ -835,48 +1021,110 @@ #if Z_HOME_DIR > 0 #if Z3_USE_ENDSTOP == _XMIN_ #define Z3_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z3_MAX_PIN X_MIN_PIN #elif Z3_USE_ENDSTOP == _XMAX_ #define Z3_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z3_MAX_PIN X_MAX_PIN #elif Z3_USE_ENDSTOP == _YMIN_ #define Z3_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z3_MAX_PIN Y_MIN_PIN #elif Z3_USE_ENDSTOP == _YMAX_ #define Z3_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z3_MAX_PIN Y_MAX_PIN #elif Z3_USE_ENDSTOP == _ZMIN_ #define Z3_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z3_MAX_PIN Z_MIN_PIN #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z3_MAX_PIN Z_MAX_PIN #else #define Z3_MAX_ENDSTOP_INVERTING false #endif + #ifndef Z3_MAX_PIN + #if Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MAX_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MAX_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MAX_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MAX_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MAX_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MAX_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MAX_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MAX_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MAX_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MAX_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MAX_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MAX_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MAX_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MAX_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MAX_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MAX_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MAX_PIN E7_DIAG_PIN + #endif + #endif #define Z3_MIN_ENDSTOP_INVERTING false #else #if Z3_USE_ENDSTOP == _XMIN_ #define Z3_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z3_MIN_PIN X_MIN_PIN #elif Z3_USE_ENDSTOP == _XMAX_ #define Z3_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z3_MIN_PIN X_MAX_PIN #elif Z3_USE_ENDSTOP == _YMIN_ #define Z3_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z3_MIN_PIN Y_MIN_PIN #elif Z3_USE_ENDSTOP == _YMAX_ #define Z3_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z3_MIN_PIN Y_MAX_PIN #elif Z3_USE_ENDSTOP == _ZMIN_ #define Z3_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z3_MIN_PIN Z_MIN_PIN #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z3_MIN_PIN Z_MAX_PIN #else #define Z3_MIN_ENDSTOP_INVERTING false #endif + #ifndef Z3_MIN_PIN + #if Z3_USE_ENDSTOP == _XMIN_ + #define Z3_MIN_PIN X_MIN_PIN + #elif Z3_USE_ENDSTOP == _XMAX_ + #define Z3_MIN_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _YMIN_ + #define Z3_MIN_PIN Y_MIN_PIN + #elif Z3_USE_ENDSTOP == _YMAX_ + #define Z3_MIN_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZMIN_ + #define Z3_MIN_PIN Z_MIN_PIN + #elif Z3_USE_ENDSTOP == _ZMAX_ + #define Z3_MIN_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _XDIAG_ + #define Z3_MIN_PIN X_DIAG_PIN + #elif Z3_USE_ENDSTOP == _YDIAG_ + #define Z3_MIN_PIN Y_DIAG_PIN + #elif Z3_USE_ENDSTOP == _ZDIAG_ + #define Z3_MIN_PIN Z_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E0DIAG_ + #define Z3_MIN_PIN E0_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E1DIAG_ + #define Z3_MIN_PIN E1_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E2DIAG_ + #define Z3_MIN_PIN E2_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E3DIAG_ + #define Z3_MIN_PIN E3_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E4DIAG_ + #define Z3_MIN_PIN E4_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E5DIAG_ + #define Z3_MIN_PIN E5_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E6DIAG_ + #define Z3_MIN_PIN E6_DIAG_PIN + #elif Z3_USE_ENDSTOP == _E7DIAG_ + #define Z3_MIN_PIN E7_DIAG_PIN + #endif + #endif #define Z3_MAX_ENDSTOP_INVERTING false #endif #endif @@ -885,48 +1133,110 @@ #if Z_HOME_DIR > 0 #if Z4_USE_ENDSTOP == _XMIN_ #define Z4_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z4_MAX_PIN X_MIN_PIN #elif Z4_USE_ENDSTOP == _XMAX_ #define Z4_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z4_MAX_PIN X_MAX_PIN #elif Z4_USE_ENDSTOP == _YMIN_ #define Z4_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z4_MAX_PIN Y_MIN_PIN #elif Z4_USE_ENDSTOP == _YMAX_ #define Z4_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z4_MAX_PIN Y_MAX_PIN #elif Z4_USE_ENDSTOP == _ZMIN_ #define Z4_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z4_MAX_PIN Z_MIN_PIN #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z4_MAX_PIN Z_MAX_PIN #else #define Z4_MAX_ENDSTOP_INVERTING false #endif + #ifndef Z4_MAX_PIN + #if Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MAX_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MAX_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MAX_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MAX_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MAX_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MAX_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MAX_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MAX_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MAX_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MAX_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MAX_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MAX_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MAX_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MAX_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MAX_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MAX_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MAX_PIN E7_DIAG_PIN + #endif + #endif #define Z4_MIN_ENDSTOP_INVERTING false #else #if Z4_USE_ENDSTOP == _XMIN_ #define Z4_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING - #define Z4_MIN_PIN X_MIN_PIN #elif Z4_USE_ENDSTOP == _XMAX_ #define Z4_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING - #define Z4_MIN_PIN X_MAX_PIN #elif Z4_USE_ENDSTOP == _YMIN_ #define Z4_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING - #define Z4_MIN_PIN Y_MIN_PIN #elif Z4_USE_ENDSTOP == _YMAX_ #define Z4_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING - #define Z4_MIN_PIN Y_MAX_PIN #elif Z4_USE_ENDSTOP == _ZMIN_ #define Z4_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING - #define Z4_MIN_PIN Z_MIN_PIN #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING - #define Z4_MIN_PIN Z_MAX_PIN #else #define Z4_MIN_ENDSTOP_INVERTING false #endif + #ifndef Z4_MIN_PIN + #if Z4_USE_ENDSTOP == _XMIN_ + #define Z4_MIN_PIN X_MIN_PIN + #elif Z4_USE_ENDSTOP == _XMAX_ + #define Z4_MIN_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _YMIN_ + #define Z4_MIN_PIN Y_MIN_PIN + #elif Z4_USE_ENDSTOP == _YMAX_ + #define Z4_MIN_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZMIN_ + #define Z4_MIN_PIN Z_MIN_PIN + #elif Z4_USE_ENDSTOP == _ZMAX_ + #define Z4_MIN_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _XDIAG_ + #define Z4_MIN_PIN X_DIAG_PIN + #elif Z4_USE_ENDSTOP == _YDIAG_ + #define Z4_MIN_PIN Y_DIAG_PIN + #elif Z4_USE_ENDSTOP == _ZDIAG_ + #define Z4_MIN_PIN Z_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E0DIAG_ + #define Z4_MIN_PIN E0_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E1DIAG_ + #define Z4_MIN_PIN E1_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E2DIAG_ + #define Z4_MIN_PIN E2_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E3DIAG_ + #define Z4_MIN_PIN E3_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E4DIAG_ + #define Z4_MIN_PIN E4_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E5DIAG_ + #define Z4_MIN_PIN E5_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E6DIAG_ + #define Z4_MIN_PIN E6_DIAG_PIN + #elif Z4_USE_ENDSTOP == _E7DIAG_ + #define Z4_MIN_PIN E7_DIAG_PIN + #endif + #endif #define Z4_MAX_ENDSTOP_INVERTING false #endif #endif diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 7f74456a48..2b6595cd74 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -23,33 +23,55 @@ #define BOARD_INFO_NAME "BIGTREE SKR 1.3" +/** + * Trinamic Stallguard pins + */ +#define X_DIAG_PIN P1_29 // X- +#define Y_DIAG_PIN P1_27 // Y- +#define Z_DIAG_PIN P1_25 // Z- +#define E0_DIAG_PIN P1_28 // X+ +#define E1_DIAG_PIN P1_26 // Y+ + /** * Limit Switches */ -#if X_HOME_DIR > 0 && X_STALL_SENSITIVITY && !defined(USE_XMAX_PLUG) - // For StallGuard homing to MAX swap the MIN / MAX pins - // so the MAX physical connectors may be used for other things. - #define X_MIN_PIN P1_28 // X_MAX (free) - #define X_MAX_PIN P1_29 // X_MIN -#else // else, non-endstop is free and appears in M43 output - #define X_MIN_PIN P1_29 // X_MIN - #define X_MAX_PIN P1_28 // X_MAX +#if X_STALL_SENSITIVITY + #if X_HOME_DIR < 0 + #define X_MIN_PIN X_DIAG_PIN + #define X_MAX_PIN P1_28 // X+ + #else + #define X_MAX_PIN X_DIAG_PIN + #define X_MIN_PIN P1_28 // X+ + #endif +#else + #define X_MIN_PIN P1_29 // X- + #define X_MAX_PIN P1_28 // X+ #endif -#if Y_HOME_DIR > 0 && Y_STALL_SENSITIVITY && !defined(USE_YMAX_PLUG) - #define Y_MIN_PIN P1_26 // Y_MAX (free) - #define Y_MAX_PIN P1_27 // Y_MIN +#if Y_STALL_SENSITIVITY + #if Y_HOME_DIR < 0 + #define Y_MIN_PIN Y_DIAG_PIN + #define Y_MAX_PIN P1_26 // Y+ + #else + #define Y_MAX_PIN Y_DIAG_PIN + #define Y_MIN_PIN P1_26 // Y+ + #endif #else - #define Y_MIN_PIN P1_27 // Y_MIN - #define Y_MAX_PIN P1_26 // Y_MAX + #define Y_MIN_PIN P1_27 // Y- + #define Y_MAX_PIN P1_26 // Y+ #endif -#if Z_HOME_DIR > 0 && Z_STALL_SENSITIVITY && !defined(USE_ZMAX_PLUG) - #define Z_MIN_PIN P1_24 // Z_MAX (free) - #define Z_MAX_PIN P1_25 // Z_MIN +#if Z_STALL_SENSITIVITY + #if Z_HOME_DIR < 0 + #define Z_MIN_PIN Z_DIAG_PIN + #define Z_MAX_PIN P1_24 // Z+ + #else + #define Z_MAX_PIN Z_DIAG_PIN + #define Z_MIN_PIN P1_24 // Z+ + #endif #else - #define Z_MIN_PIN P1_25 // Z_MIN - #define Z_MAX_PIN P1_24 // Z_MAX + #define Z_MIN_PIN P1_25 // Z- + #define Z_MAX_PIN P1_24 // Z+ #endif #define ONBOARD_ENDSTOPPULLUPS // Board has built-in pullups diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 3dbbb5e724..736dbdace0 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -1129,40 +1129,66 @@ #define __EPIN(p,q) E##p##_##q##_PIN #define _EPIN(p,q) __EPIN(p,q) +#define DIAG_REMAPPED(P,Q) (PIN_EXISTS(Q) && (P##_DIAG_PIN == Q##_PIN)) // The X2 axis, if any, should be the next open extruder port +#define X2_E_INDEX E_STEPPERS + #if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) #ifndef X2_STEP_PIN - #define X2_STEP_PIN _EPIN(E_STEPPERS, STEP) - #define X2_DIR_PIN _EPIN(E_STEPPERS, DIR) - #define X2_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE) - #if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP) + #define X2_STEP_PIN _EPIN(X2_E_INDEX, STEP) + #define X2_DIR_PIN _EPIN(X2_E_INDEX, DIR) + #define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE) + #if X2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP) #error "No E stepper plug left for X2!" #endif #endif #ifndef X2_MS1_PIN - #define X2_MS1_PIN _EPIN(E_STEPPERS, MS1) + #define X2_MS1_PIN _EPIN(X2_E_INDEX, MS1) #endif #ifndef X2_MS2_PIN - #define X2_MS2_PIN _EPIN(E_STEPPERS, MS2) + #define X2_MS2_PIN _EPIN(X2_E_INDEX, MS2) #endif #ifndef X2_MS3_PIN - #define X2_MS3_PIN _EPIN(E_STEPPERS, MS3) + #define X2_MS3_PIN _EPIN(X2_E_INDEX, MS3) #endif #if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN) - #define X2_CS_PIN _EPIN(E_STEPPERS, CS) + #define X2_CS_PIN _EPIN(X2_E_INDEX, CS) #endif #if AXIS_HAS_UART(X2) #ifndef X2_SERIAL_TX_PIN - #define X2_SERIAL_TX_PIN _EPIN(E_STEPPERS, SERIAL_TX) + #define X2_SERIAL_TX_PIN _EPIN(X2_E_INDEX, SERIAL_TX) #endif #ifndef X2_SERIAL_RX_PIN - #define X2_SERIAL_RX_PIN _EPIN(E_STEPPERS, SERIAL_RX) + #define X2_SERIAL_RX_PIN _EPIN(X2_E_INDEX, SERIAL_RX) #endif #endif - #define Y2_E_INDEX INCREMENT(E_STEPPERS) + + // + // Auto-assign pins for stallGuard sensorless homing + // + #if X2_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _EPIN(X2_E_INDEX, DIAG) > 0 + #if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file... + #define X2_USE_ENDSTOP _XMIN_ + #elif DIAG_REMAPPED(X2, Y_MIN) + #define X2_USE_ENDSTOP _YMIN_ + #elif DIAG_REMAPPED(X2, Z_MIN) + #define X2_USE_ENDSTOP _ZMIN_ + #elif DIAG_REMAPPED(X2, X_MAX) + #define X2_USE_ENDSTOP _XMAX_ + #elif DIAG_REMAPPED(X2, Y_MAX) + #define X2_USE_ENDSTOP _YMAX_ + #elif DIAG_REMAPPED(X2, Z_MAX) + #define X2_USE_ENDSTOP _ZMAX_ + #else // Otherwise use the driver DIAG_PIN directly + #define _X2_USE_ENDSTOP(P) _E##P##_DIAG_ + #define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX) + #endif + #endif + + #define Y2_E_INDEX INCREMENT(X2_E_INDEX) #else - #define Y2_E_INDEX E_STEPPERS + #define Y2_E_INDEX X2_E_INDEX #endif #ifndef X2_CS_PIN @@ -1208,6 +1234,24 @@ #define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX) #endif #endif + #if Y2_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _EPIN(Y2_E_INDEX, DIAG) > 0 + #if DIAG_REMAPPED(Y2, X_MIN) + #define Y2_USE_ENDSTOP _XMIN_ + #elif DIAG_REMAPPED(Y2, Y_MIN) + #define Y2_USE_ENDSTOP _YMIN_ + #elif DIAG_REMAPPED(Y2, Z_MIN) + #define Y2_USE_ENDSTOP _ZMIN_ + #elif DIAG_REMAPPED(Y2, X_MAX) + #define Y2_USE_ENDSTOP _XMAX_ + #elif DIAG_REMAPPED(Y2, Y_MAX) + #define Y2_USE_ENDSTOP _YMAX_ + #elif DIAG_REMAPPED(Y2, Z_MAX) + #define Y2_USE_ENDSTOP _ZMAX_ + #else + #define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_ + #define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX) + #endif + #endif #define Z2_E_INDEX INCREMENT(Y2_E_INDEX) #else #define Z2_E_INDEX Y2_E_INDEX @@ -1256,6 +1300,24 @@ #define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX) #endif #endif + #if Z2_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _EPIN(Z2_E_INDEX, DIAG) > 0 + #if DIAG_REMAPPED(Z2, X_MIN) + #define Z2_USE_ENDSTOP _XMIN_ + #elif DIAG_REMAPPED(Z2, Y_MIN) + #define Z2_USE_ENDSTOP _YMIN_ + #elif DIAG_REMAPPED(Z2, Z_MIN) + #define Z2_USE_ENDSTOP _ZMIN_ + #elif DIAG_REMAPPED(Z2, X_MAX) + #define Z2_USE_ENDSTOP _XMAX_ + #elif DIAG_REMAPPED(Z2, Y_MAX) + #define Z2_USE_ENDSTOP _YMAX_ + #elif DIAG_REMAPPED(Z2, Z_MAX) + #define Z2_USE_ENDSTOP _ZMAX_ + #else + #define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_ + #define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX) + #endif + #endif #define Z3_E_INDEX INCREMENT(Z2_E_INDEX) #else #define Z3_E_INDEX Z2_E_INDEX @@ -1285,7 +1347,7 @@ #endif #if AXIS_HAS_SPI(Z3) #ifndef Z3_CS_PIN - #define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS) + #define Z3_CS_PIN _EPIN(Z3_E_INDEX, CS) #endif #endif #ifndef Z3_MS1_PIN @@ -1305,6 +1367,24 @@ #define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX) #endif #endif + #if Z3_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _EPIN(Z3_E_INDEX, DIAG) > 0 + #if DIAG_REMAPPED(Z3, X_MIN) + #define Z3_USE_ENDSTOP _XMIN_ + #elif DIAG_REMAPPED(Z3, Y_MIN) + #define Z3_USE_ENDSTOP _YMIN_ + #elif DIAG_REMAPPED(Z3, Z_MIN) + #define Z3_USE_ENDSTOP _ZMIN_ + #elif DIAG_REMAPPED(Z3, X_MAX) + #define Z3_USE_ENDSTOP _XMAX_ + #elif DIAG_REMAPPED(Z3, Y_MAX) + #define Z3_USE_ENDSTOP _YMAX_ + #elif DIAG_REMAPPED(Z3, Z_MAX) + #define Z3_USE_ENDSTOP _ZMAX_ + #else + #define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_ + #define Z3_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX) + #endif + #endif #define Z4_E_INDEX INCREMENT(Z3_E_INDEX) #endif @@ -1352,6 +1432,24 @@ #define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX) #endif #endif + #if Z4_STALL_SENSITIVITY && ENABLED(X_DUAL_ENDSTOPS) && _EPIN(Z4_E_INDEX, DIAG) > 0 + #if DIAG_REMAPPED(Z4, X_MIN) + #define Z4_USE_ENDSTOP _XMIN_ + #elif DIAG_REMAPPED(Z4, Y_MIN) + #define Z4_USE_ENDSTOP _YMIN_ + #elif DIAG_REMAPPED(Z4, Z_MIN) + #define Z4_USE_ENDSTOP _ZMIN_ + #elif DIAG_REMAPPED(Z4, X_MAX) + #define Z4_USE_ENDSTOP _XMAX_ + #elif DIAG_REMAPPED(Z4, Y_MAX) + #define Z4_USE_ENDSTOP _YMAX_ + #elif DIAG_REMAPPED(Z4, Z_MAX) + #define Z4_USE_ENDSTOP _ZMAX_ + #else + #define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_ + #define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX) + #endif + #endif #endif #ifndef Z4_CS_PIN @@ -1384,3 +1482,4 @@ #endif #undef HAS_FREE_AUX2_PINS +#undef DIAG_REMAPPED diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index ca8c3f9a99..acd74767a3 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -1323,6 +1323,9 @@ #if PIN_EXISTS(X_MIN) REPORT_NAME_DIGITAL(__LINE__, X_MIN_PIN) #endif +#if PIN_EXISTS(X_DIAG) + REPORT_NAME_DIGITAL(__LINE__, X_DIAG_PIN) +#endif #if PIN_EXISTS(X_MS1) REPORT_NAME_DIGITAL(__LINE__, X_MS1_PIN) #endif @@ -1344,6 +1347,12 @@ #if PIN_EXISTS(X2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, X2_ENABLE_PIN) #endif +#if PIN_EXISTS(X2_MAX) + REPORT_NAME_DIGITAL(__LINE__, X2_MAX_PIN) +#endif +#if PIN_EXISTS(X2_MIN) + REPORT_NAME_DIGITAL(__LINE__, X2_MIN_PIN) +#endif #if PIN_EXISTS(X2_MS1) REPORT_NAME_DIGITAL(__LINE__, X2_MS1_PIN) #endif @@ -1374,6 +1383,9 @@ #if PIN_EXISTS(Y_MIN) REPORT_NAME_DIGITAL(__LINE__, Y_MIN_PIN) #endif +#if PIN_EXISTS(Y_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Y_DIAG_PIN) +#endif #if PIN_EXISTS(Y_MS1) REPORT_NAME_DIGITAL(__LINE__, Y_MS1_PIN) #endif @@ -1395,6 +1407,12 @@ #if PIN_EXISTS(Y2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, Y2_ENABLE_PIN) #endif +#if PIN_EXISTS(Y2_MAX) + REPORT_NAME_DIGITAL(__LINE__, Y2_MAX_PIN) +#endif +#if PIN_EXISTS(Y2_MIN) + REPORT_NAME_DIGITAL(__LINE__, Y2_MIN_PIN) +#endif #if PIN_EXISTS(Y2_MS1) REPORT_NAME_DIGITAL(__LINE__, Y2_MS1_PIN) #endif @@ -1425,8 +1443,8 @@ #if PIN_EXISTS(Z_MIN) REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PIN) #endif -#if PIN_EXISTS(Z_MIN_PROBE) - REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PROBE_PIN) +#if PIN_EXISTS(Z_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z_DIAG_PIN) #endif #if PIN_EXISTS(Z_MS1) REPORT_NAME_DIGITAL(__LINE__, Z_MS1_PIN) @@ -1452,6 +1470,12 @@ #if PIN_EXISTS(Z2_ENABLE) REPORT_NAME_DIGITAL(__LINE__, Z2_ENABLE_PIN) #endif +#if PIN_EXISTS(Z2_MAX) + REPORT_NAME_DIGITAL(__LINE__, Z2_MAX_PIN) +#endif +#if PIN_EXISTS(Z2_MIN) + REPORT_NAME_DIGITAL(__LINE__, Z2_MIN_PIN) +#endif #if PIN_EXISTS(Z2_MS1) REPORT_NAME_DIGITAL(__LINE__, Z2_MS1_PIN) #endif @@ -1473,6 +1497,12 @@ #if PIN_EXISTS(Z3_ENABLE) REPORT_NAME_DIGITAL(__LINE__, Z3_ENABLE_PIN) #endif +#if PIN_EXISTS(Z3_MAX) + REPORT_NAME_DIGITAL(__LINE__, Z3_MAX_PIN) +#endif +#if PIN_EXISTS(Z3_MIN) + REPORT_NAME_DIGITAL(__LINE__, Z3_MIN_PIN) +#endif #if PIN_EXISTS(Z3_MS1) REPORT_NAME_DIGITAL(__LINE__, Z3_MS1_PIN) #endif @@ -1494,6 +1524,12 @@ #if PIN_EXISTS(Z4_ENABLE) REPORT_NAME_DIGITAL(__LINE__, Z4_ENABLE_PIN) #endif +#if PIN_EXISTS(Z4_MAX) + REPORT_NAME_DIGITAL(__LINE__, Z4_MAX_PIN) +#endif +#if PIN_EXISTS(Z4_MIN) + REPORT_NAME_DIGITAL(__LINE__, Z4_MIN_PIN) +#endif #if PIN_EXISTS(Z4_MS1) REPORT_NAME_DIGITAL(__LINE__, Z4_MS1_PIN) #endif @@ -1506,6 +1542,9 @@ #if PIN_EXISTS(Z4_STEP) REPORT_NAME_DIGITAL(__LINE__, Z4_STEP_PIN) #endif +#if PIN_EXISTS(Z_MIN_PROBE) + REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PROBE_PIN) +#endif #if PIN_EXISTS(ZRIB_V20_D6) REPORT_NAME_DIGITAL(__LINE__, ZRIB_V20_D6_PIN) #endif @@ -1560,48 +1599,72 @@ #if PIN_EXISTS(Z4_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, Z4_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E0_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E0_DIAG_PIN) +#endif #if PIN_EXISTS(E0_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E0_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E0_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E0_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E1_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E1_DIAG_PIN) +#endif #if PIN_EXISTS(E1_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E1_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E1_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E1_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E2_DIAG_PIN) +#endif #if PIN_EXISTS(E2_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E2_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E2_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E2_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E3_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E3_DIAG_PIN) +#endif #if PIN_EXISTS(E3_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E3_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E3_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E3_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E4_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E4_DIAG_PIN) +#endif #if PIN_EXISTS(E4_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E4_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E4_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E4_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E5_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E5_DIAG_PIN) +#endif #if PIN_EXISTS(E5_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E5_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E6_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E6_DIAG_PIN) +#endif #if PIN_EXISTS(E6_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E6_SERIAL_TX_PIN) #endif #if PIN_EXISTS(E6_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E6_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(E7_DIAG) + REPORT_NAME_DIGITAL(__LINE__, E7_DIAG_PIN) +#endif #if PIN_EXISTS(E7_SERIAL_TX) REPORT_NAME_DIGITAL(__LINE__, E7_SERIAL_TX_PIN) #endif