Skip to content

Commit

Permalink
Allow multiple endstops along with new feature, simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith committed Dec 9, 2020
1 parent d8fa698 commit 61a1fb7
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 61a1fb7

Please sign in to comment.