Skip to content

Commit

Permalink
Update RunningMedian.h
Browse files Browse the repository at this point in the history
  • Loading branch information
happybono committed Feb 6, 2022
1 parent 3be5a55 commit 4ecbf0c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions FinedustMonitor/RunningMedian.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// FILE: RunningMedian.h
// AUTHOR: Rob Tillaart
// PURPOSE: RunningMedian library for Arduino
// VERSION: 0.3.3
// VERSION: 0.3.4
// URL: https://github.com/RobTillaart/RunningMedian
// URL: http://arduino.cc/playground/Main/RunningMedian
// HISTORY: See RunningMedian.cpp
Expand All @@ -12,7 +12,7 @@

#include "Arduino.h"

#define RUNNING_MEDIAN_VERSION (F("0.3.3"))
#define RUNNING_MEDIAN_VERSION (F("0.3.4"))


// fall back to fixed storage for dynamic version => remove true
Expand All @@ -24,7 +24,7 @@


#ifdef RUNNING_MEDIAN_USE_MALLOC
// max 250 to not overflow uint8_t internal vars
// max 250 to not overflow uint8_t internal variables
#define MEDIAN_MAX_SIZE 255
#else
// using fixed memory will be limited to 19 elements.
Expand All @@ -41,15 +41,15 @@ class RunningMedian
explicit RunningMedian(const uint8_t size);
~RunningMedian();

// resets internal buffer and var
// resets internal buffer and variables
void clear();
// adds a new value to internal buffer, optionally replacing the oldest element.
void add(const float value);
// returns the median == middle element
float getMedian();

// returns the Quantile
float getQuantile(const float q);
float getQuantile(const float quantile);

// returns average of the values in the internal buffer
float getAverage();
Expand All @@ -59,9 +59,9 @@ class RunningMedian
float getHighest() { return getSortedElement(_count - 1); };
float getLowest() { return getSortedElement(0); };

// get n'th element from the values in time order
// get n-th element from the values in time order
float getElement(const uint8_t n);
// get n'th element from the values in size order
// get n-th element from the values in size order
float getSortedElement(const uint8_t n);
// predict the max change of median after n additions
float predict(const uint8_t n);
Expand Down Expand Up @@ -91,4 +91,5 @@ class RunningMedian
void sort();
};

// END OF FILE

// -- END OF FILE --

0 comments on commit 4ecbf0c

Please sign in to comment.