Skip to content

Commit

Permalink
Save 1 divide
Browse files Browse the repository at this point in the history
  • Loading branch information
Quick-Flash authored and nerdCopter committed May 24, 2022
1 parent 1ed4f89 commit c1fde63
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/flight/dyn_notch_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,8 @@ static FAST_CODE_NOINLINE void dynNotchProcess(void)

// Estimate true peak position
const float denom = y0 + y1 + y2;
if (denom != 0.0f) {
float upper_ratio = y2 / denom;
float lower_ratio = y0 / denom;
meanBin += upper_ratio - lower_ratio;
if (denom != 0.0f) {
meanBin += (y2 - y0) / denom;
}

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

0 comments on commit c1fde63

Please sign in to comment.