Skip to content

Commit

Permalink
Merge pull request #124 from hyperspacex2/fix/decelerationRamp
Browse files Browse the repository at this point in the history
Fix deceleration ramp
  • Loading branch information
laurb9 authored Mar 2, 2024
2 parents a0bb844 + 766637d commit 5ebabad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/BasicStepperDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,11 @@ void BasicStepperDriver::calcStepPulse(void){
case ACCELERATING:
if (step_count < steps_to_cruise){
step_pulse = step_pulse - (2*step_pulse+rest)/(4*step_count+1);
rest = (step_count < steps_to_cruise) ? (2*step_pulse+rest) % (4*step_count+1) : 0;
rest = (2*step_pulse+rest) % (4*step_count+1);
} else {
// The series approximates target, set the final value to what it should be instead
step_pulse = cruise_step_pulse;
rest = 0;
}
break;

Expand Down

0 comments on commit 5ebabad

Please sign in to comment.