MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / getMaxInBuffer

Method getMaxInBuffer

libraries/RunningAverage/RunningAverage.cpp:120–133  ·  view source on GitHub ↗

returns the maximum value in the buffer

Source from the content-addressed store, hash-verified

118
119// returns the maximum value in the buffer
120float 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

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64