Fix interrupt-based endstop detection

This commit is contained in:
Scott Lahteine 2018-05-20 10:59:58 -05:00
parent d2f8971045
commit 3a4a229721
9 changed files with 332 additions and 283 deletions

View file

@ -32,6 +32,7 @@
#include "language.h"
#include "printcounter.h"
#include "delay.h"
#include "endstops.h"
#if ENABLED(HEATER_0_USES_MAX6675)
#include "MarlinSPI.h"
@ -41,10 +42,6 @@
#include "stepper.h"
#endif
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#include "endstops.h"
#endif
#if ENABLED(USE_WATCHDOG)
#include "watchdog.h"
#endif
@ -2301,20 +2298,8 @@ void Temperature::isr() {
}
#endif // BABYSTEPPING
#if ENABLED(PINS_DEBUGGING)
endstops.run_monitor(); // report changes in endstop status
#endif
// Update endstops state, if enabled
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
extern volatile uint8_t e_hit;
if (e_hit && ENDSTOPS_ENABLED) {
endstops.update();
e_hit--;
}
#else
if (ENDSTOPS_ENABLED) endstops.update();
#endif
// Poll endstops state, if required
endstops.poll();
// Periodically call the planner timer
planner.tick();