From d90b8dddd25516f42375c87967951e8622fd124b Mon Sep 17 00:00:00 2001 From: Alexandre Hiroyuki Date: Tue, 24 Sep 2024 13:54:07 -0300 Subject: [PATCH] feat(DataTomeExpAvg): :sparkles: allow ExpAvg to have the initial value passed as a constructor argument #21 --- .vscode/settings.json | 8 ++++---- README.md | 1 + library.json | 6 +++--- library.properties | 2 +- src/DataTomeExpAvg.h | 6 +++++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7af60fd..306c50b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -53,13 +53,13 @@ "typeinfo": "cpp" }, "conventionalCommits.scopes": [ + "DataTome", "DataTomeAnalysis", + "DataTomeCumulative", + "DataTomeExpAvg", "DataTomeMvAvg", "test", "readme", - "library_metadata", - "DataTome", - "DataTomeCumulative", - "DataTomeExpAvg" + "library_metadata" ] } \ No newline at end of file diff --git a/README.md b/README.md index 12933ad..86d11ed 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Data Tome is a C++ library for data analysis and data filtering on embedded devi - Simple Moving Average (SMA). - Exponential Moving Average (EMA). +- Cumulative Average (CA). - Simple Moving Median (implemented on DataTomeAnalysis). - Variance, Standard Deviation, and more. diff --git a/library.json b/library.json index 79180b5..2c4133f 100644 --- a/library.json +++ b/library.json @@ -1,9 +1,9 @@ { "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json", "name": "DataTome", - "version": "1.8.0", - "description": "Data analysis and filtering using time series for embedded devices (IoT). All in a single C++ library, Data Tome. Focus on the developer's experience and performance.", - "keywords": "sensors, input, data, processing, analysis, arduino, library, filter, moving average, smooth, standard, deviation, mean, median, partial, tome, datatome", + "version": "1.8.1", + "description": "Data analysis and filtering using time series for embedded devices (IoT). All in a single C++ library, Data Tome. Includes Simple Moving Average, Exponential Moving Average, Simple Moving Median, Cumulative Moving Average, Standard Deviation, and more.", + "keywords": "filter, moving average, exponential moving average, median, mean, standard, deviation, arduino, library, smooth, signal, sensors, input, data, processing, analysis, partial, tome, moving-average, moving, average, exponential, cumulative", "repository": { "type": "git", "url": "https://github.com/AlexandreHiroyuki/DataTome" diff --git a/library.properties b/library.properties index 2591048..18b6321 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=DataTome -version=1.8.0 +version=1.8.1 author=Alexandre Hiroyuki Yamauchi maintainer=Alexandre Hiroyuki Yamauchi sentence=Data analysis and filtering using time series for embedded devices (IoT). All in a single C++ library, Data Tome. diff --git a/src/DataTomeExpAvg.h b/src/DataTomeExpAvg.h index 209dc6f..ca4b35d 100644 --- a/src/DataTomeExpAvg.h +++ b/src/DataTomeExpAvg.h @@ -19,6 +19,10 @@ class DataTomeExpAvg { public: DataTomeExpAvg() : _exp_avg(0), _count(0) {} + // RECOMMENDED: use a simple average of the first elements of your data set as + // initial_value + DataTomeExpAvg(TypeOfSum initial_value) + : _exp_avg(initial_value), _count(0) {} DataTomeExpAvg &push(TypeOfSum input) { if (_count >= ULONG_MAX) { @@ -36,4 +40,4 @@ class DataTomeExpAvg { TypeOfSum get() { return _exp_avg; } }; -#endif // DATA_TOME_EXP_AVG_H \ No newline at end of file +#endif // DATA_TOME_EXP_AVG_H