diff --git a/.github/workflows/arduino-lint.yml b/.github/workflows/arduino-lint.yml index 7f8f4ef..aed264b 100644 --- a/.github/workflows/arduino-lint.yml +++ b/.github/workflows/arduino-lint.yml @@ -6,8 +6,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@v4 - - uses: arduino/arduino-lint-action@v1 + - uses: actions/checkout@v6 + - uses: arduino/arduino-lint-action@v2 with: library-manager: update compliance: strict \ No newline at end of file diff --git a/.github/workflows/arduino_test_runner.yml b/.github/workflows/arduino_test_runner.yml index dbd0ce7..a2a5f07 100644 --- a/.github/workflows/arduino_test_runner.yml +++ b/.github/workflows/arduino_test_runner.yml @@ -6,9 +6,8 @@ jobs: runTest: runs-on: ubuntu-latest timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 1cbb5e2..2c52dc7 100644 --- a/.github/workflows/jsoncheck.yml +++ b/.github/workflows/jsoncheck.yml @@ -5,13 +5,15 @@ on: paths: - '**.json' pull_request: + paths: + - '**.json' jobs: test: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: json-syntax-check uses: limitusus/json-syntax-check@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index afd70ce..9759ed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.4.9] - 2026-03-19 +- update GitHub actions +- add define AVERAGE_MIN_SIZE so at least 1 element. +- minor edits + ## [0.4.8] - 2025-08-01 - add array example - update examples diff --git a/LICENSE b/LICENSE index dce256a..5158cdd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2012-2025 Rob Tillaart +Copyright (c) 2012-2026 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3ddb47a..3d885ec 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ In version 0.2.16 a fix was added that uses the calculation of the sum in **getA update the internal **\_sum**. -#### Related +### Related - https://github.com/RobTillaart/Correlation - https://github.com/RobTillaart/GST - Golden standard test metrics @@ -40,6 +40,7 @@ update the internal **\_sum**. - https://github.com/RobTillaart/RunningAngle - https://github.com/RobTillaart/RunningAverage - https://github.com/RobTillaart/RunningMedian +- https://github.com/RobTillaart/RunningMinMax - https://github.com/RobTillaart/statHelpers - combinations & permutations - https://github.com/RobTillaart/Statistic - https://github.com/RobTillaart/Student @@ -173,11 +174,6 @@ Indicative performance on an UNO, see examples. | last functions | - | - | not tested -## Operation - -See examples - - ## Future #### Must diff --git a/RunningAverage.cpp b/RunningAverage.cpp index b7b3c1a..7bd8ebd 100644 --- a/RunningAverage.cpp +++ b/RunningAverage.cpp @@ -1,7 +1,7 @@ // // FILE: RunningAverage.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.4.8 +// VERSION: 0.4.9 // DATE: 2011-01-30 // PURPOSE: Arduino library to calculate the running average by means of a circular buffer // URL: https://github.com/RobTillaart/RunningAverage @@ -16,6 +16,7 @@ RunningAverage::RunningAverage(const uint16_t size) { _size = size; + if (_size < AVERAGE_MIN_SIZE) _size = AVERAGE_MIN_SIZE; _partial = _size; _array = (float*) malloc(_size * sizeof(float)); if (_array == NULL) _size = 0; diff --git a/RunningAverage.h b/RunningAverage.h index 1c7eb18..28db1ef 100644 --- a/RunningAverage.h +++ b/RunningAverage.h @@ -2,7 +2,7 @@ // // FILE: RunningAverage.h // AUTHOR: Rob Tillaart -// VERSION: 0.4.8 +// VERSION: 0.4.9 // DATE: 2011-01-30 // PURPOSE: Arduino library to calculate the running average by means of a circular buffer // URL: https://github.com/RobTillaart/RunningAverage @@ -14,8 +14,12 @@ #include "Arduino.h" -#define RUNNINGAVERAGE_LIB_VERSION (F("0.4.8")) +#define RUNNINGAVERAGE_LIB_VERSION (F("0.4.9")) +// AVERAGE_MIN_SIZE should at least be 1 to be practical, +#ifndef AVERAGE_MIN_SIZE +#define AVERAGE_MIN_SIZE 1 +#endif class RunningAverage { diff --git a/examples/fillValue/fillValue.ino b/examples/fillValue/fillValue.ino index ac679e6..fb900c3 100644 --- a/examples/fillValue/fillValue.ino +++ b/examples/fillValue/fillValue.ino @@ -1,7 +1,6 @@ // // FILE: fillValue.ino // AUTHOR: Rob Tillaart -// DATE: 2012-12-30 // PURPOSE: demo + timing of fillValue // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_300/ra_300.ino b/examples/ra_300/ra_300.ino index 70f077e..0d1c97c 100644 --- a/examples/ra_300/ra_300.ino +++ b/examples/ra_300/ra_300.ino @@ -1,7 +1,6 @@ // // FILE: ra_300.ino // AUTHOR: Rob Tillaart -// DATE: 2021-05-26 // PURPOSE: demonstrate large (16 bit) buffer // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_300_last/ra_300_last.ino b/examples/ra_300_last/ra_300_last.ino index a8b53c8..1bd9970 100644 --- a/examples/ra_300_last/ra_300_last.ino +++ b/examples/ra_300_last/ra_300_last.ino @@ -1,7 +1,6 @@ // // FILE: ra_300.ino // AUTHOR: Rob Tillaart -// DATE: 2021-05-26 // PURPOSE: demonstrate large (16 bit) buffer // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_FastAverageTest/ra_FastAverageTest.ino b/examples/ra_FastAverageTest/ra_FastAverageTest.ino index dfd9036..7889713 100644 --- a/examples/ra_FastAverageTest/ra_FastAverageTest.ino +++ b/examples/ra_FastAverageTest/ra_FastAverageTest.ino @@ -1,7 +1,6 @@ // // FILE: ra_FastAverageTest.ino // AUTHOR: Rob Tillaart -// DATE: 2015-sep-04 // PURPOSE: demo to see if different average algorithm give different result // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_MinMaxBufferTest/ra_MinMaxBufferTest.ino b/examples/ra_MinMaxBufferTest/ra_MinMaxBufferTest.ino index 89db4ea..093774f 100644 --- a/examples/ra_MinMaxBufferTest/ra_MinMaxBufferTest.ino +++ b/examples/ra_MinMaxBufferTest/ra_MinMaxBufferTest.ino @@ -1,7 +1,6 @@ // // FILE: ra_MinMaxBufferTest.ino // AUTHOR: Rob Tillaart -// DATE: 2015-09-04 // PURPOSE: demo // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_MinMaxTest/ra_MinMaxTest.ino b/examples/ra_MinMaxTest/ra_MinMaxTest.ino index 71831c8..f9ca0b1 100644 --- a/examples/ra_MinMaxTest/ra_MinMaxTest.ino +++ b/examples/ra_MinMaxTest/ra_MinMaxTest.ino @@ -1,7 +1,6 @@ // -// FILE: runningAverageMinMaxTest.ino +// FILE: ra_MinMaxTest.ino // AUTHOR: Rob Tillaart -// DATE: 2015-apr-10 // PURPOSE: demo // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_fillValue_test/ra_fillValue_test.ino b/examples/ra_fillValue_test/ra_fillValue_test.ino index 5f3bd76..b2fb054 100644 --- a/examples/ra_fillValue_test/ra_fillValue_test.ino +++ b/examples/ra_fillValue_test/ra_fillValue_test.ino @@ -1,7 +1,6 @@ // // FILE: ra_fillValue_test.ino // AUTHOR: Rob Tillaart -// DATE: 2012-12-30 // PURPOSE: demo + timing of fillValue // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_getAverageSubset/ra_getAverageSubset.ino b/examples/ra_getAverageSubset/ra_getAverageSubset.ino index 240eade..a879247 100644 --- a/examples/ra_getAverageSubset/ra_getAverageSubset.ino +++ b/examples/ra_getAverageSubset/ra_getAverageSubset.ino @@ -1,7 +1,6 @@ // // FILE: ra_getAverageSubset.ino // AUTHOR: Rob Tillaart -// DATE: 2012-12-30 // PURPOSE: show working of runningAverage // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_getValue/ra_getValue.ino b/examples/ra_getValue/ra_getValue.ino index 1c84bad..b399378 100644 --- a/examples/ra_getValue/ra_getValue.ino +++ b/examples/ra_getValue/ra_getValue.ino @@ -1,7 +1,6 @@ // // FILE: ra_getValue.ino // AUTHOR: Rob Tillaart -// DATE: 2020-01-15 // PURPOSE: demonstrate access in order of the values added // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_hour/ra_hour.ino b/examples/ra_hour/ra_hour.ino index bb5cac8..ac905fc 100644 --- a/examples/ra_hour/ra_hour.ino +++ b/examples/ra_hour/ra_hour.ino @@ -1,7 +1,6 @@ // // FILE: runningAverageHour.ino // AUTHOR: Rob Tillaart -// DATE: 2012-12-30 // PURPOSE: show working of runningAverage per hour // in 2 steps - last minute + last hour // 3 or more steps also possible diff --git a/examples/ra_partial/ra_partial.ino b/examples/ra_partial/ra_partial.ino index 46b5c19..c2f5f63 100644 --- a/examples/ra_partial/ra_partial.ino +++ b/examples/ra_partial/ra_partial.ino @@ -1,7 +1,6 @@ // // FILE: ra_partial.ino // AUTHOR: Rob Tillaart -// DATE: 2021-05-26 // PURPOSE: demonstrate partial use of internal buffer // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_performance/ra_performance.ino b/examples/ra_performance/ra_performance.ino index 8a4e5a6..14a0a9c 100644 --- a/examples/ra_performance/ra_performance.ino +++ b/examples/ra_performance/ra_performance.ino @@ -1,7 +1,6 @@ // // FILE: ra_performance.ino // AUTHOR: Rob Tillaart -// DATE: 2020-04-16 // PURPOSE: timing of runningAverage // URL: https://github.com/RobTillaart/RunningAverage diff --git a/examples/ra_test/ra_test.ino b/examples/ra_test/ra_test.ino index 1e74012..099feb6 100644 --- a/examples/ra_test/ra_test.ino +++ b/examples/ra_test/ra_test.ino @@ -1,7 +1,6 @@ // // FILE: ra_test.ino // AUTHOR: Rob Tillaart -// DATE: 2012-12-30 // PURPOSE: show working of runningAverage // URL: https://github.com/RobTillaart/RunningAverage diff --git a/keywords.txt b/keywords.txt index 8d71be0..a763d95 100644 --- a/keywords.txt +++ b/keywords.txt @@ -44,4 +44,6 @@ getAverageSubset KEYWORD2 # Constants (LITERAL1) -RUNNINGAVERAGE_LIB_VERSION LITERAL1 \ No newline at end of file +RUNNINGAVERAGE_LIB_VERSION LITERAL1 + +AVERAGE_MIN_SIZE LITERAL1 \ No newline at end of file diff --git a/library.json b/library.json index 74f393a..12835f5 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/RunningAverage.git" }, - "version": "0.4.8", + "version": "0.4.9", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/library.properties b/library.properties index 6f0b272..a149ab3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=RunningAverage -version=0.4.8 +version=0.4.9 author=Rob Tillaart maintainer=Rob Tillaart sentence=The library stores the last N individual values in a circular buffer to calculate the running average.