From 6e52b82e1c16346a8f8897f121d3d1c1fe632f71 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 1 Aug 2017 08:52:05 +0100 Subject: [PATCH] Check if notch cutoff is zero in filter init --- src/main/sensors/gyro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index e7b64757f..04df73ccf 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -415,7 +415,7 @@ void gyroInitFilterNotch1(gyroSensor_t *gyroSensor, uint16_t notchHz, uint16_t n notchHz = calculateNyquistAdjustedNotchHz(notchHz, notchCutoffHz); - if (notchHz) { + if (notchHz != 0 && notchCutoffHz != 0) { gyroSensor->notchFilter1ApplyFn = (filterApplyFnPtr)biquadFilterApply; const float notchQ = filterGetNotchQ(notchHz, notchCutoffHz); for (int axis = 0; axis < 3; axis++) { @@ -430,7 +430,7 @@ void gyroInitFilterNotch2(gyroSensor_t *gyroSensor, uint16_t notchHz, uint16_t n notchHz = calculateNyquistAdjustedNotchHz(notchHz, notchCutoffHz); - if (notchHz) { + if (notchHz != 0 && notchCutoffHz != 0) { gyroSensor->notchFilter2ApplyFn = (filterApplyFnPtr)biquadFilterApply; const float notchQ = filterGetNotchQ(notchHz, notchCutoffHz); for (int axis = 0; axis < 3; axis++) { -- 2.11.4.GIT