Skip to content

Commit

Permalink
🔧 Fix extra endstop auto-assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 12, 2024
1 parent 3b33f7e commit e05ac66
Showing 1 changed file with 140 additions and 120 deletions.
260 changes: 140 additions & 120 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,20 @@
#if ENABLED(X_DUAL_ENDSTOPS)
#if X_HOME_TO_MAX
#ifndef X2_MAX_ENDSTOP_HIT_STATE
#if X2_STOP_PIN == X_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == X_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(X2_STOP)
#if X2_STOP_PIN == X_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == X_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MIN_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MAX_PIN
#define X2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(X2_MAX)
Expand All @@ -772,18 +774,20 @@
#endif
#else
#ifndef X2_MIN_ENDSTOP_HIT_STATE
#if X2_STOP_PIN == X_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == X_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(X2_STOP)
#if X2_STOP_PIN == X_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == X_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Y_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MIN_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif X2_STOP_PIN == Z_MAX_PIN
#define X2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(X2_MIN)
Expand All @@ -807,18 +811,20 @@
#if ENABLED(Y_DUAL_ENDSTOPS)
#if Y_HOME_TO_MAX
#ifndef Y2_MAX_ENDSTOP_HIT_STATE
#if Y2_STOP_PIN == X_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == X_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Y2_STOP)
#if Y2_STOP_PIN == X_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == X_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MIN_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MAX_PIN
#define Y2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Y2_MAX)
Expand All @@ -829,18 +835,20 @@
#endif
#else
#ifndef Y2_MIN_ENDSTOP_HIT_STATE
#if Y2_STOP_PIN == X_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == X_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Y2_STOP)
#if Y2_STOP_PIN == X_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == X_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Y_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MIN_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Y2_STOP_PIN == Z_MAX_PIN
#define Y2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Y2_MIN)
Expand All @@ -865,18 +873,20 @@

#if Z_HOME_TO_MAX
#ifndef Z2_MAX_ENDSTOP_HIT_STATE
#if Z2_STOP_PIN == X_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == X_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z2_STOP)
#if Z2_STOP_PIN == X_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == X_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MIN_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MAX_PIN
#define Z2_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z2_MAX)
Expand All @@ -887,18 +897,20 @@
#endif
#else
#ifndef Z2_MIN_ENDSTOP_HIT_STATE
#if Z2_STOP_PIN == X_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == X_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z2_STOP)
#if Z2_STOP_PIN == X_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == X_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Y_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MIN_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z2_STOP_PIN == Z_MAX_PIN
#define Z2_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z2_MIN)
Expand All @@ -918,18 +930,20 @@
#if NUM_Z_STEPPERS >= 3
#if Z_HOME_TO_MAX
#ifndef Z3_MAX_ENDSTOP_HIT_STATE
#if Z3_STOP_PIN == X_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == X_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z3_STOP)
#if Z3_STOP_PIN == X_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == X_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MIN_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MAX_PIN
#define Z3_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z3_MAX)
Expand All @@ -940,18 +954,20 @@
#endif
#else
#ifndef Z3_MIN_ENDSTOP_HIT_STATE
#if Z3_STOP_PIN == X_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == X_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z3_STOP)
#if Z3_STOP_PIN == X_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == X_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Y_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MIN_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z3_STOP_PIN == Z_MAX_PIN
#define Z3_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z3_MIN)
Expand All @@ -972,18 +988,20 @@
#if NUM_Z_STEPPERS >= 4
#if Z_HOME_TO_MAX
#ifndef Z4_MAX_ENDSTOP_HIT_STATE
#if Z4_STOP_PIN == X_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == X_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z4_STOP)
#if Z4_STOP_PIN == X_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == X_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MIN_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MAX_PIN
#define Z4_MAX_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z4_MAX)
Expand All @@ -994,18 +1012,20 @@
#endif
#else
#ifndef Z4_MIN_ENDSTOP_HIT_STATE
#if Z4_STOP_PIN == X_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == X_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#if PIN_EXISTS(Z4_STOP)
#if Z4_STOP_PIN == X_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE X_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == X_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE X_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Y_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Y_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Y_MAX_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MIN_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
#elif Z4_STOP_PIN == Z_MAX_PIN
#define Z4_MIN_ENDSTOP_HIT_STATE Z_MAX_ENDSTOP_HIT_STATE
#endif
#endif
#endif
#if !PIN_EXISTS(Z4_MIN)
Expand Down

0 comments on commit e05ac66

Please sign in to comment.