|
|
@ -460,8 +460,10 @@ void Stepper::isr() { |
|
|
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define CYCLES_EATEN_BY_CODE 240 |
|
|
|
|
|
|
|
// If a minimum pulse time was specified get the CPU clock
|
|
|
|
#if MINIMUM_STEPPER_PULSE > 0 |
|
|
|
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_CODE |
|
|
|
static uint32_t pulse_start; |
|
|
|
pulse_start = TCNT0; |
|
|
|
#endif |
|
|
@ -494,9 +496,8 @@ void Stepper::isr() { |
|
|
|
#endif // !ADVANCE && !LIN_ADVANCE
|
|
|
|
|
|
|
|
// For a minimum pulse time wait before stopping pulses
|
|
|
|
#if MINIMUM_STEPPER_PULSE > 0 |
|
|
|
#define CYCLES_EATEN_BY_CODE 10 |
|
|
|
while ((uint32_t)(TCNT0 - pulse_start) < (MINIMUM_STEPPER_PULSE * (F_CPU / 1000000UL)) - CYCLES_EATEN_BY_CODE) { /* nada */ } |
|
|
|
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_CODE |
|
|
|
while ((uint32_t)(TCNT0 - pulse_start) < STEP_PULSE_CYCLES - CYCLES_EATEN_BY_CODE) { /* nada */ } |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_X_STEP |
|
|
@ -688,10 +689,12 @@ void Stepper::isr() { |
|
|
|
E## INDEX ##_STEP_WRITE(INVERT_E_STEP_PIN); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define CYCLES_EATEN_BY_E 60 |
|
|
|
|
|
|
|
// Step all E steppers that have steps
|
|
|
|
for (uint8_t i = 0; i < step_loops; i++) { |
|
|
|
|
|
|
|
#if MINIMUM_STEPPER_PULSE > 0 |
|
|
|
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_E |
|
|
|
static uint32_t pulse_start; |
|
|
|
pulse_start = TCNT0; |
|
|
|
#endif |
|
|
@ -708,9 +711,8 @@ void Stepper::isr() { |
|
|
|
#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 */ } |
|
|
|
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_E |
|
|
|
while ((uint32_t)(TCNT0 - pulse_start) < STEP_PULSE_CYCLES - CYCLES_EATEN_BY_E) { /* nada */ } |
|
|
|
#endif |
|
|
|
|
|
|
|
STOP_E_PULSE(0); |
|
|
|