diff --git a/Marlin/src/HAL/AVR/endstop_interrupts.h b/Marlin/src/HAL/AVR/endstop_interrupts.h index 50f29c3356ce5..2acaf8ebc1cff 100644 --- a/Marlin/src/HAL/AVR/endstop_interrupts.h +++ b/Marlin/src/HAL/AVR/endstop_interrupts.h @@ -120,15 +120,14 @@ void pciSetup(const int8_t pin) { void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - #if HAS_X_MAX + #if X_HOME_TO_MAX #if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) _ATTACH(X_MAX_PIN); #else static_assert(digitalPinHasPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); pciSetup(X_MAX_PIN); #endif - #endif - #if HAS_X_MIN + #elif X_HOME_TO_MIN #if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT) _ATTACH(X_MIN_PIN); #else @@ -136,83 +135,6 @@ void setup_endstop_interrupts() { pciSetup(X_MIN_PIN); #endif #endif - #if HAS_Y_MAX - #if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT) - _ATTACH(Y_MAX_PIN); - #else - static_assert(digitalPinHasPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); - pciSetup(Y_MAX_PIN); - #endif - #endif - #if HAS_Y_MIN - #if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT) - _ATTACH(Y_MIN_PIN); - #else - static_assert(digitalPinHasPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); - pciSetup(Y_MIN_PIN); - #endif - #endif - #if HAS_Z_MAX - #if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT) - _ATTACH(Z_MAX_PIN); - #else - static_assert(digitalPinHasPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); - pciSetup(Z_MAX_PIN); - #endif - #endif - #if HAS_Z_MIN - #if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT) - _ATTACH(Z_MIN_PIN); - #else - static_assert(digitalPinHasPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); - pciSetup(Z_MIN_PIN); - #endif - #endif - #if HAS_I_MAX - #if (digitalPinToInterrupt(I_MAX_PIN) != NOT_AN_INTERRUPT) - _ATTACH(I_MAX_PIN); - #else - static_assert(digitalPinHasPCICR(I_MAX_PIN), "I_MAX_PIN is not interrupt-capable"); - pciSetup(I_MAX_PIN); - #endif - #elif HAS_I_MIN - #if (digitalPinToInterrupt(I_MIN_PIN) != NOT_AN_INTERRUPT) - _ATTACH(I_MIN_PIN); - #else - static_assert(digitalPinHasPCICR(I_MIN_PIN), "I_MIN_PIN is not interrupt-capable"); - pciSetup(I_MIN_PIN); - #endif - #endif - #if HAS_J_MAX - #if (digitalPinToInterrupt(J_MAX_PIN) != NOT_AN_INTERRUPT) - _ATTACH(J_MAX_PIN); - #else - static_assert(digitalPinHasPCICR(J_MAX_PIN), "J_MAX_PIN is not interrupt-capable"); - pciSetup(J_MAX_PIN); - #endif - #elif HAS_J_MIN - #if (digitalPinToInterrupt(J_MIN_PIN) != NOT_AN_INTERRUPT) - _ATTACH(J_MIN_PIN); - #else - static_assert(digitalPinHasPCICR(J_MIN_PIN), "J_MIN_PIN is not interrupt-capable"); - pciSetup(J_MIN_PIN); - #endif - #endif - #if HAS_K_MAX - #if (digitalPinToInterrupt(K_MAX_PIN) != NOT_AN_INTERRUPT) - _ATTACH(K_MAX_PIN); - #else - static_assert(digitalPinHasPCICR(K_MAX_PIN), "K_MAX_PIN is not interrupt-capable"); - pciSetup(K_MAX_PIN); - #endif - #elif HAS_K_MIN - #if (digitalPinToInterrupt(K_MIN_PIN) != NOT_AN_INTERRUPT) - _ATTACH(K_MIN_PIN); - #else - static_assert(digitalPinHasPCICR(K_MIN_PIN), "K_MIN_PIN is not interrupt-capable"); - pciSetup(K_MIN_PIN); - #endif - #endif #if HAS_X2_MAX #if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT) _ATTACH(X2_MAX_PIN); @@ -229,6 +151,21 @@ void setup_endstop_interrupts() { pciSetup(X2_MIN_PIN); #endif #endif + #if Y_HOME_TO_MAX + #if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT) + _ATTACH(Y_MAX_PIN); + #else + static_assert(digitalPinHasPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); + pciSetup(Y_MAX_PIN); + #endif + #elif Y_HOME_TO_MIN + #if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT) + _ATTACH(Y_MIN_PIN); + #else + static_assert(digitalPinHasPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); + pciSetup(Y_MIN_PIN); + #endif + #endif #if HAS_Y2_MAX #if (digitalPinToInterrupt(Y2_MAX_PIN) != NOT_AN_INTERRUPT) _ATTACH(Y2_MAX_PIN); @@ -245,6 +182,21 @@ void setup_endstop_interrupts() { pciSetup(Y2_MIN_PIN); #endif #endif + #if Z_HOME_TO_MAX + #if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT) + _ATTACH(Z_MAX_PIN); + #else + static_assert(digitalPinHasPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); + pciSetup(Z_MAX_PIN); + #endif + #elif Z_HOME_TO_MIN + #if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT) + _ATTACH(Z_MIN_PIN); + #else + static_assert(digitalPinHasPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."); + pciSetup(Z_MIN_PIN); + #endif + #endif #if HAS_Z2_MAX #if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT) _ATTACH(Z2_MAX_PIN); @@ -293,6 +245,51 @@ void setup_endstop_interrupts() { pciSetup(Z4_MIN_PIN); #endif #endif + #if I_HOME_TO_MAX + #if (digitalPinToInterrupt(I_MAX_PIN) != NOT_AN_INTERRUPT) + _ATTACH(I_MAX_PIN); + #else + static_assert(digitalPinHasPCICR(I_MAX_PIN), "I_MAX_PIN is not interrupt-capable"); + pciSetup(I_MAX_PIN); + #endif + #elif I_HOME_TO_MIN + #if (digitalPinToInterrupt(I_MIN_PIN) != NOT_AN_INTERRUPT) + _ATTACH(I_MIN_PIN); + #else + static_assert(digitalPinHasPCICR(I_MIN_PIN), "I_MIN_PIN is not interrupt-capable"); + pciSetup(I_MIN_PIN); + #endif + #endif + #if J_HOME_TO_MAX + #if (digitalPinToInterrupt(J_MAX_PIN) != NOT_AN_INTERRUPT) + _ATTACH(J_MAX_PIN); + #else + static_assert(digitalPinHasPCICR(J_MAX_PIN), "J_MAX_PIN is not interrupt-capable"); + pciSetup(J_MAX_PIN); + #endif + #elif J_HOME_TO_MIN + #if (digitalPinToInterrupt(J_MIN_PIN) != NOT_AN_INTERRUPT) + _ATTACH(J_MIN_PIN); + #else + static_assert(digitalPinHasPCICR(J_MIN_PIN), "J_MIN_PIN is not interrupt-capable"); + pciSetup(J_MIN_PIN); + #endif + #endif + #if K_HOME_TO_MAX + #if (digitalPinToInterrupt(K_MAX_PIN) != NOT_AN_INTERRUPT) + _ATTACH(K_MAX_PIN); + #else + static_assert(digitalPinHasPCICR(K_MAX_PIN), "K_MAX_PIN is not interrupt-capable"); + pciSetup(K_MAX_PIN); + #endif + #elif K_HOME_TO_MIN + #if (digitalPinToInterrupt(K_MIN_PIN) != NOT_AN_INTERRUPT) + _ATTACH(K_MIN_PIN); + #else + static_assert(digitalPinHasPCICR(K_MIN_PIN), "K_MIN_PIN is not interrupt-capable"); + pciSetup(K_MIN_PIN); + #endif + #endif #if HAS_Z_MIN_PROBE_PIN #if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT) _ATTACH(Z_MIN_PROBE_PIN); diff --git a/Marlin/src/HAL/DUE/endstop_interrupts.h b/Marlin/src/HAL/DUE/endstop_interrupts.h index 9c7e2104882ed..27db4aaddec61 100644 --- a/Marlin/src/HAL/DUE/endstop_interrupts.h +++ b/Marlin/src/HAL/DUE/endstop_interrupts.h @@ -47,27 +47,27 @@ void endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/ESP32/endstop_interrupts.h b/Marlin/src/HAL/ESP32/endstop_interrupts.h index 4725df921b1ad..dc79cb0c31625 100644 --- a/Marlin/src/HAL/ESP32/endstop_interrupts.h +++ b/Marlin/src/HAL/ESP32/endstop_interrupts.h @@ -42,12 +42,12 @@ void ICACHE_RAM_ATTR endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); @@ -58,11 +58,11 @@ void setup_endstop_interrupts() { TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/LPC1768/endstop_interrupts.h b/Marlin/src/HAL/LPC1768/endstop_interrupts.h index 23bd0cc982b29..ef99f8dc778db 100644 --- a/Marlin/src/HAL/LPC1768/endstop_interrupts.h +++ b/Marlin/src/HAL/LPC1768/endstop_interrupts.h @@ -44,37 +44,56 @@ void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) #define LPC1768_PIN_INTERRUPT_M(pin) ((pin >> 0x5 & 0x7) == 0 || (pin >> 0x5 & 0x7) == 2) - #if HAS_X_MAX + #if X_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(X_MAX_PIN) #error "X_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(X_MAX_PIN); - #endif - #if HAS_X_MIN + #elif X_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(X_MIN_PIN) #error "X_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(X_MIN_PIN); #endif - #if HAS_Y_MAX + #if HAS_X2_MAX + #if !LPC1768_PIN_INTERRUPT_M(X2_MAX_PIN) + #error "X2_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." + #endif + _ATTACH(X2_MAX_PIN); + #elif HAS_X2_MIN + #if !LPC1768_PIN_INTERRUPT_M(X2_MIN_PIN) + #error "X2_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." + #endif + _ATTACH(X2_MIN_PIN); + #endif + #if Y_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(Y_MAX_PIN) #error "Y_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Y_MAX_PIN); - #endif - #if HAS_Y_MIN + #elif Y_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(Y_MIN_PIN) #error "Y_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Y_MIN_PIN); #endif - #if HAS_Z_MAX + #if HAS_Y2_MAX + #if !LPC1768_PIN_INTERRUPT_M(Y2_MAX_PIN) + #error "Y2_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." + #endif + _ATTACH(Y2_MAX_PIN); + #elif HAS_Y2_MIN + #if !LPC1768_PIN_INTERRUPT_M(Y2_MIN_PIN) + #error "Y2_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." + #endif + _ATTACH(Y2_MIN_PIN); + #endif + #if Z_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(Z_MAX_PIN) #error "Z_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Z_MAX_PIN); - #endif - #if HAS_Z_MIN + #elif Z_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(Z_MIN_PIN) #error "Z_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif @@ -85,8 +104,7 @@ void setup_endstop_interrupts() { #error "Z2_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Z2_MAX_PIN); - #endif - #if HAS_Z2_MIN + #elif HAS_Z2_MIN #if !LPC1768_PIN_INTERRUPT_M(Z2_MIN_PIN) #error "Z2_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif @@ -97,8 +115,7 @@ void setup_endstop_interrupts() { #error "Z3_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Z3_MAX_PIN); - #endif - #if HAS_Z3_MIN + #elif HAS_Z3_MIN #if !LPC1768_PIN_INTERRUPT_M(Z3_MIN_PIN) #error "Z3_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif @@ -109,8 +126,7 @@ void setup_endstop_interrupts() { #error "Z4_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif _ATTACH(Z4_MAX_PIN); - #endif - #if HAS_Z4_MIN + #elif HAS_Z4_MIN #if !LPC1768_PIN_INTERRUPT_M(Z4_MIN_PIN) #error "Z4_MIN_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif @@ -122,34 +138,34 @@ void setup_endstop_interrupts() { #endif _ATTACH(Z_MIN_PROBE_PIN); #endif - #if HAS_I_MAX + #if I_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN) #error "I_MAX_PIN is not INTERRUPT-capable." #endif _ATTACH(I_MAX_PIN); - #elif HAS_I_MIN + #elif I_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(I_MIN_PIN) #error "I_MIN_PIN is not INTERRUPT-capable." #endif _ATTACH(I_MIN_PIN); #endif - #if HAS_J_MAX + #if J_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(J_MAX_PIN) #error "J_MAX_PIN is not INTERRUPT-capable." #endif _ATTACH(J_MAX_PIN); - #elif HAS_J_MIN + #elif J_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(J_MIN_PIN) #error "J_MIN_PIN is not INTERRUPT-capable." #endif _ATTACH(J_MIN_PIN); #endif - #if HAS_K_MAX + #if K_HOME_TO_MAX #if !LPC1768_PIN_INTERRUPT_M(K_MAX_PIN) #error "K_MAX_PIN is not INTERRUPT-capable." #endif _ATTACH(K_MAX_PIN); - #elif HAS_K_MIN + #elif K_HOME_TO_MIN #if !LPC1768_PIN_INTERRUPT_M(K_MIN_PIN) #error "K_MIN_PIN is not INTERRUPT-capable." #endif diff --git a/Marlin/src/HAL/SAMD51/endstop_interrupts.h b/Marlin/src/HAL/SAMD51/endstop_interrupts.h index 61a06c0d4b426..940372de7ec7a 100644 --- a/Marlin/src/HAL/SAMD51/endstop_interrupts.h +++ b/Marlin/src/HAL/SAMD51/endstop_interrupts.h @@ -48,18 +48,18 @@ #include "../../module/endstops.h" #define MATCH_EILINE(P1,P2) (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2)) -#define MATCH_X_MAX_EILINE(P) TERN0(HAS_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN)) -#define MATCH_X_MIN_EILINE(P) TERN0(HAS_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN)) -#define MATCH_Y_MAX_EILINE(P) TERN0(HAS_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN)) -#define MATCH_Y_MIN_EILINE(P) TERN0(HAS_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN)) -#define MATCH_Z_MAX_EILINE(P) TERN0(HAS_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN)) -#define MATCH_Z_MIN_EILINE(P) TERN0(HAS_Z_MIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN)) -#define MATCH_I_MAX_EILINE(P) TERN0(HAS_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN)) -#define MATCH_I_MIN_EILINE(P) TERN0(HAS_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN)) -#define MATCH_J_MAX_EILINE(P) TERN0(HAS_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN)) -#define MATCH_J_MIN_EILINE(P) TERN0(HAS_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN)) -#define MATCH_K_MAX_EILINE(P) TERN0(HAS_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN)) -#define MATCH_K_MIN_EILINE(P) TERN0(HAS_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN)) +#define MATCH_X_MAX_EILINE(P) TERN0(X_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN)) +#define MATCH_X_MIN_EILINE(P) TERN0(X_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN)) +#define MATCH_Y_MAX_EILINE(P) TERN0(Y_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN)) +#define MATCH_Y_MIN_EILINE(P) TERN0(Y_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN)) +#define MATCH_Z_MAX_EILINE(P) TERN0(Z_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN)) +#define MATCH_Z_MIN_EILINE(P) TERN0(Z_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN)) +#define MATCH_I_MAX_EILINE(P) TERN0(I_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN)) +#define MATCH_I_MIN_EILINE(P) TERN0(I_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN)) +#define MATCH_J_MAX_EILINE(P) TERN0(J_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN)) +#define MATCH_J_MIN_EILINE(P) TERN0(J_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN)) +#define MATCH_K_MAX_EILINE(P) TERN0(K_HOME_TO_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN)) +#define MATCH_K_MIN_EILINE(P) TERN0(K_HOME_TO_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN)) #define MATCH_Z2_MAX_EILINE(P) TERN0(HAS_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN)) #define MATCH_Z2_MIN_EILINE(P) TERN0(HAS_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN)) #define MATCH_Z3_MAX_EILINE(P) TERN0(HAS_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN)) @@ -85,37 +85,56 @@ void endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE) - #if HAS_X_MAX + #if X_HOME_TO_MAX #if !AVAILABLE_EILINE(X_MAX_PIN) #error "X_MAX_PIN has no EXTINT line available." #endif _ATTACH(X_MAX_PIN); - #endif - #if HAS_X_MIN + #elif X_HOME_TO_MIN #if !AVAILABLE_EILINE(X_MIN_PIN) #error "X_MIN_PIN has no EXTINT line available." #endif _ATTACH(X_MIN_PIN); #endif - #if HAS_Y_MAX + #if HAS_X2_MAX + #if !AVAILABLE_EILINE(X2_MAX_PIN) + #error "X2_MAX_PIN has no EXTINT line available." + #endif + _ATTACH(X2_MAX_PIN); + #elif HAS_X2_MIN + #if !AVAILABLE_EILINE(X2_MIN_PIN) + #error "X2_MIN_PIN has no EXTINT line available." + #endif + _ATTACH(X2_MIN_PIN); + #endif + #if Y_HOME_TO_MAX #if !AVAILABLE_EILINE(Y_MAX_PIN) #error "Y_MAX_PIN has no EXTINT line available." #endif _ATTACH(Y_MAX_PIN); - #endif - #if HAS_Y_MIN + #elif Y_HOME_TO_MIN #if !AVAILABLE_EILINE(Y_MIN_PIN) #error "Y_MIN_PIN has no EXTINT line available." #endif _ATTACH(Y_MIN_PIN); #endif - #if HAS_Z_MAX + #if HAS_Y2_MAX + #if !AVAILABLE_EILINE(Y2_MAX_PIN) + #error "Y2_MAX_PIN has no EXTINT line available." + #endif + _ATTACH(Y2_MAX_PIN); + #elif HAS_Y2_MIN + #if !AVAILABLE_EILINE(Y2_MIN_PIN) + #error "Y2_MIN_PIN has no EXTINT line available." + #endif + _ATTACH(Y2_MIN_PIN); + #endif + #if Z_HOME_TO_MAX #if !AVAILABLE_EILINE(Z_MAX_PIN) #error "Z_MAX_PIN has no EXTINT line available." #endif _ATTACH(Z_MAX_PIN); - #endif - #if HAS_Z_MIN + #elif Z_HOME_TO_MIN #if !AVAILABLE_EILINE(Z_MIN_PIN) #error "Z_MIN_PIN has no EXTINT line available." #endif @@ -126,8 +145,7 @@ void setup_endstop_interrupts() { #error "Z2_MAX_PIN has no EXTINT line available." #endif _ATTACH(Z2_MAX_PIN); - #endif - #if HAS_Z2_MIN + #elif HAS_Z2_MIN #if !AVAILABLE_EILINE(Z2_MIN_PIN) #error "Z2_MIN_PIN has no EXTINT line available." #endif @@ -138,8 +156,7 @@ void setup_endstop_interrupts() { #error "Z3_MAX_PIN has no EXTINT line available." #endif _ATTACH(Z3_MAX_PIN); - #endif - #if HAS_Z3_MIN + #elif HAS_Z3_MIN #if !AVAILABLE_EILINE(Z3_MIN_PIN) #error "Z3_MIN_PIN has no EXTINT line available." #endif @@ -150,53 +167,49 @@ void setup_endstop_interrupts() { #error "Z4_MAX_PIN has no EXTINT line available." #endif _ATTACH(Z4_MAX_PIN); - #endif - #if HAS_Z4_MIN + #elif HAS_Z4_MIN #if !AVAILABLE_EILINE(Z4_MIN_PIN) #error "Z4_MIN_PIN has no EXTINT line available." #endif _ATTACH(Z4_MIN_PIN); #endif - #if HAS_Z_MIN_PROBE_PIN - #if !AVAILABLE_EILINE(Z_MIN_PROBE_PIN) - #error "Z_MIN_PROBE_PIN has no EXTINT line available." - #endif - _ATTACH(Z_MIN_PROBE_PIN); - #endif - #if HAS_I_MAX + #if I_HOME_TO_MAX #if !AVAILABLE_EILINE(I_MAX_PIN) #error "I_MAX_PIN has no EXTINT line available." #endif attachInterrupt(I_MAX_PIN, endstop_ISR, CHANGE); - #endif - #if HAS_I_MIN + #elif I_HOME_TO_MIN #if !AVAILABLE_EILINE(I_MIN_PIN) #error "I_MIN_PIN has no EXTINT line available." #endif attachInterrupt(I_MIN_PIN, endstop_ISR, CHANGE); #endif - #if HAS_J_MAX + #if J_HOME_TO_MAX #if !AVAILABLE_EILINE(J_MAX_PIN) #error "J_MAX_PIN has no EXTINT line available." #endif attachInterrupt(J_MAX_PIN, endstop_ISR, CHANGE); - #endif - #if HAS_J_MIN + #elif J_HOME_TO_MIN #if !AVAILABLE_EILINE(J_MIN_PIN) #error "J_MIN_PIN has no EXTINT line available." #endif attachInterrupt(J_MIN_PIN, endstop_ISR, CHANGE); #endif - #if HAS_K_MAX + #if K_HOME_TO_MAX #if !AVAILABLE_EILINE(K_MAX_PIN) #error "K_MAX_PIN has no EXTINT line available." #endif attachInterrupt(K_MAX_PIN, endstop_ISR, CHANGE); - #endif - #if HAS_K_MIN + #elif K_HOME_TO_MIN #if !AVAILABLE_EILINE(K_MIN_PIN) #error "K_MIN_PIN has no EXTINT line available." #endif attachInterrupt(K_MIN_PIN, endstop_ISR, CHANGE); #endif + #if HAS_Z_MIN_PROBE_PIN + #if !AVAILABLE_EILINE(Z_MIN_PROBE_PIN) + #error "Z_MIN_PROBE_PIN has no EXTINT line available." + #endif + _ATTACH(Z_MIN_PROBE_PIN); + #endif } diff --git a/Marlin/src/HAL/STM32/endstop_interrupts.h b/Marlin/src/HAL/STM32/endstop_interrupts.h index 90870881fe665..4a84dc996cfac 100644 --- a/Marlin/src/HAL/STM32/endstop_interrupts.h +++ b/Marlin/src/HAL/STM32/endstop_interrupts.h @@ -29,27 +29,27 @@ void endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/STM32F1/endstop_interrupts.h b/Marlin/src/HAL/STM32F1/endstop_interrupts.h index 4d7edb9496c12..0cae05ce02c89 100644 --- a/Marlin/src/HAL/STM32F1/endstop_interrupts.h +++ b/Marlin/src/HAL/STM32F1/endstop_interrupts.h @@ -54,12 +54,12 @@ void endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); @@ -70,11 +70,11 @@ void setup_endstop_interrupts() { TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/TEENSY31_32/endstop_interrupts.h b/Marlin/src/HAL/TEENSY31_32/endstop_interrupts.h index 9c7e2104882ed..27db4aaddec61 100644 --- a/Marlin/src/HAL/TEENSY31_32/endstop_interrupts.h +++ b/Marlin/src/HAL/TEENSY31_32/endstop_interrupts.h @@ -47,27 +47,27 @@ void endstop_ISR() { endstops.update(); } void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/TEENSY35_36/endstop_interrupts.h b/Marlin/src/HAL/TEENSY35_36/endstop_interrupts.h index a300248885357..70ee7a20d9022 100644 --- a/Marlin/src/HAL/TEENSY35_36/endstop_interrupts.h +++ b/Marlin/src/HAL/TEENSY35_36/endstop_interrupts.h @@ -46,27 +46,27 @@ void endstop_ISR() { endstops.update(); } */ void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h b/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h index 4c3ddec9f1f1f..8e579ab150d39 100644 --- a/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h +++ b/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h @@ -46,27 +46,27 @@ void endstop_ISR() { endstops.update(); } */ void setup_endstop_interrupts() { #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) - TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); - TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); - TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); - TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); - TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); - TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(X_HOME_TO_MAX, _ATTACH(X_MAX_PIN)); + TERN_(X_HOME_TO_MIN, _ATTACH(X_MIN_PIN)); TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(Y_HOME_TO_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(Y_HOME_TO_MIN, _ATTACH(Y_MIN_PIN)); TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(Z_HOME_TO_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(Z_HOME_TO_MIN, _ATTACH(Z_MIN_PIN)); TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(I_HOME_TO_MAX, _ATTACH(I_MAX_PIN)); + TERN_(I_HOME_TO_MIN, _ATTACH(I_MIN_PIN)); + TERN_(J_HOME_TO_MAX, _ATTACH(J_MAX_PIN)); + TERN_(J_HOME_TO_MIN, _ATTACH(J_MIN_PIN)); + TERN_(K_HOME_TO_MAX, _ATTACH(K_MAX_PIN)); + TERN_(K_HOME_TO_MIN, _ATTACH(K_MIN_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); - TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN)); - TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN)); - TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN)); - TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN)); - TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN)); - TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN)); } diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 9e050101aa366..6d092c4067c5d 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -926,30 +926,45 @@ #elif X_HOME_DIR < 0 #define X_HOME_TO_MIN 1 #endif -#if Y_HOME_DIR > 0 - #define Y_HOME_TO_MAX 1 -#elif Y_HOME_DIR < 0 - #define Y_HOME_TO_MIN 1 +#if X2_HOME_DIR > 0 + #define X2_HOME_TO_MAX 1 +#elif X2_HOME_DIR < 0 + #define X2_HOME_TO_MIN 1 #endif -#if Z_HOME_DIR > 0 - #define Z_HOME_TO_MAX 1 -#elif Z_HOME_DIR < 0 - #define Z_HOME_TO_MIN 1 +#if HAS_Y_AXIS + #if Y_HOME_DIR > 0 + #define Y_HOME_TO_MAX 1 + #elif Y_HOME_DIR < 0 + #define Y_HOME_TO_MIN 1 + #endif +#endif +#if HAS_Z_AXIS + #if Z_HOME_DIR > 0 + #define Z_HOME_TO_MAX 1 + #elif Z_HOME_DIR < 0 + #define Z_HOME_TO_MIN 1 + #endif #endif -#if I_HOME_DIR > 0 - #define I_HOME_TO_MAX 1 -#elif I_HOME_DIR < 0 - #define I_HOME_TO_MIN 1 +#if LINEAR_AXES >= 4 + #if I_HOME_DIR > 0 + #define I_HOME_TO_MAX 1 + #elif I_HOME_DIR < 0 + #define I_HOME_TO_MIN 1 + #endif #endif -#if J_HOME_DIR > 0 - #define J_HOME_TO_MAX 1 -#elif J_HOME_DIR < 0 - #define J_HOME_TO_MIN 1 +#if LINEAR_AXES >= 5 + #if J_HOME_DIR > 0 + #define J_HOME_TO_MAX 1 + #elif J_HOME_DIR < 0 + #define J_HOME_TO_MIN 1 + #endif #endif -#if K_HOME_DIR > 0 - #define K_HOME_TO_MAX 1 -#elif K_HOME_DIR < 0 - #define K_HOME_TO_MIN 1 +#if LINEAR_AXES >= 6 + #if K_HOME_DIR > 0 + #define K_HOME_TO_MAX 1 + #elif K_HOME_DIR < 0 + #define K_HOME_TO_MIN 1 + #endif #endif /** @@ -1411,7 +1426,7 @@ #endif #endif -#if ANY(USE_XMIN_PLUG, USE_YMIN_PLUG, USE_ZMIN_PLUG, USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG) +#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) || (LINEAR_AXES >= 4 && I_HOME_DIR) || (LINEAR_AXES >= 5 && J_HOME_DIR) || (LINEAR_AXES >= 6 && K_HOME_DIR) #define HAS_ENDSTOPS 1 #define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H) #else diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 9864b8715c754..2ff3f041eaf69 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -823,12 +823,6 @@ #define POLL_JOG #endif -#if X2_HOME_DIR > 0 - #define X2_HOME_TO_MAX 1 -#elif X2_HOME_DIR < 0 - #define X2_HOME_TO_MIN 1 -#endif - #ifndef HOMING_BUMP_MM #define HOMING_BUMP_MM { 0, 0, 0 } #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index a5c9d20eda9ea..dbf4f256b4f8f 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -745,7 +745,7 @@ #define LIB_INTERNAL_MAX31865 1 #endif -#endif //HAS_MAX_TC +#endif // HAS_MAX_TC /** * X_DUAL_ENDSTOPS endstop reassignment @@ -1104,7 +1104,7 @@ #define Z2_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef Z2_MIN_PIN + #if !defined(Z2_MIN_PIN) && !defined(Z2_STOP_PIN) #if Z2_USE_ENDSTOP == _XMIN_ #define Z2_MIN_PIN X_MIN_PIN #elif Z2_USE_ENDSTOP == _XMAX_ @@ -1422,40 +1422,40 @@ * Set ENDSTOPPULLUPS for active endstop switches */ #if ENABLED(ENDSTOPPULLUPS) - #if ENABLED(USE_XMAX_PLUG) + #if X_HOME_TO_MAX #define ENDSTOPPULLUP_XMAX #endif - #if ENABLED(USE_YMAX_PLUG) + #if Y_HOME_TO_MAX #define ENDSTOPPULLUP_YMAX #endif - #if ENABLED(USE_ZMAX_PLUG) + #if Z_HOME_TO_MAX #define ENDSTOPPULLUP_ZMAX #endif - #if ENABLED(USE_IMAX_PLUG) + #if I_HOME_TO_MAX #define ENDSTOPPULLUP_IMAX #endif - #if ENABLED(USE_JMAX_PLUG) + #if J_HOME_TO_MAX #define ENDSTOPPULLUP_JMAX #endif - #if ENABLED(USE_KMAX_PLUG) + #if K_HOME_TO_MAX #define ENDSTOPPULLUP_KMAX #endif - #if ENABLED(USE_XMIN_PLUG) + #if X_HOME_TO_MIN #define ENDSTOPPULLUP_XMIN #endif - #if ENABLED(USE_YMIN_PLUG) + #if Y_HOME_TO_MIN #define ENDSTOPPULLUP_YMIN #endif - #if ENABLED(USE_ZMIN_PLUG) + #if Z_HOME_TO_MIN #define ENDSTOPPULLUP_ZMIN #endif - #if ENABLED(USE_IMIN_PLUG) + #if I_HOME_TO_MIN #define ENDSTOPPULLUP_IMIN #endif - #if ENABLED(USE_JMIN_PLUG) + #if J_HOME_TO_MIN #define ENDSTOPPULLUP_JMIN #endif - #if ENABLED(USE_KMIN_PLUG) + #if K_HOME_TO_MIN #define ENDSTOPPULLUP_KMIN #endif #endif @@ -1464,24 +1464,42 @@ * Set ENDSTOPPULLDOWNS for active endstop switches */ #if ENABLED(ENDSTOPPULLDOWNS) - #if ENABLED(USE_XMAX_PLUG) + #if X_HOME_TO_MAX #define ENDSTOPPULLDOWN_XMAX #endif - #if ENABLED(USE_YMAX_PLUG) + #if Y_HOME_TO_MAX #define ENDSTOPPULLDOWN_YMAX #endif - #if ENABLED(USE_ZMAX_PLUG) + #if Z_HOME_TO_MAX #define ENDSTOPPULLDOWN_ZMAX #endif - #if ENABLED(USE_XMIN_PLUG) + #if I_HOME_TO_MAX + #define ENDSTOPPULLDOWN_IMAX + #endif + #if J_HOME_TO_MAX + #define ENDSTOPPULLDOWN_JMAX + #endif + #if K_HOME_TO_MAX + #define ENDSTOPPULLDOWN_KMAX + #endif + #if X_HOME_TO_MIN #define ENDSTOPPULLDOWN_XMIN #endif - #if ENABLED(USE_YMIN_PLUG) + #if Y_HOME_TO_MIN #define ENDSTOPPULLDOWN_YMIN #endif - #if ENABLED(USE_ZMIN_PLUG) + #if Z_HOME_TO_MIN #define ENDSTOPPULLDOWN_ZMIN #endif + #if I_HOME_TO_MIN + #define ENDSTOPPULLDOWN_IMIN + #endif + #if J_HOME_TO_MIN + #define ENDSTOPPULLDOWN_JMIN + #endif + #if K_HOME_TO_MIN + #define ENDSTOPPULLDOWN_KMIN + #endif #endif /** @@ -2312,71 +2330,79 @@ #define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_) #define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M)) -#if _HAS_STOP(X,MIN) +#if X_HOME_DIR < 0 && _HAS_STOP(X,MIN) #define HAS_X_MIN 1 #endif -#if _HAS_STOP(X,MAX) +#if X_HOME_DIR > 0 && _HAS_STOP(X,MAX) #define HAS_X_MAX 1 #endif -#if _HAS_STOP(Y,MIN) +#if HAS_Y_AXIS && Y_HOME_DIR < 0 && _HAS_STOP(Y,MIN) #define HAS_Y_MIN 1 #endif -#if _HAS_STOP(Y,MAX) +#if HAS_Y_AXIS && Y_HOME_DIR > 0 && _HAS_STOP(Y,MAX) #define HAS_Y_MAX 1 #endif -#if _HAS_STOP(Z,MIN) +#if HAS_Z_AXIS && Z_HOME_DIR < 0 && _HAS_STOP(Z,MIN) #define HAS_Z_MIN 1 #endif -#if _HAS_STOP(Z,MAX) +#if HAS_Z_AXIS && Z_HOME_DIR > 0 && _HAS_STOP(Z,MAX) #define HAS_Z_MAX 1 #endif -#if _HAS_STOP(I,MIN) +#if LINEAR_AXES >= 4 && I_HOME_DIR < 0 && _HAS_STOP(I,MIN) #define HAS_I_MIN 1 #endif -#if _HAS_STOP(I,MAX) +#if LINEAR_AXES >= 4 && I_HOME_DIR > 0 && _HAS_STOP(I,MAX) #define HAS_I_MAX 1 #endif -#if _HAS_STOP(J,MIN) +#if LINEAR_AXES >= 5 && J_HOME_DIR < 0 && _HAS_STOP(J,MIN) #define HAS_J_MIN 1 #endif -#if _HAS_STOP(J,MAX) +#if LINEAR_AXES >= 5 && J_HOME_DIR > 0 && _HAS_STOP(J,MAX) #define HAS_J_MAX 1 #endif -#if _HAS_STOP(K,MIN) +#if LINEAR_AXES >= 6 && K_HOME_DIR < 0 && _HAS_STOP(K,MIN) #define HAS_K_MIN 1 #endif -#if _HAS_STOP(K,MAX) +#if LINEAR_AXES >= 6 && K_HOME_DIR > 0 && _HAS_STOP(K,MAX) #define HAS_K_MAX 1 #endif -#if PIN_EXISTS(X2_MIN) +#if PIN_EXISTS(X2_MIN) && BOTH(X_DUAL_ENDSTOPS, X_HOME_TO_MIN) #define HAS_X2_MIN 1 #endif -#if PIN_EXISTS(X2_MAX) +#if PIN_EXISTS(X2_MAX) && (ENABLED(DUAL_X_CARRIAGE) || BOTH(X_DUAL_ENDSTOPS, X_HOME_TO_MAX)) #define HAS_X2_MAX 1 #endif -#if PIN_EXISTS(Y2_MIN) - #define HAS_Y2_MIN 1 -#endif -#if PIN_EXISTS(Y2_MAX) - #define HAS_Y2_MAX 1 -#endif -#if PIN_EXISTS(Z2_MIN) - #define HAS_Z2_MIN 1 -#endif -#if PIN_EXISTS(Z2_MAX) - #define HAS_Z2_MAX 1 -#endif -#if PIN_EXISTS(Z3_MIN) - #define HAS_Z3_MIN 1 -#endif -#if PIN_EXISTS(Z3_MAX) - #define HAS_Z3_MAX 1 -#endif -#if PIN_EXISTS(Z4_MIN) - #define HAS_Z4_MIN 1 +#if ENABLED(Y_DUAL_ENDSTOPS) + #if PIN_EXISTS(Y2_MIN) + #define HAS_Y2_MIN 1 + #endif + #if PIN_EXISTS(Y2_MAX) + #define HAS_Y2_MAX 1 + #endif #endif -#if PIN_EXISTS(Z4_MAX) - #define HAS_Z4_MAX 1 +#if ENABLED(Z_MULTI_ENDSTOPS) + #if PIN_EXISTS(Z2_MIN) + #define HAS_Z2_MIN 1 + #endif + #if PIN_EXISTS(Z2_MAX) + #define HAS_Z2_MAX 1 + #endif + #if NUM_Z_STEPPER_DRIVERS >= 3 + #if PIN_EXISTS(Z3_MIN) + #define HAS_Z3_MIN 1 + #endif + #if PIN_EXISTS(Z3_MAX) + #define HAS_Z3_MAX 1 + #endif + #endif + #if NUM_Z_STEPPER_DRIVERS >= 4 + #if PIN_EXISTS(Z4_MIN) + #define HAS_Z4_MIN 1 + #endif + #if PIN_EXISTS(Z4_MAX) + #define HAS_Z4_MAX 1 + #endif + #endif #endif #if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index ab1a6adec5601..0151d00a02e28 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -122,7 +122,7 @@ #elif defined(ENDSTOPPULLUP_FIL_RUNOUT) #error "ENDSTOPPULLUP_FIL_RUNOUT is now FIL_RUNOUT_PULLUP." #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS) - #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated. Use individual USE_*_PLUG options instead." + #error "DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated." #elif defined(LANGUAGE_INCLUDE) #error "LANGUAGE_INCLUDE has been replaced by LCD_LANGUAGE." #elif defined(EXTRUDER_OFFSET_X) || defined(EXTRUDER_OFFSET_Y) @@ -1469,9 +1469,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Delta requirements */ #if ENABLED(DELTA) - #if NONE(USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG) - #error "You probably want to use Max Endstops for DELTA!" - #elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_SEGMENTED #error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL." #elif ENABLED(DELTA_AUTO_CALIBRATION) && !(HAS_BED_PROBE || HAS_LCD_MENU) #error "DELTA_AUTO_CALIBRATION requires a probe or LCD Controller." @@ -1622,10 +1620,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "SENSORLESS_PROBING requires a TMC2130/2160/2209/5130/5160 driver on Z." #endif #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - #if DISABLED(USE_ZMIN_PLUG) - #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled." - #elif !HAS_Z_MIN - #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined." + #if !PIN_EXISTS(Z_MIN) + #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_PIN." #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING." #endif @@ -1967,8 +1963,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, MARKFORGED_YX, or MARKFORGED_XY." #elif !GOOD_AXIS_PINS(X2) #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined." - #elif !HAS_X_MAX - #error "DUAL_X_CARRIAGE requires USE_XMAX_PLUG and an X Max Endstop." + #elif !PIN_EXISTS(Z_MAX) + #error "DUAL_X_CARRIAGE requires X_MAX_PIN." #elif !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) #error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS." #elif X_HOME_TO_MAX || X2_HOME_TO_MIN @@ -2378,67 +2374,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Endstop Tests */ - -#define _PLUG_UNUSED_TEST(A,P) (DISABLED(USE_##P##MIN_PLUG, USE_##P##MAX_PLUG) \ - && !(ENABLED(A##_DUAL_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) \ - && !(ENABLED(A##_MULTI_ENDSTOPS) && WITHIN(A##2_USE_ENDSTOP, _##P##MAX_, _##P##MIN_)) ) -#define _AXIS_PLUG_UNUSED_TEST(A) (1 LINEAR_AXIS_GANG(&& _PLUG_UNUSED_TEST(A,X), && _PLUG_UNUSED_TEST(A,Y), && _PLUG_UNUSED_TEST(A,Z), && _PLUG_UNUSED_TEST(A,I), && _PLUG_UNUSED_TEST(A,J), && _PLUG_UNUSED_TEST(A,K) ) ) - -// A machine with endstops must have a minimum of 3 #if HAS_ENDSTOPS - #if _AXIS_PLUG_UNUSED_TEST(X) - #error "You must enable USE_XMIN_PLUG or USE_XMAX_PLUG." - #endif - #if _AXIS_PLUG_UNUSED_TEST(Y) - #error "You must enable USE_YMIN_PLUG or USE_YMAX_PLUG." - #endif - #if _AXIS_PLUG_UNUSED_TEST(Z) - #error "You must enable USE_ZMIN_PLUG or USE_ZMAX_PLUG." - #endif - #if LINEAR_AXES >= 4 && _AXIS_PLUG_UNUSED_TEST(I) - #error "You must enable USE_IMIN_PLUG or USE_IMAX_PLUG." - #endif - #if LINEAR_AXES >= 5 && _AXIS_PLUG_UNUSED_TEST(J) - #error "You must enable USE_JMIN_PLUG or USE_JMAX_PLUG." - #endif - #if LINEAR_AXES >= 6 && _AXIS_PLUG_UNUSED_TEST(K) - #error "You must enable USE_KMIN_PLUG or USE_KMAX_PLUG." - #endif - - // Delta and Cartesian use 3 homing endstops - #if NONE(IS_SCARA, SPI_ENDSTOPS) - #if X_HOME_TO_MIN && DISABLED(USE_XMIN_PLUG) - #error "Enable USE_XMIN_PLUG when homing X to MIN." - #elif X_HOME_TO_MAX && DISABLED(USE_XMAX_PLUG) - #error "Enable USE_XMAX_PLUG when homing X to MAX." - #elif Y_HOME_TO_MIN && DISABLED(USE_YMIN_PLUG) - #error "Enable USE_YMIN_PLUG when homing Y to MIN." - #elif Y_HOME_TO_MAX && DISABLED(USE_YMAX_PLUG) - #error "Enable USE_YMAX_PLUG when homing Y to MAX." - #elif LINEAR_AXES >= 4 && I_HOME_TO_MIN && DISABLED(USE_IMIN_PLUG) - #error "Enable USE_IMIN_PLUG when homing I to MIN." - #elif LINEAR_AXES >= 4 && I_HOME_TO_MAX && DISABLED(USE_IMAX_PLUG) - #error "Enable USE_IMAX_PLUG when homing I to MAX." - #elif LINEAR_AXES >= 5 && J_HOME_TO_MIN && DISABLED(USE_JMIN_PLUG) - #error "Enable USE_JMIN_PLUG when homing J to MIN." - #elif LINEAR_AXES >= 5 && J_HOME_TO_MAX && DISABLED(USE_JMAX_PLUG) - #error "Enable USE_JMAX_PLUG when homing J to MAX." - #elif LINEAR_AXES >= 6 && K_HOME_TO_MIN && DISABLED(USE_KMIN_PLUG) - #error "Enable USE_KMIN_PLUG when homing K to MIN." - #elif LINEAR_AXES >= 6 && K_HOME_TO_MAX && DISABLED(USE_KMAX_PLUG) - #error "Enable USE_KMAX_PLUG when homing K to MAX." - #endif - #endif - // Z homing direction and plug usage flags - #if Z_HOME_TO_MIN && NONE(USE_ZMIN_PLUG, HOMING_Z_WITH_PROBE) - #error "Enable USE_ZMIN_PLUG when homing Z to MIN." - #elif Z_HOME_TO_MAX && ENABLED(USE_PROBE_FOR_Z_HOMING) + #if Z_HOME_TO_MAX && ENABLED(USE_PROBE_FOR_Z_HOMING) #error "Z_HOME_DIR must be -1 when homing Z with the probe." #elif BOTH(HOMING_Z_WITH_PROBE, Z_MULTI_ENDSTOPS) #error "Z_MULTI_ENDSTOPS is incompatible with USE_PROBE_FOR_Z_HOMING." - #elif Z_HOME_TO_MAX && DISABLED(USE_ZMAX_PLUG) - #error "Enable USE_ZMAX_PLUG when homing Z to MAX." #endif #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp index c7042e760e487..c7a1425c4ee1a 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/endstop_state_screen.cpp @@ -60,32 +60,32 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) { ) .text(BTN_POS(1,1), BTN_SIZE(6,1), GET_TEXT_F(MSG_LCD_ENDSTOPS)) .font(font_tiny); - #if HAS_X_MAX + #if X_HOME_TO_MAX PIN_ENABLED (1, 2, PSTR(STR_X_MAX), X_MAX, X_MAX_ENDSTOP_INVERTING) #else PIN_DISABLED(1, 2, PSTR(STR_X_MAX), X_MAX) #endif - #if HAS_Y_MAX + #if Y_HOME_TO_MAX PIN_ENABLED (3, 2, PSTR(STR_Y_MAX), Y_MAX, Y_MAX_ENDSTOP_INVERTING) #else PIN_DISABLED(3, 2, PSTR(STR_Y_MAX), Y_MAX) #endif - #if HAS_Z_MAX + #if Z_HOME_TO_MAX PIN_ENABLED (5, 2, PSTR(STR_Z_MAX), Z_MAX, Z_MAX_ENDSTOP_INVERTING) #else PIN_DISABLED(5, 2, PSTR(STR_Z_MAX), Z_MAX) #endif - #if HAS_X_MIN + #if X_HOME_TO_MIN PIN_ENABLED (1, 3, PSTR(STR_X_MIN), X_MIN, X_MIN_ENDSTOP_INVERTING) #else PIN_DISABLED(1, 3, PSTR(STR_X_MIN), X_MIN) #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN PIN_ENABLED (3, 3, PSTR(STR_Y_MIN), Y_MIN, Y_MIN_ENDSTOP_INVERTING) #else PIN_DISABLED(3, 3, PSTR(STR_Y_MIN), Y_MIN) #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN PIN_ENABLED (5, 3, PSTR(STR_Z_MIN), Z_MIN, Z_MIN_ENDSTOP_INVERTING) #else PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN) diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 4305462162ca7..a14fa4d1dfb2d 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -45,7 +45,7 @@ #if PIN_EXISTS(MT_DET_2) bool mt_det2_sta; #endif - #if HAS_X_MIN || HAS_X_MAX + #if X_HOME_DIR bool endstopx1_sta; #else constexpr static bool endstopx1_sta = true; @@ -55,7 +55,7 @@ #else constexpr static bool endstopx2_sta = true; #endif - #if HAS_Y_MIN || HAS_Y_MAX + #if HAS_Y_AXIS && Y_HOME_DIR bool endstopy1_sta; #else constexpr static bool endstopy1_sta = true; @@ -65,7 +65,7 @@ #else constexpr static bool endstopy2_sta = true; #endif - #if HAS_Z_MIN || HAS_Z_MAX + #if HAS_Z_AXIS && Z_HOME_DIR bool endstopz1_sta; #else constexpr static bool endstopz1_sta = true; diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 2c1bde245c025..92349659eb3d9 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -430,25 +430,24 @@ void NextionTFT::PanelInfo(uint8_t req) { break; case 36: // Endstop Info - #if HAS_X_MIN + #if X_HOME_TO_MIN SEND_VALasTXT("x1", READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); - #endif - #if HAS_X_MAX + #elif X_HOME_TO_MAX SEND_VALasTXT("x2", READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN SEND_VALasTXT("y1", READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); + #elif Y_HOME_TO_MAX + SEND_VALasTXT("y2", READ(X_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN SEND_VALasTXT("z1", READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); - #endif - #if HAS_Z_MAX + #elif Z_HOME_TO_MAX SEND_VALasTXT("z2", READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); #endif #if HAS_Z2_MIN SEND_VALasTXT("z2", READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING ? "triggered" : "open"); - #endif - #if HAS_Z2_MAX + #elif HAS_Z2_MAX SEND_VALasTXT("z2", READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING ? "triggered" : "open"); #endif #if HAS_BED_PROBE diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 7a2cefdd4cea3..e5d30f68132d5 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -99,7 +99,7 @@ Endstops::endstop_mask_t Endstops::live_state = 0; void Endstops::init() { - #if HAS_X_MIN + #if X_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_XMIN) SET_INPUT_PULLUP(X_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_XMIN) @@ -107,19 +107,35 @@ void Endstops::init() { #else SET_INPUT(X_MIN_PIN); #endif - #endif - - #if HAS_X2_MIN - #if ENABLED(ENDSTOPPULLUP_XMIN) - SET_INPUT_PULLUP(X2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMIN) - SET_INPUT_PULLDOWN(X2_MIN_PIN); + #if HAS_X2_MIN + #if ENABLED(ENDSTOPPULLUP_XMIN) + SET_INPUT_PULLUP(X2_MIN_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_XMIN) + SET_INPUT_PULLDOWN(X2_MIN_PIN); + #else + SET_INPUT(X2_MIN_PIN); + #endif + #endif + #elif X_HOME_TO_MAX + #if ENABLED(ENDSTOPPULLUP_XMAX) + SET_INPUT_PULLUP(X_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_XMAX) + SET_INPUT_PULLDOWN(X_MAX_PIN); #else - SET_INPUT(X2_MIN_PIN); + SET_INPUT(X_MAX_PIN); + #endif + #if HAS_X2_MAX + #if ENABLED(ENDSTOPPULLUP_XMAX) + SET_INPUT_PULLUP(X2_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_XMAX) + SET_INPUT_PULLDOWN(X2_MAX_PIN); + #else + SET_INPUT(X2_MAX_PIN); + #endif #endif #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_YMIN) SET_INPUT_PULLUP(Y_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_YMIN) @@ -127,19 +143,35 @@ void Endstops::init() { #else SET_INPUT(Y_MIN_PIN); #endif - #endif - - #if HAS_Y2_MIN - #if ENABLED(ENDSTOPPULLUP_YMIN) - SET_INPUT_PULLUP(Y2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMIN) - SET_INPUT_PULLDOWN(Y2_MIN_PIN); + #if HAS_Y2_MIN + #if ENABLED(ENDSTOPPULLUP_YMIN) + SET_INPUT_PULLUP(Y2_MIN_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_YMIN) + SET_INPUT_PULLDOWN(Y2_MIN_PIN); + #else + SET_INPUT(Y2_MIN_PIN); + #endif + #endif + #elif Y_HOME_TO_MAX + #if ENABLED(ENDSTOPPULLUP_YMAX) + SET_INPUT_PULLUP(Y_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_YMAX) + SET_INPUT_PULLDOWN(Y_MAX_PIN); #else - SET_INPUT(Y2_MIN_PIN); + SET_INPUT(Y_MAX_PIN); + #endif + #if HAS_Y2_MAX + #if ENABLED(ENDSTOPPULLUP_YMAX) + SET_INPUT_PULLUP(Y2_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_YMAX) + SET_INPUT_PULLDOWN(Y2_MAX_PIN); + #else + SET_INPUT(Y2_MAX_PIN); + #endif #endif #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_ZMIN) SET_INPUT_PULLUP(Z_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) @@ -147,79 +179,34 @@ void Endstops::init() { #else SET_INPUT(Z_MIN_PIN); #endif - #endif - - #if HAS_Z2_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z2_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z2_MIN_PIN); - #else - SET_INPUT(Z2_MIN_PIN); - #endif - #endif - - #if HAS_Z3_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z3_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z3_MIN_PIN); - #else - SET_INPUT(Z3_MIN_PIN); - #endif - #endif - - #if HAS_Z4_MIN - #if ENABLED(ENDSTOPPULLUP_ZMIN) - SET_INPUT_PULLUP(Z4_MIN_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) - SET_INPUT_PULLDOWN(Z4_MIN_PIN); - #else - SET_INPUT(Z4_MIN_PIN); - #endif - #endif - - #if HAS_X_MAX - #if ENABLED(ENDSTOPPULLUP_XMAX) - SET_INPUT_PULLUP(X_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMAX) - SET_INPUT_PULLDOWN(X_MAX_PIN); - #else - SET_INPUT(X_MAX_PIN); - #endif - #endif - - #if HAS_X2_MAX - #if ENABLED(ENDSTOPPULLUP_XMAX) - SET_INPUT_PULLUP(X2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_XMAX) - SET_INPUT_PULLDOWN(X2_MAX_PIN); - #else - SET_INPUT(X2_MAX_PIN); + #if HAS_Z2_MIN + #if ENABLED(ENDSTOPPULLUP_ZMIN) + SET_INPUT_PULLUP(Z2_MIN_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) + SET_INPUT_PULLDOWN(Z2_MIN_PIN); + #else + SET_INPUT(Z2_MIN_PIN); + #endif #endif - #endif - - #if HAS_Y_MAX - #if ENABLED(ENDSTOPPULLUP_YMAX) - SET_INPUT_PULLUP(Y_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMAX) - SET_INPUT_PULLDOWN(Y_MAX_PIN); - #else - SET_INPUT(Y_MAX_PIN); + #if HAS_Z3_MIN + #if ENABLED(ENDSTOPPULLUP_ZMIN) + SET_INPUT_PULLUP(Z3_MIN_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) + SET_INPUT_PULLDOWN(Z3_MIN_PIN); + #else + SET_INPUT(Z3_MIN_PIN); + #endif #endif - #endif - - #if HAS_Y2_MAX - #if ENABLED(ENDSTOPPULLUP_YMAX) - SET_INPUT_PULLUP(Y2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_YMAX) - SET_INPUT_PULLDOWN(Y2_MAX_PIN); - #else - SET_INPUT(Y2_MAX_PIN); + #if HAS_Z4_MIN + #if ENABLED(ENDSTOPPULLUP_ZMIN) + SET_INPUT_PULLUP(Z4_MIN_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMIN) + SET_INPUT_PULLDOWN(Z4_MIN_PIN); + #else + SET_INPUT(Z4_MIN_PIN); + #endif #endif - #endif - - #if HAS_Z_MAX + #elif Z_HOME_TO_MAX #if ENABLED(ENDSTOPPULLUP_ZMAX) SET_INPUT_PULLUP(Z_MAX_PIN); #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) @@ -227,39 +214,36 @@ void Endstops::init() { #else SET_INPUT(Z_MAX_PIN); #endif - #endif - - #if HAS_Z2_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z2_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z2_MAX_PIN); - #else - SET_INPUT(Z2_MAX_PIN); + #if HAS_Z2_MAX + #if ENABLED(ENDSTOPPULLUP_ZMAX) + SET_INPUT_PULLUP(Z2_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) + SET_INPUT_PULLDOWN(Z2_MAX_PIN); + #else + SET_INPUT(Z2_MAX_PIN); + #endif #endif - #endif - - #if HAS_Z3_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z3_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z3_MAX_PIN); - #else - SET_INPUT(Z3_MAX_PIN); + #if HAS_Z3_MAX + #if ENABLED(ENDSTOPPULLUP_ZMAX) + SET_INPUT_PULLUP(Z3_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) + SET_INPUT_PULLDOWN(Z3_MAX_PIN); + #else + SET_INPUT(Z3_MAX_PIN); + #endif #endif - #endif - - #if HAS_Z4_MAX - #if ENABLED(ENDSTOPPULLUP_ZMAX) - SET_INPUT_PULLUP(Z4_MAX_PIN); - #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) - SET_INPUT_PULLDOWN(Z4_MAX_PIN); - #else - SET_INPUT(Z4_MAX_PIN); + #if HAS_Z4_MAX + #if ENABLED(ENDSTOPPULLUP_ZMAX) + SET_INPUT_PULLUP(Z4_MAX_PIN); + #elif ENABLED(ENDSTOPPULLDOWN_ZMAX) + SET_INPUT_PULLDOWN(Z4_MAX_PIN); + #else + SET_INPUT(Z4_MAX_PIN); + #endif #endif #endif - #if HAS_I_MIN + #if I_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_IMIN) SET_INPUT_PULLUP(I_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_IMIN) @@ -267,9 +251,7 @@ void Endstops::init() { #else SET_INPUT(I_MIN_PIN); #endif - #endif - - #if HAS_I_MAX + #elif I_HOME_TO_MAX #if ENABLED(ENDSTOPPULLUP_IMAX) SET_INPUT_PULLUP(I_MAX_PIN); #elif ENABLED(ENDSTOPPULLDOWN_IMAX) @@ -279,7 +261,7 @@ void Endstops::init() { #endif #endif - #if HAS_J_MIN + #if J_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_JMIN) SET_INPUT_PULLUP(J_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_IMIN) @@ -287,9 +269,7 @@ void Endstops::init() { #else SET_INPUT(J_MIN_PIN); #endif - #endif - - #if HAS_J_MAX + #elif J_HOME_TO_MAX #if ENABLED(ENDSTOPPULLUP_JMAX) SET_INPUT_PULLUP(J_MAX_PIN); #elif ENABLED(ENDSTOPPULLDOWN_JMAX) @@ -299,7 +279,7 @@ void Endstops::init() { #endif #endif - #if HAS_K_MIN + #if K_HOME_TO_MIN #if ENABLED(ENDSTOPPULLUP_KMIN) SET_INPUT_PULLUP(K_MIN_PIN); #elif ENABLED(ENDSTOPPULLDOWN_KMIN) @@ -307,9 +287,7 @@ void Endstops::init() { #else SET_INPUT(K_MIN_PIN); #endif - #endif - - #if HAS_K_MAX + #elif K_HOME_TO_MAX #if ENABLED(ENDSTOPPULLUP_KMAX) SET_INPUT_PULLUP(K_MAX_PIN); #elif ENABLED(ENDSTOPPULLDOWN_KMIN) @@ -435,7 +413,7 @@ void Endstops::event_handler() { SERIAL_ECHOPGM(" " STRINGIFY(A) ":", planner.triggered_position_mm(_AXIS(A))); _SET_STOP_CHAR(A,C); }while(0) #define _ENDSTOP_HIT_TEST(A,C) \ - if (TERN0(HAS_##A##_MIN, TEST(hit_state, A##_MIN)) || TERN0(HAS_##A##_MAX, TEST(hit_state, A##_MAX))) \ + if (TERN0(A##_HOME_TO_MIN, TEST(hit_state, A##_MIN)) || TERN0(A##_HOME_TO_MAX, TEST(hit_state, A##_MAX))) \ _ENDSTOP_HIT_ECHO(A,C) #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X') @@ -498,70 +476,63 @@ void _O2 Endstops::report_states() { TERN_(BLTOUCH, bltouch._set_SW_mode()); SERIAL_ECHOLNPGM(STR_M119_REPORT); #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, F(STR_##S)) - #if HAS_X_MIN + #if X_HOME_TO_MIN ES_REPORT(X_MIN); #endif #if HAS_X2_MIN ES_REPORT(X2_MIN); #endif - #if HAS_X_MAX + #if X_HOME_TO_MAX ES_REPORT(X_MAX); #endif #if HAS_X2_MAX ES_REPORT(X2_MAX); #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN ES_REPORT(Y_MIN); #endif #if HAS_Y2_MIN ES_REPORT(Y2_MIN); #endif - #if HAS_Y_MAX + #if Y_HOME_TO_MAX ES_REPORT(Y_MAX); #endif #if HAS_Y2_MAX ES_REPORT(Y2_MAX); #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN ES_REPORT(Z_MIN); + #elif Z_HOME_TO_MAX + ES_REPORT(Z_MAX); #endif #if HAS_Z2_MIN ES_REPORT(Z2_MIN); + #elif HAS_Z2_MAX + ES_REPORT(Z2_MAX); #endif #if HAS_Z3_MIN ES_REPORT(Z3_MIN); + #elif HAS_Z3_MAX + ES_REPORT(Z3_MAX); #endif #if HAS_Z4_MIN ES_REPORT(Z4_MIN); - #endif - #if HAS_Z_MAX - ES_REPORT(Z_MAX); - #endif - #if HAS_Z2_MAX - ES_REPORT(Z2_MAX); - #endif - #if HAS_Z3_MAX - ES_REPORT(Z3_MAX); - #endif - #if HAS_Z4_MAX + #elif HAS_Z4_MAX ES_REPORT(Z4_MAX); #endif - #if HAS_I_MIN + #if I_HOME_TO_MIN ES_REPORT(I_MIN); - #endif - #if HAS_I_MAX + #elif I_HOME_TO_MAX ES_REPORT(I_MAX); #endif - #if HAS_J_MIN + #if J_HOME_TO_MIN ES_REPORT(J_MIN); - #endif - #if HAS_J_MAX + #elif J_HOME_TO_MAX ES_REPORT(J_MAX); #endif - #if HAS_K_MIN + #if K_HOME_TO_MIN ES_REPORT(K_MIN); - #endif - #if HAS_K_MAX + #elif K_HOME_TO_MAX ES_REPORT(K_MAX); #endif #if ENABLED(PROBE_ACTIVATION_SWITCH) @@ -651,7 +622,7 @@ void Endstops::update() { /** * Check and update endstops */ - #if HAS_X_MIN && !X_SPI_SENSORLESS + #if X_HOME_TO_MIN && !X_SPI_SENSORLESS UPDATE_ENDSTOP_BIT(X, MIN); #if ENABLED(X_DUAL_ENDSTOPS) #if HAS_X2_MIN @@ -662,7 +633,7 @@ void Endstops::update() { #endif #endif - #if HAS_X_MAX && !X_SPI_SENSORLESS + #if X_HOME_TO_MAX && !X_SPI_SENSORLESS UPDATE_ENDSTOP_BIT(X, MAX); #if ENABLED(X_DUAL_ENDSTOPS) #if HAS_X2_MAX @@ -673,7 +644,7 @@ void Endstops::update() { #endif #endif - #if HAS_Y_MIN && !Y_SPI_SENSORLESS + #if Y_HOME_TO_MIN && !Y_SPI_SENSORLESS UPDATE_ENDSTOP_BIT(Y, MIN); #if ENABLED(Y_DUAL_ENDSTOPS) #if HAS_Y2_MIN @@ -684,7 +655,7 @@ void Endstops::update() { #endif #endif - #if HAS_Y_MAX && !Y_SPI_SENSORLESS + #if Y_HOME_TO_MAX && !Y_SPI_SENSORLESS UPDATE_ENDSTOP_BIT(Y, MAX); #if ENABLED(Y_DUAL_ENDSTOPS) #if HAS_Y2_MAX @@ -695,7 +666,7 @@ void Endstops::update() { #endif #endif - #if HAS_Z_MIN && NONE(Z_SPI_SENSORLESS, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + #if Z_HOME_TO_MIN && NONE(Z_SPI_SENSORLESS, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) UPDATE_ENDSTOP_BIT(Z, MIN); #if ENABLED(Z_MULTI_ENDSTOPS) #if HAS_Z2_MIN @@ -726,7 +697,7 @@ void Endstops::update() { UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN)); #endif - #if HAS_Z_MAX && !Z_SPI_SENSORLESS + #if Z_HOME_TO_MAX && !Z_SPI_SENSORLESS // Check both Z dual endstops #if ENABLED(Z_MULTI_ENDSTOPS) UPDATE_ENDSTOP_BIT(Z, MAX); @@ -755,7 +726,7 @@ void Endstops::update() { #endif #endif - #if HAS_I_MIN && !I_SPI_SENSORLESS + #if I_HOME_TO_MIN && !I_SPI_SENSORLESS #if ENABLED(I_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(I, MIN); #if HAS_I2_MIN @@ -768,7 +739,7 @@ void Endstops::update() { #endif #endif - #if HAS_I_MAX && !I_SPI_SENSORLESS + #if I_HOME_TO_MAX && !I_SPI_SENSORLESS #if ENABLED(I_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(I, MAX); #if HAS_I2_MAX @@ -781,7 +752,7 @@ void Endstops::update() { #endif #endif - #if HAS_J_MIN && !J_SPI_SENSORLESS + #if J_HOME_TO_MIN && !J_SPI_SENSORLESS #if ENABLED(J_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(J, MIN); #if HAS_J2_MIN @@ -794,7 +765,7 @@ void Endstops::update() { #endif #endif - #if HAS_J_MAX && !J_SPI_SENSORLESS + #if J_HOME_TO_MAX && !J_SPI_SENSORLESS #if ENABLED(J_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(J, MAX); #if HAS_J2_MAX @@ -807,7 +778,7 @@ void Endstops::update() { #endif #endif - #if HAS_K_MIN && !K_SPI_SENSORLESS + #if K_HOME_TO_MIN && !K_SPI_SENSORLESS #if ENABLED(K_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(K, MIN); #if HAS_K2_MIN @@ -820,7 +791,7 @@ void Endstops::update() { #endif #endif - #if HAS_K_MAX && !K_SPI_SENSORLESS + #if K_HOME_TO_MAX && !K_SPI_SENSORLESS #if ENABLED(K_DUAL_ENDSTOPS) UPDATE_ENDSTOP_BIT(K, MAX); #if HAS_K2_MAX @@ -952,7 +923,7 @@ void Endstops::update() { if (stepper.axis_is_moving(X_AXIS)) { if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction - #if HAS_X_MIN || (X_SPI_SENSORLESS && X_HOME_TO_MIN) + #if X_HOME_TO_MIN PROCESS_ENDSTOP_X(MIN); #if CORE_DIAG(XY, Y, MIN) PROCESS_CORE_ENDSTOP(Y,MIN,X,MIN); @@ -966,7 +937,7 @@ void Endstops::update() { #endif } else { // +direction - #if HAS_X_MAX || (X_SPI_SENSORLESS && X_HOME_TO_MAX) + #if X_HOME_TO_MAX PROCESS_ENDSTOP_X(MAX); #if CORE_DIAG(XY, Y, MIN) PROCESS_CORE_ENDSTOP(Y,MIN,X,MAX); @@ -984,7 +955,7 @@ void Endstops::update() { #if HAS_Y_AXIS if (stepper.axis_is_moving(Y_AXIS)) { if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction - #if HAS_Y_MIN || (Y_SPI_SENSORLESS && Y_HOME_TO_MIN) + #if Y_HOME_TO_MIN PROCESS_ENDSTOP_Y(MIN); #if CORE_DIAG(XY, X, MIN) PROCESS_CORE_ENDSTOP(X,MIN,Y,MIN); @@ -998,7 +969,7 @@ void Endstops::update() { #endif } else { // +direction - #if HAS_Y_MAX || (Y_SPI_SENSORLESS && Y_HOME_TO_MAX) + #if Y_HOME_TO_MAX PROCESS_ENDSTOP_Y(MAX); #if CORE_DIAG(XY, X, MIN) PROCESS_CORE_ENDSTOP(X,MIN,Y,MAX); @@ -1018,7 +989,7 @@ void Endstops::update() { if (stepper.axis_is_moving(Z_AXIS)) { if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up. - #if HAS_Z_MIN || (Z_SPI_SENSORLESS && Z_HOME_TO_MIN) + #if Z_HOME_TO_MIN if ( TERN1(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, z_probe_enabled) && TERN1(USES_Z_MIN_PROBE_PIN, !z_probe_enabled) ) PROCESS_ENDSTOP_Z(MIN); @@ -1039,7 +1010,7 @@ void Endstops::update() { #endif } else { // Z +direction. Gantry up, bed down. - #if HAS_Z_MAX || (Z_SPI_SENSORLESS && Z_HOME_TO_MAX) + #if Z_HOME_TO_MAX #if ENABLED(Z_MULTI_ENDSTOPS) PROCESS_ENDSTOP_Z(MAX); #elif TERN1(USES_Z_MIN_PROBE_PIN, Z_MAX_PIN != Z_MIN_PROBE_PIN) // No probe or probe is Z_MIN || Probe is not Z_MAX @@ -1062,12 +1033,12 @@ void Endstops::update() { #if LINEAR_AXES >= 4 if (stepper.axis_is_moving(I_AXIS)) { if (stepper.motor_direction(I_AXIS_HEAD)) { // -direction - #if HAS_I_MIN || (I_SPI_SENSORLESS && I_HOME_TO_MIN) + #if I_HOME_TO_MIN PROCESS_ENDSTOP(I, MIN); #endif } else { // +direction - #if HAS_I_MAX || (I_SPI_SENSORLESS && I_HOME_TO_MAX) + #if I_HOME_TO_MAX PROCESS_ENDSTOP(I, MAX); #endif } @@ -1077,12 +1048,12 @@ void Endstops::update() { #if LINEAR_AXES >= 5 if (stepper.axis_is_moving(J_AXIS)) { if (stepper.motor_direction(J_AXIS_HEAD)) { // -direction - #if HAS_J_MIN || (J_SPI_SENSORLESS && J_HOME_TO_MIN) + #if J_HOME_TO_MIN PROCESS_ENDSTOP(J, MIN); #endif } else { // +direction - #if HAS_J_MAX || (J_SPI_SENSORLESS && J_HOME_TO_MAX) + #if J_HOME_TO_MAX PROCESS_ENDSTOP(J, MAX); #endif } @@ -1092,12 +1063,12 @@ void Endstops::update() { #if LINEAR_AXES >= 6 if (stepper.axis_is_moving(K_AXIS)) { if (stepper.motor_direction(K_AXIS_HEAD)) { // -direction - #if HAS_K_MIN || (K_SPI_SENSORLESS && K_HOME_TO_MIN) + #if K_HOME_TO_MIN PROCESS_ENDSTOP(K, MIN); #endif } else { // +direction - #if HAS_K_MAX || (K_SPI_SENSORLESS && K_HOME_TO_MAX) + #if K_HOME_TO_MAX PROCESS_ENDSTOP(K, MAX); #endif } @@ -1201,147 +1172,141 @@ void Endstops::update() { #define ES_GET_STATE(S) if (READ(S##_PIN)) SBI(live_state_local, S) - #if HAS_X_MIN + #if X_HOME_TO_MIN ES_GET_STATE(X_MIN); - #endif - #if HAS_X_MAX + #if HAS_X2_MIN + ES_GET_STATE(X2_MIN); + #endif + #elif X_HOME_TO_MAX ES_GET_STATE(X_MAX); + #if HAS_X2_MAX + ES_GET_STATE(X2_MAX); + #endif #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN ES_GET_STATE(Y_MIN); - #endif - #if HAS_Y_MAX + #if HAS_Y2_MIN + ES_GET_STATE(Y2_MIN); + #endif + #elif Y_HOME_TO_MAX ES_GET_STATE(Y_MAX); + #if HAS_Y2_MAX + ES_GET_STATE(Y2_MAX); + #endif #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN ES_GET_STATE(Z_MIN); - #endif - #if HAS_Z_MAX + #if HAS_Z2_MIN + ES_GET_STATE(Z2_MIN); + #endif + #if HAS_Z3_MIN + ES_GET_STATE(Z3_MIN); + #endif + #if HAS_Z4_MIN + ES_GET_STATE(Z4_MIN); + #endif + #elif Z_HOME_TO_MAX ES_GET_STATE(Z_MAX); + #if HAS_Z2_MAX + ES_GET_STATE(Z2_MAX); + #endif + #if HAS_Z3_MAX + ES_GET_STATE(Z3_MAX); + #endif + #if HAS_Z4_MAX + ES_GET_STATE(Z4_MAX); + #endif #endif - #if HAS_Z_MIN_PROBE_PIN - ES_GET_STATE(Z_MIN_PROBE); - #endif - #if HAS_X2_MIN - ES_GET_STATE(X2_MIN); - #endif - #if HAS_X2_MAX - ES_GET_STATE(X2_MAX); - #endif - #if HAS_Y2_MIN - ES_GET_STATE(Y2_MIN); - #endif - #if HAS_Y2_MAX - ES_GET_STATE(Y2_MAX); - #endif - #if HAS_Z2_MIN - ES_GET_STATE(Z2_MIN); - #endif - #if HAS_Z2_MAX - ES_GET_STATE(Z2_MAX); - #endif - #if HAS_Z3_MIN - ES_GET_STATE(Z3_MIN); - #endif - #if HAS_Z3_MAX - ES_GET_STATE(Z3_MAX); - #endif - #if HAS_Z4_MIN - ES_GET_STATE(Z4_MIN); - #endif - #if HAS_Z4_MAX - ES_GET_STATE(Z4_MAX); - #endif - #if HAS_I_MAX + #if I_HOME_TO_MAX ES_GET_STATE(I_MAX); - #endif - #if HAS_I_MIN + #elif I_HOME_TO_MIN ES_GET_STATE(I_MIN); #endif - #if HAS_J_MAX + #if J_HOME_TO_MAX ES_GET_STATE(J_MAX); - #endif - #if HAS_J_MIN + #elif J_HOME_TO_MIN ES_GET_STATE(J_MIN); #endif - #if HAS_K_MAX + #if K_HOME_TO_MAX ES_GET_STATE(K_MAX); - #endif - #if HAS_K_MIN + #elif K_HOME_TO_MIN ES_GET_STATE(K_MIN); #endif + #if HAS_Z_MIN_PROBE_PIN + ES_GET_STATE(Z_MIN_PROBE); + #endif uint16_t endstop_change = live_state_local ^ old_live_state_local; #define ES_REPORT_CHANGE(S) if (TEST(endstop_change, S)) SERIAL_ECHOPGM(" " STRINGIFY(S) ":", TEST(live_state_local, S)) if (endstop_change) { - #if HAS_X_MIN + #if X_HOME_TO_MIN ES_REPORT_CHANGE(X_MIN); + #if HAS_X2_MIN + ES_REPORT_CHANGE(X2_MIN); + #endif #endif - #if HAS_X_MAX + #if X_HOME_TO_MAX ES_REPORT_CHANGE(X_MAX); + #if HAS_X2_MAX + ES_REPORT_CHANGE(X2_MAX); + #endif #endif - #if HAS_Y_MIN + #if Y_HOME_TO_MIN ES_REPORT_CHANGE(Y_MIN); + #if HAS_Y2_MIN + ES_REPORT_CHANGE(Y2_MIN); + #endif #endif - #if HAS_Y_MAX + #if Y_HOME_TO_MAX ES_REPORT_CHANGE(Y_MAX); + #if HAS_Y2_MAX + ES_REPORT_CHANGE(Y2_MAX); + #endif #endif - #if HAS_Z_MIN + #if Z_HOME_TO_MIN ES_REPORT_CHANGE(Z_MIN); + #if HAS_Z2_MIN + ES_REPORT_CHANGE(Z2_MIN); + #endif + #if HAS_Z3_MIN + ES_REPORT_CHANGE(Z3_MIN); + #endif + #if HAS_Z4_MIN + ES_REPORT_CHANGE(Z4_MIN); + #endif #endif - #if HAS_Z_MAX + #if Z_HOME_TO_MAX ES_REPORT_CHANGE(Z_MAX); + #if HAS_Z2_MAX + ES_REPORT_CHANGE(Z2_MAX); + #endif + #if HAS_Z3_MAX + ES_REPORT_CHANGE(Z3_MAX); + #endif + #if HAS_Z4_MAX + ES_REPORT_CHANGE(Z4_MAX); + #endif #endif #if HAS_Z_MIN_PROBE_PIN ES_REPORT_CHANGE(Z_MIN_PROBE); #endif - #if HAS_X2_MIN - ES_REPORT_CHANGE(X2_MIN); - #endif - #if HAS_X2_MAX - ES_REPORT_CHANGE(X2_MAX); - #endif - #if HAS_Y2_MIN - ES_REPORT_CHANGE(Y2_MIN); - #endif - #if HAS_Y2_MAX - ES_REPORT_CHANGE(Y2_MAX); - #endif - #if HAS_Z2_MIN - ES_REPORT_CHANGE(Z2_MIN); - #endif - #if HAS_Z2_MAX - ES_REPORT_CHANGE(Z2_MAX); - #endif - #if HAS_Z3_MIN - ES_REPORT_CHANGE(Z3_MIN); - #endif - #if HAS_Z3_MAX - ES_REPORT_CHANGE(Z3_MAX); - #endif - #if HAS_Z4_MIN - ES_REPORT_CHANGE(Z4_MIN); - #endif - #if HAS_Z4_MAX - ES_REPORT_CHANGE(Z4_MAX); - #endif - #if HAS_I_MIN + #if I_HOME_TO_MIN ES_REPORT_CHANGE(I_MIN); #endif - #if HAS_I_MAX + #if I_HOME_TO_MAX ES_REPORT_CHANGE(I_MAX); #endif - #if HAS_J_MIN + #if J_HOME_TO_MIN ES_REPORT_CHANGE(J_MIN); #endif - #if HAS_J_MAX + #if J_HOME_TO_MAX ES_REPORT_CHANGE(J_MAX); #endif - #if HAS_K_MIN + #if K_HOME_TO_MIN ES_REPORT_CHANGE(K_MIN); #endif - #if HAS_K_MAX + #if K_HOME_TO_MAX ES_REPORT_CHANGE(K_MAX); #endif SERIAL_ECHOLNPGM("\n"); diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 00dc429668870..fbef069b61a83 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -32,41 +32,31 @@ #define _ES_ITEM(K,N) TERN_(K,DEFER4(__ES_ITEM)(N)) enum EndstopEnum : char { - // Common XYZ (ABC) endstops. Defined according to USE_[XYZ](MIN|MAX)_PLUG settings. - _ES_ITEM(HAS_X_MIN, X_MIN) - _ES_ITEM(HAS_X_MAX, X_MAX) - _ES_ITEM(HAS_Y_MIN, Y_MIN) - _ES_ITEM(HAS_Y_MAX, Y_MAX) - _ES_ITEM(HAS_Z_MIN, Z_MIN) - _ES_ITEM(HAS_Z_MAX, Z_MAX) - _ES_ITEM(HAS_I_MIN, I_MIN) - _ES_ITEM(HAS_I_MAX, I_MAX) - _ES_ITEM(HAS_J_MIN, J_MIN) - _ES_ITEM(HAS_J_MAX, J_MAX) - _ES_ITEM(HAS_K_MIN, K_MIN) - _ES_ITEM(HAS_K_MAX, K_MAX) + // Common XYZ (ABC) endstops. + _ES_ITEM(X_HOME_TO_MIN, X_MIN) + _ES_ITEM(X_HOME_TO_MAX, X_MAX) + _ES_ITEM(Y_HOME_TO_MIN, Y_MIN) + _ES_ITEM(Y_HOME_TO_MAX, Y_MAX) + _ES_ITEM(Z_HOME_TO_MIN, Z_MIN) + _ES_ITEM(Z_HOME_TO_MAX, Z_MAX) + _ES_ITEM(I_HOME_TO_MIN, I_MIN) + _ES_ITEM(I_HOME_TO_MAX, I_MAX) + _ES_ITEM(J_HOME_TO_MIN, J_MIN) + _ES_ITEM(J_HOME_TO_MAX, J_MAX) + _ES_ITEM(K_HOME_TO_MIN, K_MIN) + _ES_ITEM(K_HOME_TO_MAX, K_MAX) // Extra Endstops for XYZ - #if ENABLED(X_DUAL_ENDSTOPS) - _ES_ITEM(HAS_X_MIN, X2_MIN) - _ES_ITEM(HAS_X_MAX, X2_MAX) - #endif - #if ENABLED(Y_DUAL_ENDSTOPS) - _ES_ITEM(HAS_Y_MIN, Y2_MIN) - _ES_ITEM(HAS_Y_MAX, Y2_MAX) - #endif - #if ENABLED(Z_MULTI_ENDSTOPS) - _ES_ITEM(HAS_Z_MIN, Z2_MIN) - _ES_ITEM(HAS_Z_MAX, Z2_MAX) - #if NUM_Z_STEPPER_DRIVERS >= 3 - _ES_ITEM(HAS_Z_MIN, Z3_MIN) - _ES_ITEM(HAS_Z_MAX, Z3_MAX) - #endif - #if NUM_Z_STEPPER_DRIVERS >= 4 - _ES_ITEM(HAS_Z_MIN, Z4_MIN) - _ES_ITEM(HAS_Z_MAX, Z4_MAX) - #endif - #endif + _ES_ITEM(HAS_X2_MIN, X2_MIN) + _ES_ITEM(HAS_X2_MAX, X2_MAX) + _ES_ITEM(HAS_Y2_MIN, Y2_MIN) + _ES_ITEM(HAS_Y2_MAX, Y2_MAX) + _ES_ITEM(HAS_Z2_MIN, Z2_MIN) + _ES_ITEM(HAS_Z2_MAX, Z2_MAX) + _ES_ITEM(HAS_Z3_MIN, Z3_MIN) + _ES_ITEM(HAS_Z3_MAX, Z3_MAX) + _ES_ITEM(HAS_Z4_MIN, Z4_MIN) + _ES_ITEM(HAS_Z4_MAX, Z4_MAX) // Bed Probe state is distinct or shared with Z_MIN (i.e., when the probe is the only Z endstop) #if !HAS_DELTA_SENSORLESS_PROBING @@ -77,22 +67,22 @@ enum EndstopEnum : char { NUM_ENDSTOP_STATES // Endstops can be either MIN or MAX but not both - #if HAS_X_MIN || HAS_X_MAX + #if X_HOME_DIR , X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN) #endif - #if HAS_Y_MIN || HAS_Y_MAX + #if HAS_Y_AXIS && Y_HOME_DIR , Y_ENDSTOP = TERN(Y_HOME_TO_MAX, Y_MAX, Y_MIN) #endif - #if HAS_Z_MIN || HAS_Z_MAX || HOMING_Z_WITH_PROBE + #if HAS_Z_AXIS && Z_HOME_DIR , Z_ENDSTOP = TERN(Z_HOME_TO_MAX, Z_MAX, TERN(HOMING_Z_WITH_PROBE, Z_MIN_PROBE, Z_MIN)) #endif - #if HAS_I_MIN || HAS_I_MAX + #if LINEAR_AXES >= 4 && I_HOME_DIR , I_ENDSTOP = TERN(I_HOME_TO_MAX, I_MAX, I_MIN) #endif - #if HAS_J_MIN || HAS_J_MAX + #if LINEAR_AXES >= 5 && J_HOME_DIR , J_ENDSTOP = TERN(J_HOME_TO_MAX, J_MAX, J_MIN) #endif - #if HAS_K_MIN || HAS_K_MAX + #if LINEAR_AXES >= 6 && K_HOME_DIR , K_ENDSTOP = TERN(K_HOME_TO_MAX, K_MAX, K_MIN) #endif }; diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index 934b74cbb1602..bf214761d3b2c 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -228,7 +228,7 @@ #define PS_ON_PIN P2_12 // (12) -#if !defined(TEMP_0_CS_PIN) && DISABLED(USE_ZMAX_PLUG) +#if !defined(TEMP_0_CS_PIN) && !(HAS_Z_AXIS && Z_HOME_DIR) #define TEMP_0_CS_PIN P1_28 #endif diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index fe8c4c6c41aaf..ba6b60dbc1681 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1276,113 +1276,6 @@ #define K_MS3_PIN -1 #endif -// -// Disable unused endstop / probe pins -// -#define _STOP_IN_USE(N) (X2_USE_ENDSTOP == N || Y2_USE_ENDSTOP == N || Z2_USE_ENDSTOP == N || Z3_USE_ENDSTOP == N || Z4_USE_ENDSTOP == N) -#if !defined(USE_XMAX_PLUG) && _STOP_IN_USE(_XMAX_) - #define USE_XMAX_PLUG -#endif -#if !defined(USE_YMAX_PLUG) && _STOP_IN_USE(_YMAX_) - #define USE_YMAX_PLUG -#endif -#if !defined(USE_ZMAX_PLUG) && _STOP_IN_USE(_ZMAX_) - #define USE_ZMAX_PLUG -#endif -#if !defined(USE_XMIN_PLUG) && _STOP_IN_USE(_XMIN_) - #define USE_XMIN_PLUG -#endif -#if !defined(USE_YMIN_PLUG) && _STOP_IN_USE(_YMIN_) - #define USE_YMIN_PLUG -#endif -#if !defined(USE_ZMIN_PLUG) && _STOP_IN_USE(_ZMIN_) - #define USE_ZMIN_PLUG -#endif -#undef _STOP_IN_USE -#if !USES_Z_MIN_PROBE_PIN - #undef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN -1 -#endif -#if DISABLED(USE_XMIN_PLUG) - #undef X_MIN_PIN - #define X_MIN_PIN -1 -#endif -#if DISABLED(USE_XMAX_PLUG) - #undef X_MAX_PIN - #define X_MAX_PIN -1 -#endif -#if DISABLED(USE_YMIN_PLUG) - #undef Y_MIN_PIN - #define Y_MIN_PIN -1 -#endif -#if DISABLED(USE_YMAX_PLUG) - #undef Y_MAX_PIN - #define Y_MAX_PIN -1 -#endif -#if DISABLED(USE_ZMIN_PLUG) - #undef Z_MIN_PIN - #define Z_MIN_PIN -1 -#endif -#if DISABLED(USE_ZMAX_PLUG) - #undef Z_MAX_PIN - #define Z_MAX_PIN -1 -#endif -#if DISABLED(USE_IMIN_PLUG) - #undef I_MIN_PIN - #define I_MIN_PIN -1 -#endif -#if DISABLED(USE_IMAX_PLUG) - #undef I_MAX_PIN - #define I_MAX_PIN -1 -#endif -#if DISABLED(USE_JMIN_PLUG) - #undef J_MIN_PIN - #define J_MIN_PIN -1 -#endif -#if DISABLED(USE_JMAX_PLUG) - #undef J_MAX_PIN - #define J_MAX_PIN -1 -#endif -#if DISABLED(USE_KMIN_PLUG) - #undef K_MIN_PIN - #define K_MIN_PIN -1 -#endif -#if DISABLED(USE_KMAX_PLUG) - #undef K_MAX_PIN - #define K_MAX_PIN -1 -#endif - -#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MAX - #undef X2_MIN_PIN -#endif -#if DISABLED(X_DUAL_ENDSTOPS) || X_HOME_TO_MIN - #undef X2_MAX_PIN -#endif -#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MAX - #undef Y2_MIN_PIN -#endif -#if DISABLED(Y_DUAL_ENDSTOPS) || Y_HOME_TO_MIN - #undef Y2_MAX_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MAX - #undef Z2_MIN_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || Z_HOME_TO_MIN - #undef Z2_MAX_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MAX - #undef Z3_MIN_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 3 || Z_HOME_TO_MIN - #undef Z3_MAX_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MAX - #undef Z4_MIN_PIN -#endif -#if DISABLED(Z_MULTI_ENDSTOPS) || NUM_Z_STEPPER_DRIVERS < 4 || Z_HOME_TO_MIN - #undef Z4_MAX_PIN -#endif - // // Default DOGLCD SPI delays // diff --git a/buildroot/tests/DUE b/buildroot/tests/DUE index 37678501e4312..2e149b05dbab4 100755 --- a/buildroot/tests/DUE +++ b/buildroot/tests/DUE @@ -36,7 +36,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options # restore_configs opt_set MOTHERBOARD BOARD_RADDS NUM_Z_STEPPER_DRIVERS 3 -opt_enable USE_XMAX_PLUG USE_YMAX_PLUG ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR \ +opt_enable ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR \ Z_STEPPER_AUTO_ALIGN Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS Z_SAFE_HOMING pins_set ramps/RAMPS X_MAX_PIN -1 pins_set ramps/RAMPS Y_MAX_PIN -1 diff --git a/buildroot/tests/FYSETC_F6 b/buildroot/tests/FYSETC_F6 index 9306686af5cef..660564cf6bf91 100755 --- a/buildroot/tests/FYSETC_F6 +++ b/buildroot/tests/FYSETC_F6 @@ -39,7 +39,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER \ MARLIN_BRICKOUT MARLIN_INVADERS MARLIN_SNAKE \ MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD \ - USE_ZMIN_PLUG SENSORLESS_HOMING TMC_DEBUG M114_DETAIL + SENSORLESS_HOMING TMC_DEBUG M114_DETAIL exec_test $1 $2 "RAMPS | Mixed TMC | Sensorless | RRDFGSC | Games" "$3" # @@ -58,7 +58,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \ X_MAX_ENDSTOP_INVERTING false \ X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2130 Z_DRIVER_TYPE TMC2130_STANDALONE E0_DRIVER_TYPE TMC2660 \ X_HARDWARE_SERIAL Serial2 -opt_enable USE_ZMIN_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \ +opt_enable FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \ FYSETC_242_OLED_12864 EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL Z_SAFE_HOMING \ STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING SQUARE_WAVE_STEPPING exec_test $1 $2 "FYSETC_F6 | SCARA | Mixed TMC | EEPROM" "$3" diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index 3fe99734ca6b0..6b5d45af7d082 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -29,7 +29,7 @@ exec_test $1 $2 "Smoothieboard with TFTGLCD_PANEL_SPI and many features" "$3" #restore_configs #opt_set MOTHERBOARD BOARD_AZTEEG_X5_MINI_WIFI -#opt_enable COREYX USE_XMAX_PLUG DAC_MOTOR_CURRENT_DEFAULT \ +#opt_enable COREYX DAC_MOTOR_CURRENT_DEFAULT \ # REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT BABYSTEPPING \ # AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS \ # FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR FAN_SOFT_PWM \ diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index a7f25953acd03..2fddff6fd6cee 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -40,7 +40,7 @@ restore_configs opt_set MOTHERBOARD BOARD_ZRIB_V52 \ LCD_LANGUAGE pt REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 \ EXTRUDERS 2 TEMP_SENSOR_1 1 -opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE REPRAPWORLD_KEYPAD +opt_enable DUAL_X_CARRIAGE REPRAPWORLD_KEYPAD exec_test $1 $2 "ZRIB_V52 | DUAL_X_CARRIAGE" "$3" # diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index a54c04eeb21c5..d409a9850af3d 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -17,7 +17,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \ GRID_MAX_POINTS_X 16 \ FANMUX0_PIN 53 opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN USE_WATCHDOG -opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ +opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ FIX_MOUNTED_PROBE CODEPENDENT_XY_HOMING PIDTEMPBED PTC_PROBE PTC_BED \ PREHEAT_BEFORE_PROBING PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ @@ -52,8 +52,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' \ LEVEL_CORNERS_LEVELING_ORDER '{ LF, RF }' -opt_enable USE_XMAX_PLUG USE_YMAX_PLUG USE_ZMAX_PLUG \ - REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER REVERSE_ENCODER_DIRECTION SDSUPPORT EEPROM_SETTINGS \ +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER REVERSE_ENCODER_DIRECTION SDSUPPORT EEPROM_SETTINGS \ S_CURVE_ACCELERATION X_DUAL_STEPPER_DRIVERS X_DUAL_ENDSTOPS Y_DUAL_STEPPER_DRIVERS Y_DUAL_ENDSTOPS \ ADAPTIVE_STEP_SMOOTHING CNC_COORDINATE_SYSTEMS GCODE_MOTION_MODES \ LEVEL_BED_CORNERS LEVEL_CENTER_TOO @@ -114,7 +113,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \ CONTROLLER_FAN_PIN X_MAX_PIN FILWIDTH_PIN 5 \ FAN_MIN_PWM 50 FAN_KICKSTART_TIME 100 \ XY_FREQUENCY_LIMIT 15 -opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \ +opt_enable COREYX MIXING_EXTRUDER GRADIENT_MIX \ BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \ ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \ diff --git a/buildroot/tests/teensy31 b/buildroot/tests/teensy31 index 10dde2be99ad8..b17f9961e0c56 100755 --- a/buildroot/tests/teensy31 +++ b/buildroot/tests/teensy31 @@ -15,7 +15,6 @@ exec_test $1 $2 "Teensy3.1 with default config" "$3" # restore_configs opt_set MOTHERBOARD BOARD_TEENSY31_32 -opt_disable USE_XMIN_PLUG USE_YMIN_PLUG USE_ZMIN_PLUG exec_test $1 $2 "Teensy3.1 with Zero Endstops" "$3" # diff --git a/buildroot/tests/teensy35 b/buildroot/tests/teensy35 index 09e8cee58ef3e..e24b87d1b5766 100755 --- a/buildroot/tests/teensy35 +++ b/buildroot/tests/teensy35 @@ -86,7 +86,7 @@ opt_set MOTHERBOARD BOARD_TEENSY35_36 \ X_DRIVER_TYPE TMC5160 Y_DRIVER_TYPE TMC5160 \ X_MIN_ENDSTOP_INVERTING true Y_MIN_ENDSTOP_INVERTING true \ X_CS_PIN 46 Y_CS_PIN 47 -opt_enable COREXY USE_ZMIN_PLUG MONITOR_DRIVER_STATUS SENSORLESS_HOMING +opt_enable COREXY MONITOR_DRIVER_STATUS SENSORLESS_HOMING exec_test $1 $2 "Teensy 3.5/3.6 COREXY" "$3" # @@ -102,7 +102,7 @@ exec_test $1 $2 "Teensy 3.5/3.6 COREXZ | BACKLASH" "$3" # restore_configs opt_set MOTHERBOARD BOARD_TEENSY35_36 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2 -opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG +opt_enable Z_MULTI_ENDSTOPS pins_set ramps/RAMPS X_MAX_PIN -1 exec_test $1 $2 "Dual Z with Dual Z endstops" "$3" diff --git a/buildroot/tests/teensy41 b/buildroot/tests/teensy41 index 1affd7c89e125..f5d201ce4d894 100755 --- a/buildroot/tests/teensy41 +++ b/buildroot/tests/teensy41 @@ -90,7 +90,7 @@ opt_set MOTHERBOARD BOARD_TEENSY41 \ X_DRIVER_TYPE TMC5160 Y_DRIVER_TYPE TMC5160 \ X_MIN_ENDSTOP_INVERTING true Y_MIN_ENDSTOP_INVERTING true \ X_CS_PIN 46 Y_CS_PIN 47 -opt_enable COREXY USE_ZMIN_PLUG MONITOR_DRIVER_STATUS SENSORLESS_HOMING +opt_enable COREXY MONITOR_DRIVER_STATUS SENSORLESS_HOMING exec_test $1 $2 "Teensy 4.0/4.1 COREXY" "$3" # @@ -106,7 +106,7 @@ exec_test $1 $2 "Teensy 4.0/4.1 COREXZ" "$3" # restore_configs opt_set MOTHERBOARD BOARD_TEENSY41 NUM_Z_STEPPER_DRIVERS 2 Z2_MIN_PIN 2 -opt_enable Z_MULTI_ENDSTOPS USE_XMAX_PLUG +opt_enable Z_MULTI_ENDSTOPS pins_set ramps/RAMPS X_MAX_PIN -1 exec_test $1 $2 "Dual Z with Dual Z endstops" "$3"