From d51ec02cdf6dd75e611dba98762448abe7ccdd96 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 2 Jan 2013 12:22:25 +0100 Subject: [PATCH] dda_queue: optimize enqueue(). Suggestion by ItsDrone, see http://forums.reprap.org/read.php?146,174364,174364#msg-174364 --- dda_queue.c | 4 ---- dda_queue.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dda_queue.c b/dda_queue.c index 15498c3..a0098dc 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -91,10 +91,6 @@ void queue_step() { /// add a move to the movebuffer /// \note this function waits for space to be available if necessary, check queue_full() first if waiting is a problem /// This is the only function that modifies mb_head and it always called from outside an interrupt. -void enqueue(TARGET *t) { - enqueue_home(t, 0, 0); -} - void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) { // don't call this function when the queue is full, but just in case, wait for a move to complete and free up the space for the passed target while (queue_full()) diff --git a/dda_queue.h b/dda_queue.h index 15fb71b..ebaa414 100644 --- a/dda_queue.h +++ b/dda_queue.h @@ -28,9 +28,13 @@ void queue_step(void); // add a new target to the queue // t == NULL means add a wait for target temp to the queue -void enqueue(TARGET *t); void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond); +static void enqueue(TARGET *) __attribute__ ((always_inline)); +inline void enqueue(TARGET *t) { + enqueue_home(t, 0, 0); +} + // called from step timer when current move is complete void next_move(void) __attribute__ ((hot));