From 3816ae376fe57c9a970a2fc931aca51d205787d1 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Sun, 17 May 2026 06:21:13 +0300 Subject: [PATCH] Bring back initializing the lpf with the first input value It's much better for voltage measuring and slightly better for gyro bias estimation. --- flix/lpf.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flix/lpf.h b/flix/lpf.h index 9eae80d..9ee4e0a 100644 --- a/flix/lpf.h +++ b/flix/lpf.h @@ -14,6 +14,10 @@ public: LowPassFilter(float alpha): alpha(alpha) {}; T update(const T input) { + if (!init) { + init = true; + return output = input; + } return output += alpha * (input - output); } @@ -22,6 +26,9 @@ public: } void reset() { - output = T(); // set to zero + init = false; } + +private: + bool init = false; };