Browse Source

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

pull/1/head
Giuliano Zaro 6 years ago
committed by Scott Lahteine
parent
commit
18e456d38d
  1. 19
      Marlin/src/module/endstops.cpp
  2. 3
      Marlin/src/module/endstops.h

19
Marlin/src/module/endstops.cpp

@ -246,10 +246,10 @@ void Endstops::poll() {
run_monitor(); // report changes in endstop status run_monitor(); // report changes in endstop status
#endif #endif
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && ENABLED(ENDSTOP_NOISE_FILTER) #if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
if (endstop_poll_count) update();
#elif DISABLED(ENDSTOP_INTERRUPTS_FEATURE) || ENABLED(ENDSTOP_NOISE_FILTER)
update(); update();
#elif ENABLED(ENDSTOP_NOISE_FILTER)
if (endstop_poll_count) update();
#endif #endif
} }
@ -275,7 +275,16 @@ void Endstops::not_homing() {
enabled = enabled_globally; enabled = enabled_globally;
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #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 #endif
} }
@ -666,7 +675,7 @@ void Endstops::update() {
if (triple_hit) { \ if (triple_hit) { \
_ENDSTOP_HIT(AXIS1, MINMAX); \ _ENDSTOP_HIT(AXIS1, MINMAX); \
/* if not performing home or if both endstops were trigged during homing... */ \ /* 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)); \ planner.endstop_triggered(_AXIS(AXIS1)); \
} \ } \
}while(0) }while(0)

3
Marlin/src/module/endstops.h

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

Loading…
Cancel
Save