From ba9aa47260e64b8128aa6369cac8c827123b4fab Mon Sep 17 00:00:00 2001 From: Bob-the-Kuhn Date: Tue, 16 Jan 2018 11:31:27 -0600 Subject: [PATCH] Revert "[1.1.x] Fix missing deceleration steps" --- Marlin/planner.cpp | 2 +- Marlin/stepper.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index c222da669..adbf14250 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -218,7 +218,7 @@ void Planner::calculate_trapezoid_for_block(block_t* const block, const float &e // Steps required for acceleration, deceleration to/from nominal rate int32_t accelerate_steps = CEIL(estimate_acceleration_distance(initial_rate, block->nominal_rate, accel)), - decelerate_steps = CEIL(estimate_acceleration_distance(block->nominal_rate, final_rate, -accel)), + decelerate_steps = FLOOR(estimate_acceleration_distance(block->nominal_rate, final_rate, -accel)), // Steps between acceleration and deceleration, if any plateau_steps = block->step_event_count - accelerate_steps - decelerate_steps; diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 438fca62e..664022b64 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -733,11 +733,8 @@ void Stepper::isr() { #endif // LIN_ADVANCE } - else if (step_events_completed >= (uint32_t)current_block->decelerate_after && current_block->step_event_count != (uint32_t)current_block->decelerate_after) { + else if (step_events_completed > (uint32_t)current_block->decelerate_after) { uint16_t step_rate; - // If we are entering the deceleration phase for the first time, we have to see how long we have been decelerating up to now. Equals last acceleration time interval. - if (!deceleration_time) - deceleration_time = calc_timer_interval(acc_step_rate); MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate); if (step_rate < acc_step_rate) { // Still decelerating?