diff --git a/dda_queue.c b/dda_queue.c index ae184f5..2f80a47 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -41,9 +41,9 @@ DDA BSS movebuffer[MOVEBUFFER_SIZE]; uint8_t queue_full() { MEMORY_BARRIER(); if (mb_tail > mb_head) { - return ((mb_tail - mb_head - 1) == 0) ? 255 : 0; + return (mb_tail - mb_head - 1 == 0); } else { - return ((mb_tail + MOVEBUFFER_SIZE - mb_head - 1) == 0) ? 255 : 0; + return (mb_tail + MOVEBUFFER_SIZE - mb_head - 1 == 0); } } @@ -52,7 +52,7 @@ uint8_t queue_empty() { uint8_t result; ATOMIC_START - result = ((mb_tail == mb_head) && (movebuffer[mb_tail].live == 0))?255:0; + result = (mb_tail == mb_head && movebuffer[mb_tail].live == 0); ATOMIC_END return result; @@ -154,7 +154,7 @@ void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) { /// be interrupted such that it can be re-entered from within an interrupt. /// The timer interrupt MUST be disabled on entry. This is ensured because /// the timer was disabled at the start of the ISR or else because the current -/// move buffer was dead in the non-interrupt case (which indicates that the +/// move buffer was dead in the non-interrupt case (which indicates that the /// timer interrupt is disabled). void next_move() { while ((queue_empty() == 0) && (movebuffer[mb_tail].live == 0)) { @@ -164,7 +164,7 @@ void next_move() { DDA* current_movebuffer = &movebuffer[t]; // Tail must be set before calling timer_set(), as timer_set() reenables // the timer interrupt, potentially exposing mb_tail to the timer - // interrupt routine. + // interrupt routine. mb_tail = t; if (current_movebuffer->waitfor_temp) { serial_writestr_P(PSTR("Waiting for target temp\n")); @@ -174,7 +174,7 @@ void next_move() { else { dda_start(current_movebuffer); } - } + } } /// DEBUG - print queue.