|
@@ -447,10 +447,13 @@ void Stepper::isr() {
|
447
|
447
|
}
|
448
|
448
|
|
449
|
449
|
// If there is no current block, attempt to pop one from the buffer
|
|
450
|
+ bool first_step = false;
|
450
|
451
|
if (!current_block) {
|
451
|
452
|
// Anything in the buffer?
|
452
|
453
|
if ((current_block = planner.get_current_block())) {
|
453
|
454
|
trapezoid_generator_reset();
|
|
455
|
+ TCNT1 = 0; // make sure first pulse is not truncated
|
|
456
|
+ first_step = true;
|
454
|
457
|
|
455
|
458
|
// Initialize Bresenham counters to 1/2 the ceiling
|
456
|
459
|
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
|
|
@@ -705,8 +708,14 @@ void Stepper::isr() {
|
705
|
708
|
// Calculate new timer value
|
706
|
709
|
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
707
|
710
|
|
708
|
|
- MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
709
|
|
- acc_step_rate += current_block->initial_rate;
|
|
711
|
+ if (first_step) {
|
|
712
|
+ acc_step_rate = current_block->initial_rate;
|
|
713
|
+ acceleration_time = 0;
|
|
714
|
+ }
|
|
715
|
+ else {
|
|
716
|
+ MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
717
|
+ acc_step_rate += current_block->initial_rate;
|
|
718
|
+ }
|
710
|
719
|
|
711
|
720
|
// upper limit
|
712
|
721
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|