Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Make low pass filter formula more straightforward

Oleg Kalachev5165355abceb
diff --git a/flix/lpf.h b/flix/lpf.h
index 56c231e..88cf8ab 100644
--- a/flix/lpf.h
+++ b/flix/lpf.h
@@ -22,7 +22,8 @@ public:
output = input;
initialized = true;
}
- return output = output * (1 - alpha) + input * alpha;
+
+ return output += alpha * (input - output);
}
void setCutOffFrequency(float cutOffFreq, float dt) {