Making an ESP32-based quadcopter from scratch
Python arduinoautopilotcontrol-theorydroneesp32flight-controlflight-controllermavlinkquadcopterquadcopter-firmwareuav
Simplify lpf filter code Begin with zero instead of the initializing value, as the latter doesn't make much sense in practice, but complicates the code much.
Oleg Kalachev9fd35ba3611e
diff --git a/flix/lpf.h b/flix/lpf.hindex 88cf8ab..9eae80d 100644--- a/flix/lpf.h+++ b/flix/lpf.h@@ -14,15 +14,6 @@ public:LowPassFilter(float alpha): alpha(alpha) {};T update(const T input) {- if (alpha == 1) { // filter disabled- return input;- }-- if (!initialized) {- output = input;- initialized = true;- }-return output += alpha * (input - output);}@@ -31,9 +22,6 @@ public:}void reset() {- initialized = false;+ output = T(); // set to zero}--private:- bool initialized = false;};