[2.0.x] fix home endstop bug (DON'T MERGE, needs discussion) (#11900)

This commit is contained in:
Giuliano Zaro 2018-09-24 22:56:01 +02:00 committed by Scott Lahteine
parent 6742026568
commit 18e456d38d
2 changed files with 15 additions and 7 deletions

View File

@ -246,10 +246,10 @@ void Endstops::poll() {
run_monitor(); // report changes in endstop status
#endif
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && ENABLED(ENDSTOP_NOISE_FILTER)
if (endstop_poll_count) update();
#elif DISABLED(ENDSTOP_INTERRUPTS_FEATURE) || ENABLED(ENDSTOP_NOISE_FILTER)
#if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
update();
#elif ENABLED(ENDSTOP_NOISE_FILTER)
if (endstop_poll_count) update();
#endif
}
@ -275,7 +275,16 @@ void Endstops::not_homing() {
enabled = enabled_globally;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update();
// Still 'enabled'? Then endstops are always on and kept in sync.
// Otherwise reset 'live's variables to let axes move in both directions.
if (!enabled) {
#if ENABLED(ENDSTOP_NOISE_FILTER)
endstop_poll_count = validated_live_state = 0; // Stop filtering
#endif
live_state = 0;
}
//#else
// When in polling endstops are always kept in sync
#endif
}
@ -666,7 +675,7 @@ void Endstops::update() {
if (triple_hit) { \
_ENDSTOP_HIT(AXIS1, MINMAX); \
/* if not performing home or if both endstops were trigged during homing... */ \
if (!stepper.separate_multi_axis || triple_hit == 0x7) \
if (!stepper.separate_multi_axis || triple_hit == 0b111) \
planner.endstop_triggered(_AXIS(AXIS1)); \
} \
}while(0)

View File

@ -54,8 +54,6 @@ class Endstops {
public:
static bool enabled, enabled_globally;
#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
typedef uint16_t esbits_t;
#if ENABLED(X_DUAL_ENDSTOPS)
@ -75,6 +73,7 @@ class Endstops {
#endif
private:
static bool enabled, enabled_globally;
static esbits_t live_state;
static volatile uint8_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index