Skip to content

Commit

Permalink
feat(DataTomeExpAvg): ✨ allow ExpAvg to have the initial value passed…
Browse files Browse the repository at this point in the history
… as a constructor argument

#21
  • Loading branch information
AlexandreHiroyuki committed Sep 24, 2024
1 parent c0692b1 commit d90b8dd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
"typeinfo": "cpp"
},
"conventionalCommits.scopes": [
"DataTome",
"DataTomeAnalysis",
"DataTomeCumulative",
"DataTomeExpAvg",
"DataTomeMvAvg",
"test",
"readme",
"library_metadata",
"DataTome",
"DataTomeCumulative",
"DataTomeExpAvg"
"library_metadata"
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DataTome
version=1.8.0
version=1.8.1
author=Alexandre Hiroyuki Yamauchi <alex.hiroyuki@outlook.com>
maintainer=Alexandre Hiroyuki Yamauchi <alex.hiroyuki@outlook.com>
sentence=Data analysis and filtering using time series for embedded devices (IoT). All in a single C++ library, Data Tome.
Expand Down
6 changes: 5 additions & 1 deletion src/DataTomeExpAvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TypeOfSum> &push(TypeOfSum input) {
if (_count >= ULONG_MAX) {
Expand All @@ -36,4 +40,4 @@ class DataTomeExpAvg {
TypeOfSum get() { return _exp_avg; }
};

#endif // DATA_TOME_EXP_AVG_H
#endif // DATA_TOME_EXP_AVG_H

0 comments on commit d90b8dd

Please sign in to comment.