Solve endstops issues (#12382)

- Partially reverts #11900 and tries to solve #12336
This commit is contained in:
Giuliano Zaro 2018-11-09 21:58:04 +01:00 committed by Scott Lahteine
parent 78ccedd6a8
commit fd7fd55662
2 changed files with 17 additions and 19 deletions

View file

@ -260,33 +260,19 @@ void Endstops::poll() {
void Endstops::enable_globally(const bool onoff) { void Endstops::enable_globally(const bool onoff) {
enabled_globally = enabled = onoff; enabled_globally = enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update(); update();
#endif
} }
// Enable / disable endstop checking // Enable / disable endstop checking
void Endstops::enable(const bool onoff) { void Endstops::enable(const bool onoff) {
enabled = onoff; enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update(); update();
#endif
} }
// Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
void Endstops::not_homing() { void Endstops::not_homing() {
enabled = enabled_globally; enabled = enabled_globally;
// 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 ENDSTOP_NOISE_THRESHOLD
endstop_poll_count = 0; // Stop filtering (MUST be done first to prevent race condition)
validated_live_state = 0;
#endif
live_state = 0;
}
} }
#if ENABLED(VALIDATE_HOMING_ENDSTOPS) #if ENABLED(VALIDATE_HOMING_ENDSTOPS)
@ -302,9 +288,7 @@ void Endstops::not_homing() {
void Endstops::enable_z_probe(const bool onoff) { void Endstops::enable_z_probe(const bool onoff) {
z_probe_enabled = onoff; z_probe_enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update(); update();
#endif
} }
#endif #endif

View file

@ -1522,6 +1522,20 @@ void homeaxis(const AxisEnum axis) {
} }
#endif #endif
// Reset flags for X, Y, Z motor locking
switch (axis) {
#if ENABLED(X_DUAL_ENDSTOPS)
case X_AXIS:
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
case Y_AXIS:
#endif
#if Z_MULTI_ENDSTOPS
case Z_AXIS:
#endif
stepper.set_separate_multi_axis(false);
default: break;
}
#endif #endif
#if IS_SCARA #if IS_SCARA