returns the maximum value in the buffer
| 118 | |
| 119 | // returns the maximum value in the buffer |
| 120 | float RunningAverage::getMaxInBuffer() const |
| 121 | { |
| 122 | if (_count == 0) |
| 123 | { |
| 124 | return NAN; |
| 125 | } |
| 126 | |
| 127 | float _max = _array[0]; |
| 128 | for (uint16_t i = 1; i < _count; i++) |
| 129 | { |
| 130 | if (_array[i] > _max) _max = _array[i]; |
| 131 | } |
| 132 | return _max; |
| 133 | } |
| 134 | |
| 135 | |
| 136 | // returns the value of an element if exist, NAN otherwise |