mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 03:50:02 +03:00
Fix Bug causing Dynamic Idle to fail if RPM filtering is turned off (#12270)
Init erpmToHz even if RPM filtering is disabled Fix for no RPM values sent to Dynamic Idle when RPM filtering was turned off
This commit is contained in:
parent
74be33dfbc
commit
395e8e8983
1 changed files with 2 additions and 2 deletions
|
@ -94,6 +94,8 @@ void rpmFilterInit(const rpmFilterConfig_t *config, const timeUs_t looptimeUs)
|
|||
pt1FilterInit(&motorFreqLpf[i], pt1FilterGain(config->rpm_filter_lpf_hz, looptimeUs * 1e-6f));
|
||||
}
|
||||
|
||||
erpmToHz = ERPM_PER_LSB / SECONDS_PER_MINUTE / (motorConfig()->motorPoleCount / 2.0f);
|
||||
|
||||
// if RPM Filtering is configured to be off
|
||||
if (!config->rpm_filter_harmonics) {
|
||||
return;
|
||||
|
@ -115,8 +117,6 @@ void rpmFilterInit(const rpmFilterConfig_t *config, const timeUs_t looptimeUs)
|
|||
}
|
||||
}
|
||||
|
||||
erpmToHz = ERPM_PER_LSB / SECONDS_PER_MINUTE / (motorConfig()->motorPoleCount / 2.0f);
|
||||
|
||||
const float loopIterationsPerUpdate = RPM_FILTER_DURATION_S / (looptimeUs * 1e-6f);
|
||||
const float numNotchesPerAxis = getMotorCount() * rpmFilter.numHarmonics;
|
||||
notchUpdatesPerIteration = ceilf(numNotchesPerAxis / loopIterationsPerUpdate); // round to ceiling
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue