Poll *all* enabled endstop pins (#15525)

2.0.x
Piotr 5 years ago committed by Scott Lahteine
parent 93097af0ed
commit fe4c69b64a

@ -123,7 +123,7 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const
}
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#define TEST_PROBE_PIN (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
#else
#define TEST_PROBE_PIN (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)

@ -501,8 +501,8 @@
#define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
#if HAS_BED_PROBE
#define USES_Z_MIN_PROBE_ENDSTOP DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#define HOMING_Z_WITH_PROBE (Z_HOME_DIR < 0 && !USES_Z_MIN_PROBE_ENDSTOP)
#define HAS_CUSTOM_PROBE_PIN DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#define HOMING_Z_WITH_PROBE (Z_HOME_DIR < 0 && !HAS_CUSTOM_PROBE_PIN)
#ifndef Z_PROBE_LOW_POINT
#define Z_PROBE_LOW_POINT -5
#endif

@ -825,12 +825,12 @@
// Is an endstop plug used for the Z2 endstop or the bed probe?
#define IS_Z2_OR_PROBE(A,M) ( \
(Z_MULTI_ENDSTOPS && Z2_USE_ENDSTOP == _##A##M##_) \
|| (USES_Z_MIN_PROBE_ENDSTOP && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
|| (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
// Is an endstop plug used for the Z3 endstop or the bed probe?
#define IS_Z3_OR_PROBE(A,M) ( \
(ENABLED(Z_TRIPLE_ENDSTOPS) && Z3_USE_ENDSTOP == _##A##M##_) \
|| (USES_Z_MIN_PROBE_ENDSTOP && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
|| (HAS_CUSTOM_PROBE_PIN && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
/**
* Set ENDSTOPPULLUPS for active endstop switches
@ -1005,7 +1005,7 @@
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z3_MIN (PIN_EXISTS(Z3_MIN))
#define HAS_Z3_MAX (PIN_EXISTS(Z3_MAX))
#define HAS_Z_MIN_PROBE_PIN (USES_Z_MIN_PROBE_ENDSTOP && PIN_EXISTS(Z_MIN_PROBE))
#define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
#define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION))
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)

@ -243,7 +243,7 @@ void Endstops::init() {
#endif
#endif
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
SET_INPUT_PULLUP(Z_MIN_PROBE_PIN);
#elif ENABLED(ENDSTOPPULLDOWN_ZMIN_PROBE)
@ -366,7 +366,7 @@ void Endstops::event_handler() {
ENDSTOP_HIT_TEST_Y();
ENDSTOP_HIT_TEST_Z();
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#define P_AXIS Z_AXIS
if (TEST(hit_state, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P');
#endif
@ -443,7 +443,7 @@ void _O2 Endstops::M119() {
#if HAS_Z3_MAX
ES_REPORT(Z3_MAX);
#endif
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(MSG_Z_PROBE));
#endif
#if HAS_FILAMENT_SENSOR
@ -538,60 +538,52 @@ void Endstops::update() {
* Check and update endstops
*/
#if HAS_X_MIN && !X_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(X, MIN);
#if ENABLED(X_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(X, MIN);
#if HAS_X2_MIN
UPDATE_ENDSTOP_BIT(X2, MIN);
#else
COPY_LIVE_STATE(X_MIN, X2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(X, MIN);
#endif
#endif
#if HAS_X_MAX && !X_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(X, MAX);
#if ENABLED(X_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(X, MAX);
#if HAS_X2_MAX
UPDATE_ENDSTOP_BIT(X2, MAX);
#else
COPY_LIVE_STATE(X_MAX, X2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(X, MAX);
#endif
#endif
#if HAS_Y_MIN && !Y_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(Y, MIN);
#if ENABLED(Y_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(Y, MIN);
#if HAS_Y2_MIN
UPDATE_ENDSTOP_BIT(Y2, MIN);
#else
COPY_LIVE_STATE(Y_MIN, Y2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(Y, MIN);
#endif
#endif
#if HAS_Y_MAX && !Y_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(Y, MAX);
#if ENABLED(Y_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(Y, MAX);
#if HAS_Y2_MAX
UPDATE_ENDSTOP_BIT(Y2, MAX);
#else
COPY_LIVE_STATE(Y_MAX, Y2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(Y, MAX);
#endif
#endif
#if HAS_Z_MIN && !Z_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(Z, MIN);
#if Z_MULTI_ENDSTOPS
UPDATE_ENDSTOP_BIT(Z, MIN);
#if HAS_Z2_MIN
UPDATE_ENDSTOP_BIT(Z2, MIN);
#else
@ -604,15 +596,11 @@ void Endstops::update() {
COPY_LIVE_STATE(Z_MIN, Z3_MIN);
#endif
#endif
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
UPDATE_ENDSTOP_BIT(Z, MIN);
#elif Z_HOME_DIR < 0
UPDATE_ENDSTOP_BIT(Z, MIN);
#endif
#endif
// When closing the gap check the enabled probe
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
#endif
@ -632,7 +620,7 @@ void Endstops::update() {
COPY_LIVE_STATE(Z_MAX, Z3_MAX);
#endif
#endif
#elif !USES_Z_MIN_PROBE_ENDSTOP || Z_MAX_PIN != Z_MIN_PROBE_PIN
#elif !HAS_CUSTOM_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
// If this pin isn't the bed probe it's the Z endstop
UPDATE_ENDSTOP_BIT(Z, MAX);
#endif
@ -765,7 +753,7 @@ void Endstops::update() {
#else
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN);
#elif USES_Z_MIN_PROBE_ENDSTOP
#elif HAS_CUSTOM_PROBE_PIN
if (!z_probe_enabled) PROCESS_ENDSTOP(Z, MIN);
#else
PROCESS_ENDSTOP(Z, MIN);
@ -774,7 +762,7 @@ void Endstops::update() {
#endif
// When closing the gap check the enabled probe
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE);
#endif
}
@ -784,7 +772,7 @@ void Endstops::update() {
PROCESS_TRIPLE_ENDSTOP(Z, Z2, Z3, MAX);
#elif ENABLED(Z_DUAL_ENDSTOPS)
PROCESS_DUAL_ENDSTOP(Z, Z2, MAX);
#elif !USES_Z_MIN_PROBE_ENDSTOP || Z_MAX_PIN != Z_MIN_PROBE_PIN
#elif !HAS_CUSTOM_PROBE_PIN || Z_MAX_PIN != Z_MIN_PROBE_PIN
// If this pin is not hijacked for the bed probe
// then it belongs to the Z endstop
PROCESS_ENDSTOP(Z, MAX);

@ -387,7 +387,7 @@ bool set_probe_deployed(const bool deploy) {
const xy_pos_t old_xy = current_position;
#if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#define PROBE_STOWED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
#else
#define PROBE_STOWED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)

@ -904,7 +904,7 @@
//
// Disable unused endstop / probe pins
//
#if !USES_Z_MIN_PROBE_ENDSTOP
#if !HAS_CUSTOM_PROBE_PIN
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
#endif

@ -118,7 +118,7 @@
//#define E3_MS2_PIN ?
//#define E3_MS3_PIN ?
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#define Z_MIN_PROBE_PIN 49
#endif

@ -106,7 +106,7 @@
#define E2_CS_PIN 61
#endif
#if USES_Z_MIN_PROBE_ENDSTOP
#if HAS_CUSTOM_PROBE_PIN
#define Z_MIN_PROBE_PIN 49
#endif

Loading…
Cancel
Save