From 1c5d87327e9d0b2acb563a92ff5bee37f7f2b368 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 Nov 2023 10:25:10 +1100 Subject: [PATCH] Filter: fixed test suite fill in a parameters structure --- libraries/Filter/HarmonicNotchFilter.h | 9 +++++++++ libraries/Filter/tests/test_notchfilter.cpp | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/Filter/HarmonicNotchFilter.h b/libraries/Filter/HarmonicNotchFilter.h index 5f1f107ef646a..4a18f405e06bf 100644 --- a/libraries/Filter/HarmonicNotchFilter.h +++ b/libraries/Filter/HarmonicNotchFilter.h @@ -119,17 +119,26 @@ class HarmonicNotchFilterParams : public NotchFilterParams { // set the fundamental center frequency of the harmonic notch void set_center_freq_hz(float center_freq) { _center_freq_hz.set(center_freq); } + // set the bandwidth of the harmonic notch void set_bandwidth_hz(float bandwidth_hz) { _bandwidth_hz.set(bandwidth_hz); } + + // set the attenuation of the harmonic notch + void set_attenuation(float attenuation_dB) { _attenuation_dB.set(attenuation_dB); } + // harmonics enabled on the harmonic notch uint32_t harmonics(void) const { return _harmonics; } + // set the harmonics value void set_harmonics(uint32_t hmncs) { _harmonics.set(hmncs); } + // has the user set the harmonics value void set_default_harmonics(uint32_t hmncs) { _harmonics.set_default(hmncs); } + // reference value of the harmonic notch float reference(void) const { return _reference; } void set_reference(float ref) { _reference.set(ref); } + // notch options bool hasOption(Options option) const { return _options & uint16_t(option); } // notch dynamic tracking mode diff --git a/libraries/Filter/tests/test_notchfilter.cpp b/libraries/Filter/tests/test_notchfilter.cpp index 65390a9b841d6..011ae897f48d5 100644 --- a/libraries/Filter/tests/test_notchfilter.cpp +++ b/libraries/Filter/tests/test_notchfilter.cpp @@ -106,7 +106,13 @@ TEST(NotchFilterTest, HarmonicNotchTest) for (uint8_t c=0; c