Skip to content

Commit

Permalink
Fix RPM filter error check with Direct Drive motors
Browse files Browse the repository at this point in the history
Don't trigger RPMFILTER error if a motor notch is enabled
with a Direct Drive motor.
  • Loading branch information
pmattila authored and rotorflight committed Mar 28, 2024
1 parent c0e6496 commit 2bbf164
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/main/flight/rpm_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,16 @@ INIT_CODE void rpmFilterInit(void)
bankNumber++;
}
// Main Motor (M1)
else if (source == 10 && enable10) {
CHECK_SOURCE(mainMotorIndex);
bank->motor = mainMotorIndex;
bank->ratio = ratio;
bank->minHz = constrainf((config->filter_bank_rpm_limit[index] / mainGearRatio) * ratio, 10, minHzLimit);
bank->maxHz = maxHzLimit;
bank->notchQ = notchQ;
bankNumber++;
else if (source == 10) {
if (enable10) {
CHECK_SOURCE(mainMotorIndex);
bank->motor = mainMotorIndex;
bank->ratio = ratio;
bank->minHz = constrainf((config->filter_bank_rpm_limit[index] / mainGearRatio) * ratio, 10, minHzLimit);
bank->maxHz = maxHzLimit;
bank->notchQ = notchQ;
bankNumber++;
}
}
// Main Rotor harmonics
else if (source >= 11 && source <= 18) {
Expand All @@ -141,14 +143,16 @@ INIT_CODE void rpmFilterInit(void)
bankNumber++;
}
// Tail Motor (M2)
else if (source == 20 && enable20) {
CHECK_SOURCE(tailMotorIndex);
bank->motor = tailMotorIndex;
bank->ratio = ratio;
bank->minHz = constrainf((config->filter_bank_rpm_limit[index] / tailGearRatio) * ratio, 10, minHzLimit);
bank->maxHz = maxHzLimit;
bank->notchQ = notchQ;
bankNumber++;
else if (source == 20) {
if (enable20) {
CHECK_SOURCE(tailMotorIndex);
bank->motor = tailMotorIndex;
bank->ratio = ratio;
bank->minHz = constrainf((config->filter_bank_rpm_limit[index] / tailGearRatio) * ratio, 10, minHzLimit);
bank->maxHz = maxHzLimit;
bank->notchQ = notchQ;
bankNumber++;
}
}
// Tail Rotor harmonics
else if (source >= 21 && source <= 28) {
Expand Down

0 comments on commit 2bbf164

Please sign in to comment.