Prevent overflow of the AE RPM taper. Fixes #843

This commit is contained in:
Josh Stewart 2022-05-25 11:03:33 +10:00
parent 3bd945f546
commit e16108d806
1 changed files with 2 additions and 2 deletions

View File

@ -431,7 +431,7 @@ uint16_t correctionAccel()
else
{
int16_t taperRange = trueTaperMax - trueTaperMin;
int16_t taperPercent = ((currentStatus.RPM - trueTaperMin) * 100) / taperRange; //The percentage of the way through the RPM taper range
int16_t taperPercent = ((currentStatus.RPM - trueTaperMin) * 100UL) / taperRange; //The percentage of the way through the RPM taper range
accelValue = percentage((100-taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount.
}
}
@ -490,7 +490,7 @@ uint16_t correctionAccel()
else
{
int16_t taperRange = trueTaperMax - trueTaperMin;
int16_t taperPercent = ((currentStatus.RPM - trueTaperMin) * 100) / taperRange; //The percentage of the way through the RPM taper range
int16_t taperPercent = ((currentStatus.RPM - trueTaperMin) * 100UL) / taperRange; //The percentage of the way through the RPM taper range
accelValue = percentage( (100 - taperPercent), accelValue); //Calculate the above percentage of the calculated accel amount.
}
}