Auto Formatting with clang-format-6.0 (#727)

* Add clang-format

* Auto-format AlphaFilter and RingBuffer

* Update to tab=8spaces

* Allow for 120 width
This commit is contained in:
kritz
2020-01-23 20:56:10 +11:00
committed by Paul Riseborough
parent dbf0bd43e8
commit ed916c8006
6 changed files with 206 additions and 34 deletions
+8 -16
View File
@@ -38,34 +38,26 @@
#pragma once
template<typename T>
class AlphaFilter final
{
template <typename T>
class AlphaFilter final {
public:
AlphaFilter() = default;
~AlphaFilter() = default;
void reset(const T &val) { _x = val; }
void update(const T &input, float tau, float dt)
{
const float alpha = dt / tau;
void update(const T &input, float tau, float dt) {
const float alpha = dt / tau;
update(input, alpha);
}
void update(const T &input, float alpha)
{
_x = (1.f - alpha) * _x + alpha * input;
}
void update(const T &input, float alpha) { _x = (1.f - alpha) * _x + alpha * input; }
// Typical 0.9/0.1 lowpass filter
void update(const T &input)
{
update(input, 0.1f);
}
void update(const T &input) { update(input, 0.1f); }
const T& getState() const { return _x; }
const T &getState() const { return _x; }
private:
T _x{}; ///< current state of the filter
T _x{}; ///< current state of the filter
};