dda_queue.c: Simplify queue_flush().
No ATOMIC wrapping required and setTimer(0) actually restarts the timer, which isn't what we want here.
This commit is contained in:
parent
47a5252230
commit
36c07d3423
18
dda_queue.c
18
dda_queue.c
|
|
@ -165,21 +165,15 @@ void print_queue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dump queue for emergency stop.
|
/// dump queue for emergency stop.
|
||||||
|
/// Make sure to have all timers stopped with timer_stop() or
|
||||||
|
/// unexpected things might happen.
|
||||||
/// \todo effect on startpoint is undefined!
|
/// \todo effect on startpoint is undefined!
|
||||||
void queue_flush() {
|
void queue_flush() {
|
||||||
// Since the timer interrupt is disabled before this function
|
|
||||||
// is called it is not strictly necessary to write the variables
|
|
||||||
// inside an interrupt disabled block...
|
|
||||||
ATOMIC_START
|
|
||||||
|
|
||||||
// flush queue
|
// if the timer were running, this would require
|
||||||
mb_tail = mb_head;
|
// wrapping in ATOMIC_START ... ATOMIC_END.
|
||||||
movebuffer[mb_head].live = 0;
|
mb_tail = mb_head;
|
||||||
|
movebuffer[mb_head].live = 0;
|
||||||
// disable timer
|
|
||||||
setTimer(0);
|
|
||||||
|
|
||||||
ATOMIC_END
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// wait for queue to empty
|
/// wait for queue to empty
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue