GY-63_MS5611/libraries/TOPMAX
2023-05-18 21:21:08 +02:00
..
.github 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
examples/TOPMAX_demo 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
test 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
.arduino-ci.yml 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
CHANGELOG.md 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
keywords.txt 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
library.json 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
library.properties 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
LICENSE 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
README.md 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
TOPMAX.cpp 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00
TOPMAX.h 0.1.0 TOPMAX 2023-05-18 21:21:08 +02:00

Arduino CI Arduino-lint JSON check License: MIT GitHub release

TOPMAX

Arduino library to track the top N maxima.

Description

This experimental library tracks the top N maxima of a series of values. It can be used e.g. to track the top 5 peak temperatures over a given period of time.

Interface

#include "TOPMAX.h"
  • TOPMAX(uint8_t size = 5) Constructor, defines the number of elements it can hold. Default number of elements is 5. If size < 3 it becomes 3.
  • uint8_t count() returns the number of elements in the internal array.
  • uint8_t size() returns the maximum number of elements in the internal array.
  • void reset() reset the internal counter to 0, clearing the system.
  • bool add(float value) add a value to the TOPMAX object to check it needs to be in the top N of maxima.
  • float get(uint8_t index) get an element of the internal array. index == count().
  • bool fill(float value) convenience function to fill the internal array with a single value e.g. 0.

Future

Must

  • keep functional in sync with TOPMIN
  • improve documentation.

Should

  • add unit tests.
  • add more examples.

Could

  • create template class
  • create derived class that holds an index or timestamp
    • uint32_t extra per element.

Wont