Browse Source

Solve endstops issues (#12382)

- Partially reverts #11900 and tries to solve #12336
pull/1/head
Giuliano Zaro 6 years ago
committed by Scott Lahteine
parent
commit
fd7fd55662
  1. 22
      Marlin/src/module/endstops.cpp
  2. 14
      Marlin/src/module/motion.cpp

22
Marlin/src/module/endstops.cpp

@ -260,33 +260,19 @@ void Endstops::poll() {
void Endstops::enable_globally(const bool onoff) {
enabled_globally = enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update();
#endif
update();
}
// Enable / disable endstop checking
void Endstops::enable(const bool onoff) {
enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update();
#endif
update();
}
// Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
void Endstops::not_homing() {
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)
@ -302,9 +288,7 @@ void Endstops::not_homing() {
void Endstops::enable_z_probe(const bool onoff) {
z_probe_enabled = onoff;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
update();
#endif
update();
}
#endif

14
Marlin/src/module/motion.cpp

@ -1522,6 +1522,20 @@ void homeaxis(const AxisEnum axis) {
}
#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
#if IS_SCARA

Loading…
Cancel
Save