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

@@ -1449,23 +1449,8 @@ void Planner::quick_stop() {
}
void Planner::endstop_triggered(const AxisEnum axis) {
/*NB: This will be called via endstops.update()
and endstops.update() can be called from the temperature
ISR. So Stepper interrupts are enabled */
// Disable stepper ISR
bool stepper_isr_enabled = STEPPER_ISR_ENABLED();
DISABLE_STEPPER_DRIVER_INTERRUPT();
// Record stepper position
// Record stepper position and discard the current block
stepper.endstop_triggered(axis);
// Discard the active block that led to the trigger
discard_current_block();
// Reenable stepper ISR if it was enabled
if (stepper_isr_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
}
float Planner::triggered_position_mm(const AxisEnum axis) {