Skip to content

Commit

Permalink
Make sure we don't accelerate above the nominal_rate
Browse files Browse the repository at this point in the history
  • Loading branch information
jvangrin committed Jul 5, 2011
1 parent 926d74f commit d9a7fc4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stepper.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ inline void trapezoid_generator_tick() {
if (current_block) {
if (step_events_completed < current_block->accelerate_until) {
trapezoid_adjusted_rate += current_block->rate_delta;
if (trapezoid_adjusted_rate > current_block->nominal_rate ) {
trapezoid_adjusted_rate = current_block->nominal_rate;
}
set_step_events_per_minute(trapezoid_adjusted_rate);
} else if (step_events_completed > current_block->decelerate_after) {
// NOTE: We will only reduce speed if the result will be > 0. This catches small
Expand Down

0 comments on commit d9a7fc4

Please sign in to comment.