Browse Source

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

Giuliano Zaro 6 years ago
parent
commit
18e456d38d
2 changed files with 15 additions and 7 deletions
  1. 14
    5
      Marlin/src/module/endstops.cpp
  2. 1
    2
      Marlin/src/module/endstops.h

+ 14
- 5
Marlin/src/module/endstops.cpp View File

@@ -246,10 +246,10 @@ void Endstops::poll() {
246 246
     run_monitor();  // report changes in endstop status
247 247
   #endif
248 248
 
249
-  #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && ENABLED(ENDSTOP_NOISE_FILTER)
250
-    if (endstop_poll_count) update();
251
-  #elif DISABLED(ENDSTOP_INTERRUPTS_FEATURE) || ENABLED(ENDSTOP_NOISE_FILTER)
249
+  #if DISABLED(ENDSTOP_INTERRUPTS_FEATURE)
252 250
     update();
251
+  #elif ENABLED(ENDSTOP_NOISE_FILTER)
252
+    if (endstop_poll_count) update();
253 253
   #endif
254 254
 }
255 255
 
@@ -275,7 +275,16 @@ void Endstops::not_homing() {
275 275
   enabled = enabled_globally;
276 276
 
277 277
   #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
278
-    update();
278
+    // Still 'enabled'? Then endstops are always on and kept in sync.
279
+    // Otherwise reset 'live's variables to let axes move in both directions.
280
+    if (!enabled) {
281
+      #if ENABLED(ENDSTOP_NOISE_FILTER)
282
+        endstop_poll_count = validated_live_state = 0; // Stop filtering
283
+      #endif
284
+      live_state = 0;
285
+    }
286
+  //#else
287
+    // When in polling endstops are always kept in sync
279 288
   #endif
280 289
 }
281 290
 
@@ -666,7 +675,7 @@ void Endstops::update() {
666 675
     if (triple_hit) { \
667 676
       _ENDSTOP_HIT(AXIS1, MINMAX); \
668 677
       /* if not performing home or if both endstops were trigged during homing... */ \
669
-      if (!stepper.separate_multi_axis || triple_hit == 0x7) \
678
+      if (!stepper.separate_multi_axis || triple_hit == 0b111) \
670 679
         planner.endstop_triggered(_AXIS(AXIS1)); \
671 680
     } \
672 681
   }while(0)

+ 1
- 2
Marlin/src/module/endstops.h View File

@@ -54,8 +54,6 @@ class Endstops {
54 54
 
55 55
   public:
56 56
 
57
-    static bool enabled, enabled_globally;
58
-
59 57
     #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
60 58
       typedef uint16_t esbits_t;
61 59
       #if ENABLED(X_DUAL_ENDSTOPS)
@@ -75,6 +73,7 @@ class Endstops {
75 73
     #endif
76 74
 
77 75
   private:
76
+    static bool enabled, enabled_globally;
78 77
     static esbits_t live_state;
79 78
     static volatile uint8_t hit_state;      // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index
80 79
 

Loading…
Cancel
Save