Skip to content

Commit 3dbd52f

Browse files
committed
+ version 0.1.11
+ undo fix clear.
1 parent 503c409 commit 3dbd52f

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

libraries/RunningMedian/RunningMedian.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: RunningMedian.cpp
33
// AUTHOR: Rob dot Tillaart at gmail dot com
4-
// VERSION: 0.1.10
4+
// VERSION: 0.1.11
55
// PURPOSE: RunningMedian library for Arduino
66
//
77
// HISTORY:
@@ -16,6 +16,7 @@
1616
// 0.1.08 - 2013-10-20 add getElement(), add getSottedElement() add predict()
1717
// 0.1.09 - 2014-11-25 float to double (support ARM)
1818
// 0.1.10 - 2015-03-07 fix clear
19+
// 0.1.11 - 2015-03-29 undo 0.1.10 fix clear
1920
//
2021
// Released to the public domain
2122
//
@@ -48,8 +49,7 @@ void RunningMedian::clear()
4849
_cnt = 0;
4950
_idx = 0;
5051
_sorted = false;
51-
52-
for (uint8_t i=0; i< _size; i++) _p[i] = 0;
52+
for (uint8_t i = 0; i< _size; i++) _p[i] = i;
5353
}
5454

5555
// adds a new value to the data-set
@@ -148,10 +148,10 @@ double RunningMedian::predict(uint8_t n)
148148
void RunningMedian::sort()
149149
{
150150
// bubble sort with flag
151-
for (uint8_t i=0; i< _cnt-1; i++)
151+
for (uint8_t i = 0; i < _cnt-1; i++)
152152
{
153153
bool flag = true;
154-
for (uint8_t j=1; j< _cnt-i; j++)
154+
for (uint8_t j = 1; j < _cnt-i; j++)
155155
{
156156
if (_ar[_p[j-1]] > _ar[_p[j]])
157157
{
@@ -163,7 +163,6 @@ void RunningMedian::sort()
163163
}
164164
if (flag) break;
165165
}
166-
167166
_sorted = true;
168167
}
169168

libraries/RunningMedian/RunningMedian.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: RunningMedian.h
33
// AUTHOR: Rob dot Tillaart at gmail dot com
44
// PURPOSE: RunningMedian library for Arduino
5-
// VERSION: 0.1.10
5+
// VERSION: 0.1.11
66
// URL: http://arduino.cc/playground/Main/RunningMedian
77
// HISTORY: See RunningMedian.cpp
88
//
@@ -20,7 +20,7 @@
2020

2121
#include <inttypes.h>
2222

23-
#define RUNNING_MEDIAN_VERSION "0.1.10"
23+
#define RUNNING_MEDIAN_VERSION "0.1.11"
2424

2525
// prepare for dynamic version
2626
// not tested use at own risk :)

0 commit comments

Comments
 (0)