Add option to either store native data or averaged data (for chart smootihing) in history buffer

This commit is contained in:
Ulrich Meine
2026-07-06 22:36:18 +02:00
parent da4c66bec2
commit 71e3ba79f6
2 changed files with 42 additions and 22 deletions
+7 -2
View File
@@ -3,6 +3,7 @@
#include "OBPRingBuffer.h"
#include "Pagedata.h"
#include "obp60task.h"
#include "movingAvg.h"
#include <map>
#include <unordered_map>
@@ -36,10 +37,14 @@ public:
class HstryBuf {
private:
RingBuffer<uint16_t> hstryBuf; // Circular buffer to store history values
movingAvg<double> chrtAvg {6}; // Store average of the last 6 chart values if chart gradient shall be smoothed
movingAvgAngle<double> chrtAvgAngle {6}; // Store average of the last 6 chart values (angle data) if chart gradient shall be smoothed
String boatDataName;
double hstryMin;
double hstryMax;
bool metaDataDefined = false;
bool smoothing = false;
bool isTypeAngle = false;
unsigned long bufUpdateTime;
GwApi::BoatValue* boatValue;
GwLog* logger;
@@ -47,7 +52,7 @@ private:
friend class HstryBuffers;
public:
HstryBuf(const String& name, int size, BoatValueList* boatValues, GwLog* log);
HstryBuf(const String& name, const int size, BoatValueList* boatValues, const bool smooth, GwLog* log);
bool hasMetaData() const { return metaDataDefined; };
void init(const String& format, int updFreq, double mltplr, double minVal, double maxVal);
void add(double value);
@@ -101,7 +106,7 @@ private:
public:
HstryBuffers(int size, BoatValueList* boatValues, GwLog* log);
void addBuffer(const String& name);
void addBuffer(const String& name, const bool smooth);
void handleHstryBufs(bool useSimuData, CommonData& common);
RingBuffer<uint16_t>* getBuffer(const String& name);
};