1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 15:26:18 +00:00

Set a bool when a stepper block is done

This commit is contained in:
Scott Lahteine 2016-08-30 14:20:48 -05:00
parent 08f717e5f7
commit d9bcc7bb45

View File

@ -372,6 +372,7 @@ void Stepper::isr() {
) endstops.update(); ) endstops.update();
// Take multiple steps per interrupt (For high speed moves) // Take multiple steps per interrupt (For high speed moves)
bool all_steps_done = false;
for (int8_t i = 0; i < step_loops; i++) { for (int8_t i = 0; i < step_loops; i++) {
#ifndef USBCON #ifndef USBCON
customizedSerial.checkRx(); // Check for serial chars. customizedSerial.checkRx(); // Check for serial chars.
@ -524,8 +525,10 @@ void Stepper::isr() {
#endif #endif
#endif // !ADVANCE && !LIN_ADVANCE #endif // !ADVANCE && !LIN_ADVANCE
step_events_completed++; if (++step_events_completed >= current_block->step_event_count) {
if (step_events_completed >= current_block->step_event_count) break; all_steps_done = true;
break;
}
} }
#if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE) #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
@ -657,7 +660,7 @@ void Stepper::isr() {
OCR1A = (OCR1A < (TCNT1 + 16)) ? (TCNT1 + 16) : OCR1A; OCR1A = (OCR1A < (TCNT1 + 16)) ? (TCNT1 + 16) : OCR1A;
// If current block is finished, reset pointer // If current block is finished, reset pointer
if (step_events_completed >= current_block->step_event_count) { if (all_steps_done) {
current_block = NULL; current_block = NULL;
planner.discard_current_block(); planner.discard_current_block();
} }