Skip to content

Commit

Permalink
Fix RPM filter error check with Direct Drive motors (#94)
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.

Co-authored-by: Petri Mattila <[email protected]>
  • Loading branch information
rotorflight and pmattila authored Mar 28, 2024
1 parent f29df16 commit 2a2c1d1
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 2a2c1d1

Please sign in to comment.