Bring back initializing the lpf with the first input value

It's much better for voltage measuring and slightly better for gyro bias estimation.
This commit is contained in:
Oleg Kalachev
2026-05-17 06:21:13 +03:00
parent 72a72fde80
commit 3816ae376f
+8 -1
View File
@@ -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;
};