Apply MINIMUM_STEPPER_PULSE in stepper advance_isr

This commit is contained in:
Scott Lahteine 2016-08-30 14:22:58 -05:00
parent 8c7ee4599e
commit 426f662586

View file

@ -709,6 +709,11 @@ void Stepper::isr() {
// Step all E steppers that have steps // Step all E steppers that have steps
for (uint8_t i = 0; i < step_loops; i++) { for (uint8_t i = 0; i < step_loops; i++) {
#if MINIMUM_STEPPER_PULSE > 0
static uint32_t pulse_start;
pulse_start = TCNT0;
#endif
START_E_PULSE(0); START_E_PULSE(0);
#if E_STEPPERS > 1 #if E_STEPPERS > 1
START_E_PULSE(1); START_E_PULSE(1);
@ -720,6 +725,12 @@ void Stepper::isr() {
#endif #endif
#endif #endif
// For a minimum pulse time wait before stopping pulses
#if MINIMUM_STEPPER_PULSE > 0
#define CYCLES_EATEN_BY_E 10
while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_E) { /* nada */ }
#endif
STOP_E_PULSE(0); STOP_E_PULSE(0);
#if E_STEPPERS > 1 #if E_STEPPERS > 1
STOP_E_PULSE(1); STOP_E_PULSE(1);