From 755b661c2d9e3beb2ba6b7602715d43891ecff3a Mon Sep 17 00:00:00 2001 From: Taylor Talkington Date: Sun, 4 Feb 2024 10:03:08 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20USE=5FZ=5FMIN=20conditions?= =?UTF-8?q?=20(#26762)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 9 ++++++--- Marlin/src/inc/SanityCheck.h | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index a1ef4a4fe0b7..6a24268895c0 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1957,8 +1957,9 @@ * Currently this must be distinct, but we can add a mechanism to use the same pin for sensorless * or switches wired to the same pin, or for the single SPI stall state on the axis. */ -#define _USE_STOP(A,N,M,C) ((ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) || (C+0)) && PIN_EXISTS(A##N##_##M) && !A##_SPI_SENSORLESS) -#define _HAS_STATE(A,N,M) (USE_##A##N##_##M || (ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) && A##_SPI_SENSORLESS)) +#define _ANY_STOP(A,N,M) ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) +#define _USE_STOP(A,N,M,C) ((_ANY_STOP(A,N,M) || (C+0)) && PIN_EXISTS(A##N##_##M) && !A##_SPI_SENSORLESS) +#define _HAS_STATE(A,N,M) (USE_##A##N##_##M || (_ANY_STOP(A,N,M) && A##_SPI_SENSORLESS)) #if _USE_STOP(X,,MIN,) #define USE_X_MIN 1 @@ -1992,7 +1993,7 @@ #define HAS_Y_STATE 1 #endif -#if _USE_STOP(Z,,MIN,ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) +#if _USE_STOP(Z,,MIN,ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) && (DISABLED(USE_PROBE_FOR_Z_HOMING) || ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) #define USE_Z_MIN 1 #endif #if _USE_STOP(Z,,MAX,) @@ -2199,7 +2200,9 @@ #define HAS_Z_PROBE_STATE 1 #endif +#undef _ANY_STOP #undef _USE_STOP +#undef _HAS_STATE /** * Set ENDSTOPPULLUPS for active endstop switches diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 27629c5a7da0..a5ba460f7f60 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2384,8 +2384,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i #error "Y_MIN_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing." #elif Y_HOME_TO_MAX && !HAS_Y_MAX_STATE #error "Y_MAX_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing." - #elif Z_HOME_TO_MIN && !HAS_Z_MIN_STATE - #error "Z_MIN_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Z axis homing." + #elif Z_HOME_TO_MIN && NONE(HAS_Z_MIN_STATE, USE_PROBE_FOR_Z_HOMING) + #error "Z_MIN_PIN, Z_STOP_PIN, Z_SPI_SENSORLESS, or USE_PROBE_FOR_Z_HOMING is required for Z axis homing." #elif Z_HOME_TO_MAX && !HAS_Z_MAX_STATE #error "Z_MAX_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Z axis homing." #elif I_HOME_TO_MIN && !HAS_I_MIN_STATE