From 19d65392d852257fde2071ec2e96800035c2065f Mon Sep 17 00:00:00 2001 From: Martin Renold Date: Fri, 28 Dec 2018 11:24:00 +0100 Subject: [PATCH] fix race-condition locking up the firmware after instant-stop When all block buffers are in use, some waiting loops store (block_buffer_head+1) before the loop starts, under the assumption that no other code can add a block to the buffer. Which is kind of correct. But if an instant-stop did happen during such a loop it got stuck there forever. --- firmware/src/planner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firmware/src/planner.c b/firmware/src/planner.c index ed7db7f..5c173bc 100644 --- a/firmware/src/planner.c +++ b/firmware/src/planner.c @@ -249,8 +249,7 @@ inline void planner_discard_current_block() { } inline void planner_reset_block_buffer() { - block_buffer_head = 0; - block_buffer_tail = 0; + block_buffer_tail = block_buffer_head; }