From a0f430d18816a466a83fa523b7971522959e5353 Mon Sep 17 00:00:00 2001 From: Jens Geisler Date: Tue, 26 Feb 2013 08:40:43 +0100 Subject: [PATCH] bugfix: uninitiallized curr_block->new_entry_speed_sqr lead to step loss in some cases --- planner.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/planner.c b/planner.c index 8d8d04c..50a0ea3 100644 --- a/planner.c +++ b/planner.c @@ -257,7 +257,7 @@ static uint8_t planner_recalculate() // If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising. // If not, block in state of acceleration or deceleration. Reset entry speed to maximum and // check for maximum allowable speed reductions to ensure maximum possible planned speed. - if (curr_block->entry_speed_sqr != curr_block->max_entry_speed_sqr) { + if (curr_block->entry_speed_sqr >= curr_block->max_entry_speed_sqr) { // default if next_entry_speed_sqr > curr_block->max_entry_speed_sqr || max_entry_speed_sqr > curr_block->max_entry_speed_sqr curr_block->new_entry_speed_sqr = curr_block->max_entry_speed_sqr; @@ -268,6 +268,8 @@ static uint8_t planner_recalculate() curr_block->new_entry_speed_sqr = max_entry_speed_sqr; } } + } else { + curr_block->new_entry_speed_sqr = curr_block->entry_speed_sqr; } next_entry_speed_sqr= curr_block->new_entry_speed_sqr;