diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 570ca9b..157f2fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,10 @@ -repos: - - repo: local - hooks: - - id: clang_restage - name: Restage formatted files - entry: clang_restage - language: system - pass_filenames: false - always_run: true +repos: + - repo: local + hooks: + - id: clang_restage + name: Restage formatted files + entry: clang_restage + language: system + pass_filenames: false + always_run: true stages: [pre-commit] \ No newline at end of file diff --git a/middleware/simple_ema.c b/middleware/simple_ema.c new file mode 100644 index 0000000..c1912a0 --- /dev/null +++ b/middleware/simple_ema.c @@ -0,0 +1,8 @@ +#include + +// Exponential Moving Average Lowpass Filter +void ema_filter(float current_value, float *previous_ema, float alpha) +{ + *previous_ema = + (alpha * current_value) + ((1 - alpha) * (*previous_ema)); +} diff --git a/simple_ema.c b/simple_ema.c deleted file mode 100644 index f6221f0..0000000 --- a/simple_ema.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -// Exponential Moving Average Lowpass Filter -void ema_filter(float current_value, float *previous_ema, float alpha) { - *previous_ema = (alpha * current_value) + ((1 - alpha) * (*previous_ema)); -} - -int main() { - float alpha = 0.1f; // smoothing strength - float ema = 0.0f; // initial value can be 0 - // Something like : ema_filter(curent_unfiltered_value, &ema, alpha) - return 0; -}