Poll all endstops, even when stationary (#11125)

Co-Authored-By: ejtagle <ejtagle@hotmail.com>
This commit is contained in:
Scott Lahteine 2018-06-27 04:19:05 -04:00 committed by GitHub
parent e352c1e52d
commit cff2201629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 100 deletions

View File

@ -1494,6 +1494,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_DIR == 1 && (DISABLED(Z_MAX_ENDSTOP_INVERTING) || DISABLED(ENDSTOPPULLUP_ZMAX))
#error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
#elif ENABLED(ENDSTOP_NOISE_FILTER)
#error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_FILTER."
#endif
#endif

View File

@ -35,12 +35,6 @@
#include "endstop_interrupts.h"
#endif
#if HAS_BED_PROBE
#define ENDSTOPS_ENABLED (enabled || z_probe_enabled)
#else
#define ENDSTOPS_ENABLED enabled
#endif
Endstops endstops;
// public:
@ -408,10 +402,8 @@ void Endstops::update() {
#endif
/**
* Check and update endstops according to conditions
* Check and update endstops
*/
if (stepper.axis_is_moving(X_AXIS)) {
if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
#if HAS_X_MIN
#if ENABLED(X_DUAL_ENDSTOPS) && X_HOME_DIR < 0
UPDATE_ENDSTOP_BIT(X, MIN);
@ -421,11 +413,10 @@ void Endstops::update() {
COPY_LIVE_STATE(X_MIN, X2_MIN);
#endif
#else
if (X_MIN_TEST) UPDATE_ENDSTOP_BIT(X, MIN);
UPDATE_ENDSTOP_BIT(X, MIN);
#endif
#endif
}
else { // +direction
#if HAS_X_MAX
#if ENABLED(X_DUAL_ENDSTOPS) && X_HOME_DIR > 0
UPDATE_ENDSTOP_BIT(X, MAX);
@ -435,14 +426,10 @@ void Endstops::update() {
COPY_LIVE_STATE(X_MAX, X2_MAX);
#endif
#else
if (X_MAX_TEST) UPDATE_ENDSTOP_BIT(X, MAX);
UPDATE_ENDSTOP_BIT(X, MAX);
#endif
#endif
}
}
if (stepper.axis_is_moving(Y_AXIS)) {
if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
#if HAS_Y_MIN && Y_HOME_DIR < 0
#if ENABLED(Y_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(Y, MIN);
@ -455,8 +442,7 @@ void Endstops::update() {
UPDATE_ENDSTOP_BIT(Y, MIN);
#endif
#endif
}
else { // +direction
#if HAS_Y_MAX && Y_HOME_DIR > 0
#if ENABLED(Y_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(Y, MAX);
@ -469,11 +455,7 @@ void Endstops::update() {
UPDATE_ENDSTOP_BIT(Y, MAX);
#endif
#endif
}
}
if (stepper.axis_is_moving(Z_AXIS)) {
if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
#if HAS_Z_MIN
#if ENABLED(Z_DUAL_ENDSTOPS) && Z_HOME_DIR < 0
UPDATE_ENDSTOP_BIT(Z, MIN);
@ -483,7 +465,7 @@ void Endstops::update() {
COPY_LIVE_STATE(Z_MIN, Z2_MIN);
#endif
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
if (z_probe_enabled) UPDATE_ENDSTOP_BIT(Z, MIN);
UPDATE_ENDSTOP_BIT(Z, MIN);
#elif Z_HOME_DIR < 0
UPDATE_ENDSTOP_BIT(Z, MIN);
#endif
@ -491,10 +473,9 @@ void Endstops::update() {
// When closing the gap check the enabled probe
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
if (z_probe_enabled) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
#endif
}
else { // Z +direction. Gantry up, bed down.
#if HAS_Z_MAX && Z_HOME_DIR > 0
// Check both Z dual endstops
#if ENABLED(Z_DUAL_ENDSTOPS)
@ -509,8 +490,6 @@ void Endstops::update() {
UPDATE_ENDSTOP_BIT(Z, MAX);
#endif
#endif
}
}
#if ENABLED(ENDSTOP_NOISE_FILTER)
/**