File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ static long acceleration_time, deceleration_time;
62
62
static unsigned short acc_step_rate; // needed for deccelaration start point
63
63
static char step_loops;
64
64
static unsigned short OCR1A_nominal;
65
+ static unsigned short step_loops_nominal;
65
66
66
67
volatile long endstops_trigsteps[3 ]={0 ,0 ,0 };
67
68
volatile long endstops_stepsTotal,endstops_stepsDone;
@@ -288,6 +289,8 @@ FORCE_INLINE void trapezoid_generator_reset() {
288
289
deceleration_time = 0 ;
289
290
// step_rate to timer interval
290
291
OCR1A_nominal = calc_timer (current_block->nominal_rate );
292
+ // make a note of the number of step loops required at nominal speed
293
+ step_loops_nominal = step_loops;
291
294
acc_step_rate = current_block->initial_rate ;
292
295
acceleration_time = calc_timer (acc_step_rate);
293
296
OCR1A = acceleration_time;
@@ -665,6 +668,8 @@ ISR(TIMER1_COMPA_vect)
665
668
}
666
669
else {
667
670
OCR1A = OCR1A_nominal;
671
+ // ensure we're running at the correct step rate, even if we just came off an acceleration
672
+ step_loops = step_loops_nominal;
668
673
}
669
674
670
675
// If current block is finished, reset pointer
You can’t perform that action at this time.
0 commit comments