avoid float -> int64 conversion #1977

both cases have to be relatively small durations of time cherry picking...
This commit is contained in:
rusefillc 2020-12-03 13:30:17 -05:00
parent f1f64bd3e5
commit ba33a758e8
2 changed files with 4 additions and 2 deletions

View File

@ -386,7 +386,8 @@ efitick_t scheduleByAngle(scheduling_s *timer, efitick_t edgeTimestamp, angle_t
action_s action DECLARE_ENGINE_PARAMETER_SUFFIX) {
float delayUs = ENGINE(rpmCalculator.oneDegreeUs) * angle;
efitime_t delayNt = US2NT(delayUs);
// 'delayNt' is below 10 seconds here so we use 32 bit type for performance reasons
int32_t delayNt = USF2NT(delayUs);
efitime_t delayedTime = edgeTimestamp + delayNt;
ENGINE(executor.scheduleByTimestampNt(timer, delayedTime, action));

View File

@ -136,8 +136,9 @@ void PwmConfig::setFrequency(float frequency) {
}
/**
* see #handleCycleStart()
* 'periodNt' is below 10 seconds here so we use 32 bit type for performance reasons
*/
periodNt = US2NT(frequency2periodUs(frequency));
periodNt = USF2NT(frequency2periodUs(frequency));
}
void PwmConfig::stop() {