Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Minor code simplification

Oleg Kalachevea35db37dab3
diff --git a/flix/estimate.ino b/flix/estimate.ino
index 086fb34..cd8da9f 100644
--- a/flix/estimate.ino
+++ b/flix/estimate.ino
@@ -11,8 +11,6 @@
#define WEIGHT_ACC 0.003
#define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz
-LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA);
-
void estimate() {
applyGyro();
applyAcc();
@@ -20,6 +18,7 @@ void estimate() {
void applyGyro() {
// filter gyro to get angular rates
+ static LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA);
rates = ratesFilter.update(gyro);
// apply rates to attitude