From 56d355f8de3ad4e2f1d6c0de1b766044553eb286 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Dec 2017 01:54:17 -0600 Subject: [PATCH] Revert "[Bugfix-1.1.x] initial step correction (#8735)" This reverts commit ec028bf747ff7fe99c4fac29f0df62491db2528c. --- Marlin/stepper.cpp | 13 ++----------- Marlin/stepper.h | 3 +++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 1c1ba3ba89..ed9333716e 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -447,13 +447,10 @@ void Stepper::isr() { } // If there is no current block, attempt to pop one from the buffer - bool first_step = false; if (!current_block) { // Anything in the buffer? if ((current_block = planner.get_current_block())) { trapezoid_generator_reset(); - TCNT1 = 0; // make sure first pulse is not truncated - first_step = true; // Initialize Bresenham counters to 1/2 the ceiling counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1); @@ -708,14 +705,8 @@ void Stepper::isr() { // Calculate new timer value if (step_events_completed <= (uint32_t)current_block->accelerate_until) { - if (first_step) { - acc_step_rate = current_block->initial_rate; - acceleration_time = 0; - } - else { - MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate); - acc_step_rate += current_block->initial_rate; - } + MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate); + acc_step_rate += current_block->initial_rate; // upper limit NOMORE(acc_step_rate, current_block->nominal_rate); diff --git a/Marlin/stepper.h b/Marlin/stepper.h index 63aa4e6d26..0115125e52 100644 --- a/Marlin/stepper.h +++ b/Marlin/stepper.h @@ -359,6 +359,9 @@ class Stepper { OCR1A_nominal = calc_timer_interval(current_block->nominal_rate); // make a note of the number of step loops required at nominal speed step_loops_nominal = step_loops; + acc_step_rate = current_block->initial_rate; + acceleration_time = calc_timer_interval(acc_step_rate); + _NEXT_ISR(acceleration_time); #if ENABLED(LIN_ADVANCE) if (current_block->use_advance_lead) {