From bdb67b4397f648c012a87a0e741c69a19082c6e1 Mon Sep 17 00:00:00 2001 From: espr14 Date: Thu, 18 Feb 2021 06:22:29 +0100 Subject: [PATCH] Fix cleaning_buffer_counter check (#21115) --- Marlin/src/module/planner.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 541aed943..7fcf37e04 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1690,13 +1690,15 @@ bool Planner::_buffer_steps(const xyze_long_t &target , feedRate_t fr_mm_s, const uint8_t extruder, const float &millimeters ) { - // If we are cleaning, do not accept queuing of movements - if (cleaning_buffer_counter) return false; - // Wait for the next available block uint8_t next_buffer_head; block_t * const block = get_next_free_block(next_buffer_head); + // If we are cleaning, do not accept queuing of movements + // This must be after get_next_free_block() because it calls idle() + // where cleaning_buffer_counter can be changed + if (cleaning_buffer_counter) return false; + // Fill the block with the specified movement if (!_populate_block(block, false, target #if HAS_POSITION_FLOAT