make RunningMedian configurable

The defines are not accessible when the library is used as a reference like with PlatformIO hence the `#defines` cannot be overwritten.
This commit is contained in:
Samuel Lang 2018-08-23 22:00:20 +02:00
parent f683f58969
commit 92432a601f

View File

@ -2,7 +2,7 @@
// FILE: RunningMedian.h // FILE: RunningMedian.h
// AUTHOR: Rob dot Tillaart at gmail dot com // AUTHOR: Rob dot Tillaart at gmail dot com
// PURPOSE: RunningMedian library for Arduino // PURPOSE: RunningMedian library for Arduino
// VERSION: 0.1.14 // VERSION: 0.1.15
// URL: http://arduino.cc/playground/Main/RunningMedian // URL: http://arduino.cc/playground/Main/RunningMedian
// HISTORY: See RunningMedian.cpp // HISTORY: See RunningMedian.cpp
// //
@ -20,7 +20,7 @@
#include <inttypes.h> #include <inttypes.h>
#define RUNNING_MEDIAN_VERSION "0.1.14" #define RUNNING_MEDIAN_VERSION "0.1.15"
// prepare for dynamic version // prepare for dynamic version
// not tested use at own risk :) // not tested use at own risk :)
@ -28,14 +28,20 @@
// conditional compile to minimize lib // conditional compile to minimize lib
// by removeing a lot of functions. // by removeing a lot of functions.
#ifndef RUNNING_MEDIAN_ALL
#define RUNNING_MEDIAN_ALL #define RUNNING_MEDIAN_ALL
#endif
// should at least be 5 to be practical // should at least be 5 to be practical
// odd size results in a 'real' middle element. // odd size results in a 'real' middle element.
// even size takes the lower of the two middle elements // even size takes the lower of the two middle elements
#ifndef MEDIAN_MIN_SIZE
#define MEDIAN_MIN_SIZE 1 #define MEDIAN_MIN_SIZE 1
#endif
#ifndef MEDIAN_MAX_SIZE
#define MEDIAN_MAX_SIZE 19 // adjust if needed #define MEDIAN_MAX_SIZE 19 // adjust if needed
#endif
class RunningMedian class RunningMedian