Skip to content

Commit 538009f

Browse files
authored
Save 1 divide
1 parent c4dba11 commit 538009f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/flight/dyn_notch_filter.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,8 @@ static FAST_CODE_NOINLINE void dynNotchProcess(void)
349349

350350
// Estimate true peak position
351351
const float denom = y0 + y1 + y2;
352-
if (denom != 0.0f) {
353-
float upper_ratio = y2 / denom;
354-
float lower_ratio = y0 / denom;
355-
meanBin += upper_ratio - lower_ratio;
352+
if (denom != 0.0f) {
353+
meanBin += (y2 - y0) / denom;
356354
}
357355

358356
// Convert bin to frequency: freq = bin * binResoultion (bin 0 is 0Hz)

0 commit comments

Comments
 (0)