mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-09-11 19:55:14 +02:00
Clean code of OBPRingbuffer
This commit is contained in:
@@ -2,22 +2,6 @@
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
||||
template <typename T>
|
||||
void RingBuffer<T>::initCommon()
|
||||
{
|
||||
NUMLIMIT_LOW = std::numeric_limits<T>::lowest();
|
||||
NUMLIMIT_HIGH = std::numeric_limits<T>::max();
|
||||
dataName = "";
|
||||
dataFmt = "";
|
||||
updFreq = -1;
|
||||
mltplr = 1;
|
||||
BUFMIN_VAL = static_cast<double>(NUMLIMIT_LOW);
|
||||
BUFMAX_VAL = static_cast<double>(NUMLIMIT_HIGH);
|
||||
lowest = BUFMIN_VAL;
|
||||
highest = BUFMAX_VAL;
|
||||
bufLocker = xSemaphoreCreateMutex();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
RingBuffer<T>::RingBuffer()
|
||||
: capacity(0)
|
||||
@@ -46,6 +30,22 @@ RingBuffer<T>::RingBuffer(size_t size)
|
||||
buffer.resize(size, NUMLIMIT_HIGH); // NUMLIMIT_HIGH indicate invalid values
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void RingBuffer<T>::initCommon()
|
||||
{
|
||||
NUMLIMIT_LOW = std::numeric_limits<T>::lowest();
|
||||
NUMLIMIT_HIGH = std::numeric_limits<T>::max();
|
||||
dataName = "";
|
||||
dataFmt = "";
|
||||
updFreq = -1;
|
||||
mltplr = 1;
|
||||
BUFMIN_VAL = static_cast<double>(NUMLIMIT_LOW);
|
||||
BUFMAX_VAL = static_cast<double>(NUMLIMIT_HIGH);
|
||||
lowest = BUFMIN_VAL;
|
||||
highest = BUFMAX_VAL;
|
||||
bufLocker = xSemaphoreCreateMutex();
|
||||
}
|
||||
|
||||
// Specify meta data of buffer content
|
||||
template <typename T>
|
||||
void RingBuffer<T>::setMetaData(String name, String format, int updateFrequency, double multiplier, double minValue, double maxValue)
|
||||
@@ -370,7 +370,6 @@ double RingBuffer<T>::getCircularMid(size_t amount) const
|
||||
}
|
||||
|
||||
return arcWidth; // Midpoint of occupied arc
|
||||
// return WindUtils::to2PI(start + arcWidth / 2.0); // Midpoint of occupied arc
|
||||
}
|
||||
|
||||
// Get the buffer capacity (maximum size)
|
||||
|
||||
Reference in New Issue
Block a user