diff --git a/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.cpp b/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.cpp index fb4845d19a..58e1264a33 100644 --- a/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.cpp +++ b/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.cpp @@ -43,6 +43,7 @@ namespace math void LowPassFilter2pVector3f::set_cutoff_frequency(float sample_freq, float cutoff_freq) { _cutoff_freq = cutoff_freq; + _sample_freq = sample_freq; // reset delay elements on filter change _delay_element_1.zero(); diff --git a/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.hpp b/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.hpp index 643cff73aa..ec8b0aa218 100644 --- a/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.hpp +++ b/src/lib/mathlib/math/filter/LowPassFilter2pVector3f.hpp @@ -74,12 +74,16 @@ public: // Return the cutoff frequency float get_cutoff_freq() const { return _cutoff_freq; } + // Return the sample frequency + float get_sample_freq() const { return _sample_freq; } + // Reset the filter state to this value matrix::Vector3f reset(const matrix::Vector3f &sample); private: float _cutoff_freq{0.0f}; + float _sample_freq{0.0f}; float _a1{0.0f}; float _a2{0.0f};