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
     run_monitor();  // report changes in endstop status
246
     run_monitor();  // report changes in endstop status
247
   #endif
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
     update();
250
     update();
251
+  #elif ENABLED(ENDSTOP_NOISE_FILTER)
252
+    if (endstop_poll_count) update();
253
   #endif
253
   #endif
254
 }
254
 }
255
 
255
 
275
   enabled = enabled_globally;
275
   enabled = enabled_globally;
276
 
276
 
277
   #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
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
   #endif
288
   #endif
280
 }
289
 }
281
 
290
 
666
     if (triple_hit) { \
675
     if (triple_hit) { \
667
       _ENDSTOP_HIT(AXIS1, MINMAX); \
676
       _ENDSTOP_HIT(AXIS1, MINMAX); \
668
       /* if not performing home or if both endstops were trigged during homing... */ \
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
         planner.endstop_triggered(_AXIS(AXIS1)); \
679
         planner.endstop_triggered(_AXIS(AXIS1)); \
671
     } \
680
     } \
672
   }while(0)
681
   }while(0)

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

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