From 61a1fb7478c827554f3dacadd6d971826f40703e Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 8 Dec 2020 19:40:21 -0800 Subject: [PATCH] Allow multiple endstops along with new feature, simplify code --- Marlin/src/module/endstops.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 9366fe6e67..23a1e5a8bd 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -590,7 +590,7 @@ void Endstops::update() { #endif #endif - #if HAS_Z_MIN && !Z_SPI_SENSORLESS && DISABLED(PROBE_ACTIVE_INPUT) + #if HAS_Z_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 @@ -615,19 +615,12 @@ void Endstops::update() { #endif #endif - // When closing the gap check the enabled probe - #if HAS_CUSTOM_PROBE_PIN && DISABLED(PROBE_ACTIVE_INPUT) - UPDATE_ENDSTOP_BIT(Z, MIN_PROBE); - #endif - #if ENABLED(PROBE_ACTIVE_INPUT) - #if HAS_CUSTOM_PROBE_PIN - UPDATE_ENDSTOP_BIT(Z, MIN); - SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN_PROBE) && (READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE)))); - #else - SET_BIT_TO(live_state, _ENDSTOP(Z, MIN), ((READ(_ENDSTOP_PIN(Z, MIN)) != _ENDSTOP_INVERTING(Z, MIN) && (READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE)))); - #endif + if (READ(PROBE_ACTIVE_INPUT_PIN) == PROBE_ACTIVE_INPUT_STATE) #endif + { + UPDATE_ENDSTOP_BIT(Z, TERN(HAS_CUSTOM_PROBE_PIN, MIN_PROBE, MIN)); + } #if HAS_Z_MAX && !Z_SPI_SENSORLESS // Check both Z dual endstops