Protect Babystepping against other ISRs
Especialy against stepper ISR. This is even more important when a minimum pulse width is set, increasing the runtime of a babystep.
This commit is contained in:
parent
80830919dc
commit
bf57eb2447
1 changed files with 2 additions and 0 deletions
|
@ -1250,6 +1250,7 @@ void Stepper::report_positions() {
|
||||||
// MUST ONLY BE CALLED BY AN ISR,
|
// MUST ONLY BE CALLED BY AN ISR,
|
||||||
// No other ISR should ever interrupt this!
|
// No other ISR should ever interrupt this!
|
||||||
void Stepper::babystep(const AxisEnum axis, const bool direction) {
|
void Stepper::babystep(const AxisEnum axis, const bool direction) {
|
||||||
|
cli();
|
||||||
static uint8_t old_pin;
|
static uint8_t old_pin;
|
||||||
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_BABYSTEP
|
#if STEP_PULSE_CYCLES > CYCLES_EATEN_BY_BABYSTEP
|
||||||
static uint32_t pulse_start;
|
static uint32_t pulse_start;
|
||||||
|
@ -1336,6 +1337,7 @@ void Stepper::report_positions() {
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //BABYSTEPPING
|
#endif //BABYSTEPPING
|
||||||
|
|
Reference in a new issue