Skip to content

Commit 755b661

Browse files
authored
🔧 Fix USE_Z_MIN conditions (MarlinFirmware#26762)
1 parent 7f4792e commit 755b661

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Marlin/src/inc/Conditionals_post.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -1957,8 +1957,9 @@
19571957
* Currently this must be distinct, but we can add a mechanism to use the same pin for sensorless
19581958
* or switches wired to the same pin, or for the single SPI stall state on the axis.
19591959
*/
1960-
#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)
1961-
#define _HAS_STATE(A,N,M) (USE_##A##N##_##M || (ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP) && A##_SPI_SENSORLESS))
1960+
#define _ANY_STOP(A,N,M) ANY(A##_HOME_TO_##M, A##N##_SAFETY_STOP)
1961+
#define _USE_STOP(A,N,M,C) ((_ANY_STOP(A,N,M) || (C+0)) && PIN_EXISTS(A##N##_##M) && !A##_SPI_SENSORLESS)
1962+
#define _HAS_STATE(A,N,M) (USE_##A##N##_##M || (_ANY_STOP(A,N,M) && A##_SPI_SENSORLESS))
19621963

19631964
#if _USE_STOP(X,,MIN,)
19641965
#define USE_X_MIN 1
@@ -1992,7 +1993,7 @@
19921993
#define HAS_Y_STATE 1
19931994
#endif
19941995

1995-
#if _USE_STOP(Z,,MIN,ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
1996+
#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))
19961997
#define USE_Z_MIN 1
19971998
#endif
19981999
#if _USE_STOP(Z,,MAX,)
@@ -2199,7 +2200,9 @@
21992200
#define HAS_Z_PROBE_STATE 1
22002201
#endif
22012202

2203+
#undef _ANY_STOP
22022204
#undef _USE_STOP
2205+
#undef _HAS_STATE
22032206

22042207
/**
22052208
* Set ENDSTOPPULLUPS for active endstop switches

Marlin/src/inc/SanityCheck.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2384,8 +2384,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
23842384
#error "Y_MIN_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing."
23852385
#elif Y_HOME_TO_MAX && !HAS_Y_MAX_STATE
23862386
#error "Y_MAX_PIN, Y_STOP_PIN, or Y_SPI_SENSORLESS is required for Y axis homing."
2387-
#elif Z_HOME_TO_MIN && !HAS_Z_MIN_STATE
2388-
#error "Z_MIN_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Z axis homing."
2387+
#elif Z_HOME_TO_MIN && NONE(HAS_Z_MIN_STATE, USE_PROBE_FOR_Z_HOMING)
2388+
#error "Z_MIN_PIN, Z_STOP_PIN, Z_SPI_SENSORLESS, or USE_PROBE_FOR_Z_HOMING is required for Z axis homing."
23892389
#elif Z_HOME_TO_MAX && !HAS_Z_MAX_STATE
23902390
#error "Z_MAX_PIN, Z_STOP_PIN, or Z_SPI_SENSORLESS is required for Z axis homing."
23912391
#elif I_HOME_TO_MIN && !HAS_I_MIN_STATE

0 commit comments

Comments
 (0)