Improve handling of invalid values in OBPringbuffer; avoid some double coding

This commit is contained in:
Ulrich Meine
2026-06-21 02:15:16 +02:00
parent c17f8238a4
commit 63af2807fb
2 changed files with 42 additions and 100 deletions
+5 -5
View File
@@ -45,9 +45,9 @@ private:
size_t last; // Points to the last (newest) valid element
size_t count; // Number of valid elements currently in buffer
bool is_Full; // Indicates that all buffer elements are used and ringing is in use
T MIN_VAL; // lowest possible value of buffer of type <T>
T MAX_VAL; // highest possible value of buffer of type <T> -> indicates invalid value in buffer
double dblMIN_VAL, dblMAX_VAL; // MIN_VAL, MAX_VAL in double format
T NUMLIMIT_LOW; // internally lowest possible value of buffer of type <T>
T NUMLIMIT_HIGH; // internally highest possible value of buffer of type <T>
double BUFMIN_VAL, BUFMAX_VAL; // lowest/highest possible buffer value considering multiplier -> externally used
mutable SemaphoreHandle_t bufLocker;
// metadata for buffer
@@ -55,8 +55,8 @@ private:
String dataFmt; // Format of boat data in buffer
int updFreq; // Update frequency in milliseconds
double mltplr; // Multiplier which transforms original <double> value into buffer type format
double smallest; // Value range of buffer: smallest value; needs to be => MIN_VAL
double largest; // Value range of buffer: biggest value; needs to be < MAX_VAL, since MAX_VAL indicates invalid entries
double lowest; // low value range for boat data in this buffer; needs to be => BUFMIN_VAL
double highest; // high value range for boat data in this buffer; needs to be < BUFMAX_VAL, since BUFMAX_VAL indicates invalid entries
void initCommon();