Quote:
|
Originally Posted by Joe Ross
You don't set RetVal in all branches of your function.
|
Quote:
|
Originally Posted by EHaskins
Joe Ross is right.
Code:
//Accelerate
if (change > max_step)
{
RetVal = motor_prev + max_step;
printf("Motor accelerated by MAX = %d. ", max_step);
}
else
{
printf("Motor accelerated by %d. ", change);
RetVal = motor_prev + change;
}
.....
//Decelerate
if (change < -max_step)
{
RetVal = motor_prev - max_step;
printf("Motor decelerated by MAX = %d. ", max_step);
}
else
{
printf("Motor decelerated by %d. ", change);
RetVal = motor_prev - change;
}
|
I can't believe we didn't notice that

Thanks for the help! I'll be sure to test that when I get the chance tonight.