From c1fde63f3e617eff12020eea2e13d4bee1b1ed94 Mon Sep 17 00:00:00 2001 From: Kevin Plaizier <46289813+Quick-Flash@users.noreply.github.com> Date: Fri, 13 May 2022 21:16:00 -0600 Subject: [PATCH] Save 1 divide --- src/main/flight/dyn_notch_filter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/flight/dyn_notch_filter.c b/src/main/flight/dyn_notch_filter.c index ddaf625587..f2cdaec130 100644 --- a/src/main/flight/dyn_notch_filter.c +++ b/src/main/flight/dyn_notch_filter.c @@ -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)