Set a bool when a stepper block is done
This commit is contained in:
parent
08f717e5f7
commit
d9bcc7bb45
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue