Calibration feature switchable as compiler option,

new page code example by page windrose
This commit is contained in:
Thomas Hooge 2025-08-29 19:21:29 +02:00
parent 9a04029cb4
commit 601d56ee49
14 changed files with 191 additions and 113 deletions

View File

@ -346,11 +346,14 @@ void setBuzzerPower(uint power){
buzzerpower = power; buzzerpower = power;
} }
// Delete xdr prefix from string // Delete xdr prefix from string and optional limit length
String xdrDelete(String input){ String xdrDelete(String input, uint8_t maxlen) {
if (input.substring(0, 3) == "xdr") { if (input.substring(0, 3) == "xdr") {
input = input.substring(3, input.length()); input = input.substring(3, input.length());
} }
if (maxlen > 0) {
return input.substring(0, maxlen);
}
return input; return input;
} }

View File

@ -102,7 +102,7 @@ void setBlinkingLED(bool on); // Set blinking flash LED active
void buzzer(uint frequency, uint duration); // Buzzer function void buzzer(uint frequency, uint duration); // Buzzer function
void setBuzzerPower(uint power); // Set buzzer power void setBuzzerPower(uint power); // Set buzzer power
String xdrDelete(String input); // Delete xdr prefix from string String xdrDelete(String input, uint8_t maxlen = 0); // Delete xdr prefix from string and optional limit length
void drawTextCenter(int16_t cx, int16_t cy, String text); void drawTextCenter(int16_t cx, int16_t cy, String text);
void drawTextRalign(int16_t x, int16_t y, String text); void drawTextRalign(int16_t x, int16_t y, String text);

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageFourValues : public Page class PageFourValues : public Page
{ {
@ -54,7 +57,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name String name1 = xdrDelete(bvalue1->getName()); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -64,7 +69,9 @@ public:
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
String name2 = xdrDelete(bvalue2->getName()); // Value name String name2 = xdrDelete(bvalue2->getName()); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
bool valid2 = bvalue2->valid; // Valid information bool valid2 = bvalue2->valid; // Valid information
String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -74,7 +81,9 @@ public:
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
String name3 = xdrDelete(bvalue3->getName()); // Value name String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name name3 = name3.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
#endif
double value3 = bvalue3->value; // Value as double in SI unit double value3 = bvalue3->value; // Value as double in SI unit
bool valid3 = bvalue3->valid; // Valid information bool valid3 = bvalue3->valid; // Valid information
String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -84,7 +93,9 @@ public:
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
String name4 = xdrDelete(bvalue4->getName()); // Value name String name4 = xdrDelete(bvalue4->getName()); // Value name
name4 = name4.substring(0, 6); // String length limit for value name name4 = name4.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
#endif
double value4 = bvalue4->value; // Value as double in SI unit double value4 = bvalue4->value; // Value as double in SI unit
bool valid4 = bvalue4->valid; // Valid information bool valid4 = bvalue4->valid; // Valid information
String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -54,7 +54,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name String name1 = xdrDelete(bvalue1->getName()); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -64,7 +66,9 @@ public:
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
String name2 = xdrDelete(bvalue2->getName()); // Value name String name2 = xdrDelete(bvalue2->getName()); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
bool valid2 = bvalue2->valid; // Valid information bool valid2 = bvalue2->valid; // Valid information
String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -74,7 +78,9 @@ public:
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
String name3 = xdrDelete(bvalue3->getName()); // Value name String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name name3 = name3.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
#endif
double value3 = bvalue3->value; // Value as double in SI unit double value3 = bvalue3->value; // Value as double in SI unit
bool valid3 = bvalue3->valid; // Valid information bool valid3 = bvalue3->valid; // Valid information
String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -84,7 +90,9 @@ public:
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
String name4 = xdrDelete(bvalue4->getName()); // Value name String name4 = xdrDelete(bvalue4->getName()); // Value name
name4 = name4.substring(0, 6); // String length limit for value name name4 = name4.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
#endif
double value4 = bvalue4->value; // Value as double in SI unit double value4 = bvalue4->value; // Value as double in SI unit
bool valid4 = bvalue4->valid; // Valid information bool valid4 = bvalue4->valid; // Valid information
String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageOneValue : public Page class PageOneValue : public Page
{ {
@ -49,7 +52,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name String name1 = xdrDelete(bvalue1->getName()); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageRudderPosition : public Page class PageRudderPosition : public Page
{ {
@ -49,7 +52,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
String name1 = bvalue1->getName().c_str(); // Value name String name1 = bvalue1->getName().c_str(); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
value1 = bvalue1->value; // Raw value without unit convertion value1 = bvalue1->value; // Raw value without unit convertion
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -67,8 +72,7 @@ public:
} }
} }
// Logging boat values // Log boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1); logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
// Draw page // Draw page

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
const int SixValues_x1 = 5; const int SixValues_x1 = 5;
const int SixValues_DeltaX = 200; const int SixValues_DeltaX = 200;
@ -65,7 +68,9 @@ public:
bvalue = pageData.values[i]; bvalue = pageData.values[i];
DataName[i] = xdrDelete(bvalue->getName()); DataName[i] = xdrDelete(bvalue->getName());
DataName[i] = DataName[i].substring(0, 6); // String length limit for value name DataName[i] = DataName[i].substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
#endif
DataValue[i] = bvalue->value; // Value as double in SI unit DataValue[i] = bvalue->value; // Value as double in SI unit
DataValid[i] = bvalue->valid; DataValid[i] = bvalue->valid;
DataText[i] = commonData->fmt->formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places DataText[i] = commonData->fmt->formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageThreeValues : public Page class PageThreeValues : public Page
{ {
@ -52,7 +55,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name String name1 = xdrDelete(bvalue1->getName()); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -62,7 +67,9 @@ public:
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
String name2 = xdrDelete(bvalue2->getName()); // Value name String name2 = xdrDelete(bvalue2->getName()); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
bool valid2 = bvalue2->valid; // Valid information bool valid2 = bvalue2->valid; // Valid information
String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -72,15 +79,19 @@ public:
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
String name3 = xdrDelete(bvalue3->getName()); // Value name String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name name3 = name3.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
#endif
double value3 = bvalue3->value; // Value as double in SI unit double value3 = bvalue3->value; // Value as double in SI unit
bool valid3 = bvalue3->valid; // Valid information bool valid3 = bvalue3->valid; // Valid information
String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit3 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value String unit3 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
// Logging boat values // Log boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? logger->logDebug(GwLog::LOG, "Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f",
logger->logDebug(GwLog::LOG, "Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3); name1.c_str(), value1,
name2.c_str(), value2,
name3.c_str(), value3);
// Draw page // Draw page
//*********************************************************** //***********************************************************

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageTwoValues : public Page class PageTwoValues : public Page
{ {
@ -51,7 +54,9 @@ public:
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
String name1 = xdrDelete(bvalue1->getName()); // Value name String name1 = xdrDelete(bvalue1->getName()); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -61,7 +66,9 @@ public:
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
String name2 = xdrDelete(bvalue2->getName()); // Value name String name2 = xdrDelete(bvalue2->getName()); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
bool valid2 = bvalue2->valid; // Valid information bool valid2 = bvalue2->valid; // Valid information
String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -4,7 +4,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#include "N2kMessages.h" #include "N2kMessages.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
#define front_width 120 #define front_width 120
#define front_height 162 #define front_height 162
@ -331,7 +334,9 @@ public:
} }
String name1 = bvalue1->getName().c_str(); // Value name String name1 = bvalue1->getName().c_str(); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
// bool valid1 = bvalue1->valid; // Valid information // bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -345,7 +350,9 @@ public:
} }
String name2 = bvalue2->getName().c_str(); // Value name String name2 = bvalue2->getName().c_str(); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
// bool valid2 = bvalue2->valid; // Valid information // bool valid2 = bvalue2->valid; // Valid information
if (simulation) { if (simulation) {

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageWindRose : public Page class PageWindRose : public Page
{ {
@ -42,7 +45,14 @@ public:
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
static String svalue1old = ""; // storage for hold valued
static FormattedData bvf_awa_old;
static FormattedData bvf_aws_old;
static FormattedData bvf_twd_old;
static FormattedData bvf_tws_old;
static FormattedData bvf_dbt_old;
static FormattedData bvf_stw_old;
/* static String svalue1old = "";
static String unit1old = ""; static String unit1old = "";
static String svalue2old = ""; static String svalue2old = "";
static String unit2old = ""; static String unit2old = "";
@ -53,116 +63,102 @@ public:
static String svalue5old = ""; static String svalue5old = "";
static String unit5old = ""; static String unit5old = "";
static String svalue6old = ""; static String svalue6old = "";
static String unit6old = ""; static String unit6old = ""; */
// Get boat value for AWA // Get boat value for AWA
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue) GwApi::BoatValue *bv_awa = pageData.values[0]; // First element in list
String name1 = xdrDelete(bvalue1->getName()); // Value name String name_awa = xdrDelete(bv_awa->getName(), 6); // get name without prefix and limit length
name1 = name1.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_awa, logger); // Check if boat data value is to be calibrated
double value1 = bvalue1->value; // Value as double in SI unit #endif
bool valid1 = bvalue1->valid; // Valid information FormattedData bvf_awa = commonData->fmt->formatValue(bv_awa, *commonData);
value1 = commonData->fmt->formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer if (bv_awa->valid) { // Save formatted data for hold feature
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places bvf_awa_old = bvf_awa;
String unit1 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
if(valid1 == true){
svalue1old = svalue1; // Save old value
unit1old = unit1; // Save old unit
} }
// Get boat value for AWS // Get boat value for AWS
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list GwApi::BoatValue *bv_aws = pageData.values[1]; // Second element in list
String name2 = xdrDelete(bvalue2->getName()); // Value name String name_aws = xdrDelete(bv_aws->getName(), 6); // get name without prefix and limit length
name2 = name2.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_aws, logger); // Check if boat data value is to be calibrated
double value2 = bvalue2->value; // Value as double in SI unit #endif
bool valid2 = bvalue2->valid; // Valid information FormattedData bvf_aws = commonData->fmt->formatValue(bv_aws, *commonData);
String svalue2 = commonData->fmt->formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places if (bv_aws->valid) { // Save formatted data for hold feature
String unit2 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value bvf_aws_old = bvf_aws;
if(valid2 == true){
svalue2old = svalue2; // Save old value
unit2old = unit2; // Save old unit
} }
// Get boat value for TWD // Get boat value for TWD
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list GwApi::BoatValue *bv_twd = pageData.values[2]; // Third element in list
String name3 = xdrDelete(bvalue3->getName()); // Value name String name_twd = xdrDelete(bv_twd->getName(), 6); // get name without prefix and limit length
name3 = name3.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_twd, logger); // Check if boat data value is to be calibrated
double value3 = bvalue3->value; // Value as double in SI unit #endif
bool valid3 = bvalue3->valid; // Valid information FormattedData bvf_twd = commonData->fmt->formatValue(bv_twd, *commonData);
String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places if (bv_twd->valid) { // Save formatted data for hold feature
String unit3 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value bvf_twd_old = bvf_twd;
if(valid3 == true){
svalue3old = svalue3; // Save old value
unit3old = unit3; // Save old unit
} }
// Get boat value for TWS // Get boat value for TWS
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list GwApi::BoatValue *bv_tws = pageData.values[3]; // Fourth element in list
String name4 = xdrDelete(bvalue4->getName()); // Value name String name_tws = xdrDelete(bv_tws->getName(), 6); // get name without prefix and limit length
name4 = name4.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_tws, logger); // Check if boat data value is to be calibrated
double value4 = bvalue4->value; // Value as double in SI unit #endif
bool valid4 = bvalue4->valid; // Valid information FormattedData bvf_tws = commonData->fmt->formatValue(bv_tws, *commonData);
String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places if (bv_tws->valid) { // Save formatted data for hold feature
String unit4 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value bvf_tws_old = bvf_tws;
if(valid4 == true){
svalue4old = svalue4; // Save old value
unit4old = unit4; // Save old unit
} }
// Get boat value for DBT // Get boat value for DBT
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Fifth element in list GwApi::BoatValue *bv_dbt = pageData.values[4]; // Fifth element in list
String name5 = xdrDelete(bvalue5->getName()); // Value name String name_dbt = xdrDelete(bv_dbt->getName(), 6); // get name without prefix and limit length
name5 = name5.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_dbt, logger); // Check if boat data value is to be calibrated
double value5 = bvalue5->value; // Value as double in SI unit #endif
bool valid5 = bvalue5->valid; // Valid information FormattedData bvf_dbt = commonData->fmt->formatValue(bv_dbt, *commonData);
String svalue5 = commonData->fmt->formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places if (bv_dbt->valid) { // Save formatted data for hold feature
String unit5 = commonData->fmt->formatValue(bvalue5, *commonData).unit; // Unit of value bvf_dbt_old = bvf_dbt;
if(valid5 == true){
svalue5old = svalue5; // Save old value
unit5old = unit5; // Save old unit
} }
// Get boat value for STW // Get boat value for STW
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Sixth element in list GwApi::BoatValue *bv_stw = pageData.values[5]; // Sixth element in list
String name6 = xdrDelete(bvalue6->getName()); // Value name String name_stw = xdrDelete(bv_stw->getName(), 6); // get name without prefix and limit length
name6 = name6.substring(0, 6); // String length limit for value name #ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bv_stw, logger); // Check if boat data value is to be calibrated
double value6 = bvalue6->value; // Value as double in SI unit #endif
bool valid6 = bvalue6->valid; // Valid information FormattedData bvf_stw = commonData->fmt->formatValue(bv_stw, *commonData);
String svalue6 = commonData->fmt->formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places if (bv_stw->valid) { // Save formatted data for hold feature
String unit6 = commonData->fmt->formatValue(bvalue6, *commonData).unit; // Unit of value bvf_stw_old = bvf_stw;
if(valid6 == true){
svalue6old = svalue6; // Save old value
unit6old = unit6; // Save old unit
} }
// Logging boat values // Log boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f",
logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6); name_awa.c_str(), bv_awa->value,
name_aws.c_str(), bv_aws->value,
name_twd.c_str(), bv_twd->value,
name_tws.c_str(), bv_tws->value,
name_dbt.c_str(), bv_dbt->value,
name_stw.c_str(), bv_stw->value);
// Draw page // Draw page
//*********************************************************** // *********************************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height());
epd->setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show values AWA // Show values AWA
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
epd->setCursor(10, 65); epd->setCursor(10, 65);
epd->print(svalue1); // Value epd->print(holdvalues ? bvf_awa_old.value : bvf_awa.value);
epd->setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
epd->setCursor(10, 95); epd->setCursor(10, 95);
epd->print(name1); // Name epd->print(name_awa);
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 115); epd->setCursor(10, 115);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit1old : unit1); epd->print(holdvalues ? bvf_awa_old.unit : bvf_awa.unit);
// Horizintal separator left // Horizintal separator left
epd->fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
@ -170,31 +166,32 @@ public:
// Show values AWS // Show values AWS
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
epd->setCursor(10, 270); epd->setCursor(10, 270);
epd->print(svalue2); // Value epd->print(holdvalues ? bvf_aws_old.value : bvf_aws.value);
epd->setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
epd->setCursor(10, 220); epd->setCursor(10, 220);
epd->print(name2); // Name epd->print(name_aws);
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 190); epd->setCursor(10, 190);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit2old : unit2); epd->print(holdvalues ? bvf_aws_old.unit : bvf_aws.unit);
// Show values TWD // Show value TWD
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
epd->setCursor(295, 65); epd->setCursor(295, 65);
if (valid3 == true) { // TODO WTF? Der Formatter sollte das korrekt machen
epd->print(abs(value3 * 180 / PI), 0); // Value if (bv_twd->valid) {
epd->print(abs(bv_twd->value * 180 / PI), 0); // Value
} }
else { else {
epd->print(commonData->fmt->placeholder); epd->print(commonData->fmt->placeholder);
} }
epd->setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
epd->setCursor(335, 95); epd->setCursor(335, 95);
epd->print(name3); // Name epd->print(name_twd); // Name
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 115); epd->setCursor(335, 115);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit3old : unit3); epd->print(holdvalues ? bvf_twd_old.unit : bvf_twd.unit);
// Horizintal separator right // Horizintal separator right
epd->fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
@ -202,16 +199,16 @@ public:
// Show values TWS // Show values TWS
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
epd->setCursor(295, 270); epd->setCursor(295, 270);
epd->print(svalue4); // Value epd->print(name_tws);
epd->setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
epd->setCursor(335, 220); epd->setCursor(335, 220);
epd->print(name4); // Name epd->print(holdvalues ? bvf_tws_old.value : bvf_tws.value);
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 190); epd->setCursor(335, 190);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit4old : unit4); epd->print(holdvalues ? bvf_tws_old.unit : bvf_tws.unit);
//******************************************************************************************* // *********************************************************************
// Draw wind rose // Draw wind rose
int rInstrument = 110; // Radius of grafic instrument int rInstrument = 110; // Radius of grafic instrument
@ -279,9 +276,9 @@ public:
// Draw wind pointer // Draw wind pointer
float startwidth = 8; // Start width of pointer float startwidth = 8; // Start width of pointer
if(valid2 == true || holdvalues == true || simulation == true){ if (bv_aws->valid|| holdvalues || simulation) {
float sinx=sin(value1); // Wind direction float sinx = sin(bv_awa->value); // Wind direction
float cosx=cos(value1); float cosx = cos(bv_awa->value);
// Normal pointer // Normal pointer
// Pointer as triangle with center base 2*width // Pointer as triangle with center base 2*width
float xx1 = -startwidth; float xx1 = -startwidth;
@ -307,25 +304,25 @@ public:
epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor); epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
//******************************************************************************************* // *********************************************************************
// Show values DBT // Show values DBT
epd->setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
epd->setCursor(160, 200); epd->setCursor(160, 200);
epd->print(svalue5); // Value epd->print(holdvalues ? bvf_dbt_old.value : bvf_dbt.value);
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 215); epd->setCursor(190, 215);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit5old : unit5); epd->print(holdvalues ? bvf_dbt_old.unit : bvf_dbt.unit);
// Show values STW // Show values STW
epd->setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
epd->setCursor(160, 130); epd->setCursor(160, 130);
epd->print(svalue6); // Value epd->print(holdvalues ? bvf_stw_old.value : bvf_stw.value);
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 90); epd->setCursor(190, 90);
epd->print(" "); epd->print(" ");
epd->print(holdvalues ? unit6old : unit6); epd->print(holdvalues ? bvf_stw_old.unit : bvf_stw.unit);
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -3,7 +3,10 @@
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#ifdef ENABLE_CALIBRATION
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
#endif
class PageWindRoseFlex : public Page class PageWindRoseFlex : public Page
{ {
@ -73,7 +76,9 @@ public:
} }
String name1 = bvalue1->getName().c_str(); // Value name String name1 = bvalue1->getName().c_str(); // Value name
name1 = name1.substring(0, 6); // String length limit for value name name1 = name1.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
#endif
double value1 = bvalue1->value; // Value as double in SI unit double value1 = bvalue1->value; // Value as double in SI unit
bool valid1 = bvalue1->valid; // Valid information bool valid1 = bvalue1->valid; // Valid information
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -91,7 +96,9 @@ public:
} }
String name2 = bvalue2->getName().c_str(); // Value name String name2 = bvalue2->getName().c_str(); // Value name
name2 = name2.substring(0, 6); // String length limit for value name name2 = name2.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
#endif
double value2 = bvalue2->value; // Value as double in SI unit double value2 = bvalue2->value; // Value as double in SI unit
bool valid2 = bvalue2->valid; // Valid information bool valid2 = bvalue2->valid; // Valid information
if (simulation) { if (simulation) {
@ -108,7 +115,9 @@ public:
GwApi::BoatValue *bvalue3 = pageData.values[0]; GwApi::BoatValue *bvalue3 = pageData.values[0];
String name3 = xdrDelete(bvalue3->getName()); // Value name String name3 = xdrDelete(bvalue3->getName()); // Value name
name3 = name3.substring(0, 6); // String length limit for value name name3 = name3.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
#endif
double value3 = bvalue3->value; // Value as double in SI unit double value3 = bvalue3->value; // Value as double in SI unit
bool valid3 = bvalue3->valid; // Valid information bool valid3 = bvalue3->valid; // Valid information
String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue3 = commonData->fmt->formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -122,7 +131,9 @@ public:
GwApi::BoatValue *bvalue4 = pageData.values[1]; GwApi::BoatValue *bvalue4 = pageData.values[1];
String name4 = xdrDelete(bvalue4->getName()); // Value name String name4 = xdrDelete(bvalue4->getName()); // Value name
name4 = name4.substring(0, 6); // String length limit for value name name4 = name4.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
#endif
double value4 = bvalue4->value; // Value as double in SI unit double value4 = bvalue4->value; // Value as double in SI unit
bool valid4 = bvalue4->valid; // Valid information bool valid4 = bvalue4->valid; // Valid information
String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue4 = commonData->fmt->formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -136,7 +147,9 @@ public:
GwApi::BoatValue *bvalue5 = pageData.values[2]; GwApi::BoatValue *bvalue5 = pageData.values[2];
String name5 = xdrDelete(bvalue5->getName()); // Value name String name5 = xdrDelete(bvalue5->getName()); // Value name
name5 = name5.substring(0, 6); // String length limit for value name name5 = name5.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
#endif
double value5 = bvalue5->value; // Value as double in SI unit double value5 = bvalue5->value; // Value as double in SI unit
bool valid5 = bvalue5->valid; // Valid information bool valid5 = bvalue5->valid; // Valid information
String svalue5 = commonData->fmt->formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue5 = commonData->fmt->formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
@ -150,7 +163,9 @@ public:
GwApi::BoatValue *bvalue6 = pageData.values[3]; GwApi::BoatValue *bvalue6 = pageData.values[3];
String name6 = xdrDelete(bvalue6->getName()); // Value name String name6 = xdrDelete(bvalue6->getName()); // Value name
name6 = name6.substring(0, 6); // String length limit for value name name6 = name6.substring(0, 6); // String length limit for value name
#ifdef ENABLE_CALIBRATION
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
#endif
double value6 = bvalue6->value; // Value as double in SI unit double value6 = bvalue6->value; // Value as double in SI unit
bool valid6 = bvalue6->valid; // Valid information bool valid6 = bvalue6->valid; // Valid information
String svalue6 = commonData->fmt->formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue6 = commonData->fmt->formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places

View File

@ -383,6 +383,7 @@ bool addTrueWind(GwApi* api, BoatValueList* boatValues) {
return isCalculated; return isCalculated;
} }
// Init history buffers for selected boat data // Init history buffers for selected boat data
void initHstryBuf(GwApi* api, BoatValueList* boatValues, tBoatHstryData hstryBufList) { void initHstryBuf(GwApi* api, BoatValueList* boatValues, tBoatHstryData hstryBufList) {
@ -700,11 +701,11 @@ void OBP60Task(GwApi *api){
calibrationData.readConfig(config, logger); calibrationData.readConfig(config, logger);
// Check user setting for true wind calculation // Check user setting for true wind calculation
bool calcTrueWnds = api->getConfig()->getBool(api->getConfig()->calcTrueWnds, false); //bool calcTrueWnds = api->getConfig()->getBool(api->getConfig()->calcTrueWnds, false);
bool simulation = api->getConfig()->getBool(api->getConfig()->useSimuData, false); bool simulation = api->getConfig()->getBool(api->getConfig()->useSimuData, false);
// Initialize history buffer for certain boat data // Initialize history buffer for certain boat data
initHstryBuf(api, &boatValues, hstryBufList); //initHstryBuf(api, &boatValues, hstryBufList);
// Display screenshot handler for HTTP request // Display screenshot handler for HTTP request
// http://192.168.15.1/api/user/OBP60Task/screenshot // http://192.168.15.1/api/user/OBP60Task/screenshot
@ -1017,11 +1018,11 @@ void OBP60Task(GwApi *api){
api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues); api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues);
api->getStatus(commonData.status); api->getStatus(commonData.status);
if (calcTrueWnds) { /*if (calcTrueWnds) {
addTrueWind(api, &boatValues); addTrueWind(api, &boatValues);
} }*/
// Handle history buffers for TWD, TWS for wind plot page and other usage // Handle history buffers for TWD, TWS for wind plot page and other usage
handleHstryBuf(api, &boatValues, hstryBufList, simulation); //handleHstryBuf(api, &boatValues, hstryBufList, simulation);
// Clear display // Clear display
// epd->fillRect(0, 0, epd->width(), epd->height(), commonData.bgcolor); // epd->fillRect(0, 0, epd->width(), epd->height(), commonData.bgcolor);

View File

@ -51,6 +51,8 @@ build_flags=
# -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm - medium # -D DISPLAY_GYE042A87 #alternativ E-Ink display from Genyo Optical, R10 2.2 ohm - medium
# -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm - bad (burn in effects) # -D DISPLAY_SE0420NQ04 #alternativ E-Ink display from SID Technology, R10 2.2 ohm - bad (burn in effects)
# -D DISPLAY_ZJY400300-042CAAMFGN #alternativ E-Ink display from ZZE Technology, R10 2.2 ohm - very good # -D DISPLAY_ZJY400300-042CAAMFGN #alternativ E-Ink display from ZZE Technology, R10 2.2 ohm - very good
# -D ENABLE_TRUEWIND # calculate true wind data (default off)
# -D ENABLE_CALIBRATION # boat data calibration (default off)
${env.build_flags} ${env.build_flags}
#CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default #CONFIG_ESP_TASK_WDT_TIMEOUT_S = 10 #Task Watchdog timeout period (seconds) [1...60] 5 default
upload_port = /dev/ttyACM0 #OBP60 download via USB-C direct upload_port = /dev/ttyACM0 #OBP60 download via USB-C direct
@ -94,6 +96,8 @@ build_flags=
#-D DISPLAY_ZJY400300-042CAAMFGN #alternativ E-Ink display from ZZE Technology, R10 2.2 ohm - very good #-D DISPLAY_ZJY400300-042CAAMFGN #alternativ E-Ink display from ZZE Technology, R10 2.2 ohm - very good
# -D LIPO_ACCU_1200 #Hardware extension, LiPo accu 3,7V 1200mAh # -D LIPO_ACCU_1200 #Hardware extension, LiPo accu 3,7V 1200mAh
# -D VOLTAGE_SENSOR #Hardware extension, LiPo voltage sensor with two resistors # -D VOLTAGE_SENSOR #Hardware extension, LiPo voltage sensor with two resistors
# -D ENABLE_TRUEWIND # calculate true wind data (default off)
# -D ENABLE_CALIBRATION # boat data calibration (default off)
${env.build_flags} ${env.build_flags}
upload_port = /dev/ttyUSB0 #OBP40 download via external USB/Serail converter upload_port = /dev/ttyUSB0 #OBP40 download via external USB/Serail converter
upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27 upload_protocol = esptool #firmware upload via USB OTG seriell, by first upload need to set the ESP32-S3 in the upload mode with shortcut GND to Pin27