From 36c07d3423187b6cb0e9aac2b473bbccf22fe8e8 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 21 Jul 2013 23:15:12 +0200 Subject: [PATCH] dda_queue.c: Simplify queue_flush(). No ATOMIC wrapping required and setTimer(0) actually restarts the timer, which isn't what we want here. --- dda_queue.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dda_queue.c b/dda_queue.c index 335f9c3..ac7d0a8 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -165,21 +165,15 @@ void print_queue() { } /// 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! 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 - mb_tail = mb_head; - movebuffer[mb_head].live = 0; - - // disable timer - setTimer(0); - - ATOMIC_END + // if the timer were running, this would require + // wrapping in ATOMIC_START ... ATOMIC_END. + mb_tail = mb_head; + movebuffer[mb_head].live = 0; } /// wait for queue to empty