From c7f22f688fa45298d8c24f9d480e2d8738b64591 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 29 Oct 2016 17:08:42 -0500 Subject: [PATCH] buffer_line can calculate while it's waiting --- Marlin/planner.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 89b2dcf67..dd7bfd4e1 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -594,12 +594,6 @@ void Planner::check_axes_activity() { * extruder - target extruder */ void Planner::_buffer_line(const float &a, const float &b, const float &c, const float &e, float fr_mm_s, const uint8_t extruder) { - // Calculate the buffer head after we push this byte - int next_buffer_head = next_block_index(block_buffer_head); - - // If the buffer is full: good! That means we are well ahead of the robot. - // Rest here until there is room in the buffer. - while (block_buffer_tail == next_buffer_head) idle(); // The target position of the tool in absolute steps // Calculate target position in absolute steps @@ -662,6 +656,13 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const } #endif + // Calculate the buffer head after we push this byte + int next_buffer_head = next_block_index(block_buffer_head); + + // If the buffer is full: good! That means we are well ahead of the robot. + // Rest here until there is room in the buffer. + while (block_buffer_tail == next_buffer_head) idle(); + // Prepare to set up new block block_t* block = &block_buffer[block_buffer_head];