Compare commits
No commits in common. "601d56ee49ee79945779987bf14660ea723db8a6" and "22e3ca387551a24d70732009046f910c069f0c55" have entirely different histories.
601d56ee49
...
22e3ca3875
|
@ -346,14 +346,11 @@ void setBuzzerPower(uint power){
|
|||
buzzerpower = power;
|
||||
}
|
||||
|
||||
// Delete xdr prefix from string and optional limit length
|
||||
String xdrDelete(String input, uint8_t maxlen) {
|
||||
// Delete xdr prefix from string
|
||||
String xdrDelete(String input){
|
||||
if(input.substring(0,3) == "xdr"){
|
||||
input = input.substring(3, input.length());
|
||||
}
|
||||
if (maxlen > 0) {
|
||||
return input.substring(0, maxlen);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void setBlinkingLED(bool on); // Set blinking flash LED active
|
|||
void buzzer(uint frequency, uint duration); // Buzzer function
|
||||
void setBuzzerPower(uint power); // Set buzzer power
|
||||
|
||||
String xdrDelete(String input, uint8_t maxlen = 0); // Delete xdr prefix from string and optional limit length
|
||||
String xdrDelete(String input); // Delete xdr prefix from string
|
||||
|
||||
void drawTextCenter(int16_t cx, int16_t cy, String text);
|
||||
void drawTextRalign(int16_t x, int16_t y, String text);
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageFourValues : public Page
|
||||
{
|
||||
|
@ -57,9 +54,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -69,9 +64,7 @@ public:
|
|||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||
String name2 = xdrDelete(bvalue2->getName()); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -81,9 +74,7 @@ public:
|
|||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||
String name3 = xdrDelete(bvalue3->getName()); // 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
|
||||
#endif
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -93,9 +84,7 @@ public:
|
|||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||
String name4 = xdrDelete(bvalue4->getName()); // 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
|
||||
#endif
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
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
|
||||
|
|
|
@ -54,9 +54,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -66,9 +64,7 @@ public:
|
|||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||
String name2 = xdrDelete(bvalue2->getName()); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -78,9 +74,7 @@ public:
|
|||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||
String name3 = xdrDelete(bvalue3->getName()); // 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
|
||||
#endif
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -90,9 +84,7 @@ public:
|
|||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||
String name4 = xdrDelete(bvalue4->getName()); // 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
|
||||
#endif
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
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
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageOneValue : public Page
|
||||
{
|
||||
|
@ -52,9 +49,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageRudderPosition : public Page
|
||||
{
|
||||
|
@ -52,9 +49,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list
|
||||
String name1 = bvalue1->getName().c_str(); // 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
|
||||
#endif
|
||||
value1 = bvalue1->value; // Raw value without unit convertion
|
||||
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
|
||||
|
@ -72,7 +67,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Log boat values
|
||||
// Logging 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);
|
||||
|
||||
// Draw page
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
const int SixValues_x1 = 5;
|
||||
const int SixValues_DeltaX = 200;
|
||||
|
@ -68,9 +65,7 @@ public:
|
|||
bvalue = pageData.values[i];
|
||||
DataName[i] = xdrDelete(bvalue->getName());
|
||||
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
|
||||
#endif
|
||||
DataValue[i] = bvalue->value; // Value as double in SI unit
|
||||
DataValid[i] = bvalue->valid;
|
||||
DataText[i] = commonData->fmt->formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageThreeValues : public Page
|
||||
{
|
||||
|
@ -55,9 +52,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -67,9 +62,7 @@ public:
|
|||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||
String name2 = xdrDelete(bvalue2->getName()); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -79,19 +72,15 @@ public:
|
|||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||
String name3 = xdrDelete(bvalue3->getName()); // 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
|
||||
#endif
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
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 unit3 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||
|
||||
// Log boat values
|
||||
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);
|
||||
// Logging 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", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageTwoValues : public Page
|
||||
{
|
||||
|
@ -54,9 +51,7 @@ public:
|
|||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -66,9 +61,7 @@ public:
|
|||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||
String name2 = xdrDelete(bvalue2->getName()); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
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
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
#include "N2kMessages.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
#define front_width 120
|
||||
#define front_height 162
|
||||
|
@ -334,9 +331,7 @@ public:
|
|||
}
|
||||
String name1 = bvalue1->getName().c_str(); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
// 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
|
||||
|
@ -350,9 +345,7 @@ public:
|
|||
}
|
||||
String name2 = bvalue2->getName().c_str(); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
// bool valid2 = bvalue2->valid; // Valid information
|
||||
if (simulation) {
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageWindRose : public Page
|
||||
{
|
||||
|
@ -45,14 +42,7 @@ public:
|
|||
|
||||
int displayPage(PageData &pageData) {
|
||||
|
||||
// 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 svalue1old = "";
|
||||
static String unit1old = "";
|
||||
static String svalue2old = "";
|
||||
static String unit2old = "";
|
||||
|
@ -63,102 +53,116 @@ public:
|
|||
static String svalue5old = "";
|
||||
static String unit5old = "";
|
||||
static String svalue6old = "";
|
||||
static String unit6old = ""; */
|
||||
static String unit6old = "";
|
||||
|
||||
// Get boat value for AWA
|
||||
GwApi::BoatValue *bv_awa = pageData.values[0]; // First element in list
|
||||
String name_awa = xdrDelete(bv_awa->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_awa, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_awa = commonData->fmt->formatValue(bv_awa, *commonData);
|
||||
if (bv_awa->valid) { // Save formatted data for hold feature
|
||||
bvf_awa_old = bvf_awa;
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
name1 = name1.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
bool valid1 = bvalue1->valid; // Valid information
|
||||
value1 = commonData->fmt->formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer
|
||||
String svalue1 = commonData->fmt->formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||
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
|
||||
GwApi::BoatValue *bv_aws = pageData.values[1]; // Second element in list
|
||||
String name_aws = xdrDelete(bv_aws->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_aws, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_aws = commonData->fmt->formatValue(bv_aws, *commonData);
|
||||
if (bv_aws->valid) { // Save formatted data for hold feature
|
||||
bvf_aws_old = bvf_aws;
|
||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||
String name2 = xdrDelete(bvalue2->getName()); // Value name
|
||||
name2 = name2.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
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 unit2 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save old value
|
||||
unit2old = unit2; // Save old unit
|
||||
}
|
||||
|
||||
// Get boat value for TWD
|
||||
GwApi::BoatValue *bv_twd = pageData.values[2]; // Third element in list
|
||||
String name_twd = xdrDelete(bv_twd->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_twd, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_twd = commonData->fmt->formatValue(bv_twd, *commonData);
|
||||
if (bv_twd->valid) { // Save formatted data for hold feature
|
||||
bvf_twd_old = bvf_twd;
|
||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||
String name3 = xdrDelete(bvalue3->getName()); // Value name
|
||||
name3 = name3.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
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 unit3 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save old value
|
||||
unit3old = unit3; // Save old unit
|
||||
}
|
||||
|
||||
// Get boat value for TWS
|
||||
GwApi::BoatValue *bv_tws = pageData.values[3]; // Fourth element in list
|
||||
String name_tws = xdrDelete(bv_tws->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_tws, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_tws = commonData->fmt->formatValue(bv_tws, *commonData);
|
||||
if (bv_tws->valid) { // Save formatted data for hold feature
|
||||
bvf_tws_old = bvf_tws;
|
||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||
String name4 = xdrDelete(bvalue4->getName()); // Value name
|
||||
name4 = name4.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
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 unit4 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||
if(valid4 == true){
|
||||
svalue4old = svalue4; // Save old value
|
||||
unit4old = unit4; // Save old unit
|
||||
}
|
||||
|
||||
// Get boat value for DBT
|
||||
GwApi::BoatValue *bv_dbt = pageData.values[4]; // Fifth element in list
|
||||
String name_dbt = xdrDelete(bv_dbt->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_dbt, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_dbt = commonData->fmt->formatValue(bv_dbt, *commonData);
|
||||
if (bv_dbt->valid) { // Save formatted data for hold feature
|
||||
bvf_dbt_old = bvf_dbt;
|
||||
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Fifth element in list
|
||||
String name5 = xdrDelete(bvalue5->getName()); // Value name
|
||||
name5 = name5.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
||||
double value5 = bvalue5->value; // Value as double in SI unit
|
||||
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 unit5 = commonData->fmt->formatValue(bvalue5, *commonData).unit; // Unit of value
|
||||
if(valid5 == true){
|
||||
svalue5old = svalue5; // Save old value
|
||||
unit5old = unit5; // Save old unit
|
||||
}
|
||||
|
||||
// Get boat value for STW
|
||||
GwApi::BoatValue *bv_stw = pageData.values[5]; // Sixth element in list
|
||||
String name_stw = xdrDelete(bv_stw->getName(), 6); // get name without prefix and limit length
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
calibrationData.calibrateInstance(bv_stw, logger); // Check if boat data value is to be calibrated
|
||||
#endif
|
||||
FormattedData bvf_stw = commonData->fmt->formatValue(bv_stw, *commonData);
|
||||
if (bv_stw->valid) { // Save formatted data for hold feature
|
||||
bvf_stw_old = bvf_stw;
|
||||
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Sixth element in list
|
||||
String name6 = xdrDelete(bvalue6->getName()); // Value name
|
||||
name6 = name6.substring(0, 6); // String length limit for value name
|
||||
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
||||
double value6 = bvalue6->value; // Value as double in SI unit
|
||||
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 unit6 = commonData->fmt->formatValue(bvalue6, *commonData).unit; // Unit of value
|
||||
if(valid6 == true){
|
||||
svalue6old = svalue6; // Save old value
|
||||
unit6old = unit6; // Save old unit
|
||||
}
|
||||
|
||||
// Log boat values
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f",
|
||||
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);
|
||||
// Logging 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", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
|
||||
|
||||
// Draw page
|
||||
// *********************************************************************
|
||||
//***********************************************************
|
||||
|
||||
// Set display in partial refresh mode
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height());
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
|
||||
epd->setTextColor(commonData->fgcolor);
|
||||
|
||||
// Show values AWA
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(10, 65);
|
||||
epd->print(holdvalues ? bvf_awa_old.value : bvf_awa.value);
|
||||
epd->print(svalue1); // Value
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(10, 95);
|
||||
epd->print(name_awa);
|
||||
epd->print(name1); // Name
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(10, 115);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_awa_old.unit : bvf_awa.unit);
|
||||
epd->print(holdvalues ? unit1old : unit1);
|
||||
|
||||
// Horizintal separator left
|
||||
epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
|
||||
|
@ -166,32 +170,31 @@ public:
|
|||
// Show values AWS
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(10, 270);
|
||||
epd->print(holdvalues ? bvf_aws_old.value : bvf_aws.value);
|
||||
epd->print(svalue2); // Value
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(10, 220);
|
||||
epd->print(name_aws);
|
||||
epd->print(name2); // Name
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(10, 190);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_aws_old.unit : bvf_aws.unit);
|
||||
epd->print(holdvalues ? unit2old : unit2);
|
||||
|
||||
// Show value TWD
|
||||
// Show values TWD
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(295, 65);
|
||||
// TODO WTF? Der Formatter sollte das korrekt machen
|
||||
if (bv_twd->valid) {
|
||||
epd->print(abs(bv_twd->value * 180 / PI), 0); // Value
|
||||
if (valid3 == true) {
|
||||
epd->print(abs(value3 * 180 / PI), 0); // Value
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 95);
|
||||
epd->print(name_twd); // Name
|
||||
epd->print(name3); // Name
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(335, 115);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_twd_old.unit : bvf_twd.unit);
|
||||
epd->print(holdvalues ? unit3old : unit3);
|
||||
|
||||
// Horizintal separator right
|
||||
epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||
|
@ -199,16 +202,16 @@ public:
|
|||
// Show values TWS
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(295, 270);
|
||||
epd->print(name_tws);
|
||||
epd->print(svalue4); // Value
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 220);
|
||||
epd->print(holdvalues ? bvf_tws_old.value : bvf_tws.value);
|
||||
epd->print(name4); // Name
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(335, 190);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_tws_old.unit : bvf_tws.unit);
|
||||
epd->print(holdvalues ? unit4old : unit4);
|
||||
|
||||
// *********************************************************************
|
||||
//*******************************************************************************************
|
||||
|
||||
// Draw wind rose
|
||||
int rInstrument = 110; // Radius of grafic instrument
|
||||
|
@ -276,9 +279,9 @@ public:
|
|||
|
||||
// Draw wind pointer
|
||||
float startwidth = 8; // Start width of pointer
|
||||
if (bv_aws->valid|| holdvalues || simulation) {
|
||||
float sinx = sin(bv_awa->value); // Wind direction
|
||||
float cosx = cos(bv_awa->value);
|
||||
if(valid2 == true || holdvalues == true || simulation == true){
|
||||
float sinx=sin(value1); // Wind direction
|
||||
float cosx=cos(value1);
|
||||
// Normal pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float xx1 = -startwidth;
|
||||
|
@ -304,25 +307,25 @@ public:
|
|||
epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
|
||||
epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
|
||||
|
||||
// *********************************************************************
|
||||
//*******************************************************************************************
|
||||
|
||||
// Show values DBT
|
||||
epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
epd->setCursor(160, 200);
|
||||
epd->print(holdvalues ? bvf_dbt_old.value : bvf_dbt.value);
|
||||
epd->print(svalue5); // Value
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(190, 215);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_dbt_old.unit : bvf_dbt.unit);
|
||||
epd->print(holdvalues ? unit5old : unit5);
|
||||
|
||||
// Show values STW
|
||||
epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
epd->setCursor(160, 130);
|
||||
epd->print(holdvalues ? bvf_stw_old.value : bvf_stw.value);
|
||||
epd->print(svalue6); // Value
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(190, 90);
|
||||
epd->print(" ");
|
||||
epd->print(holdvalues ? bvf_stw_old.unit : bvf_stw.unit);
|
||||
epd->print(holdvalues ? unit6old : unit6);
|
||||
|
||||
return PAGE_UPDATE;
|
||||
};
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
|
||||
#include "Pagedata.h"
|
||||
#include "OBP60Extensions.h"
|
||||
|
||||
#ifdef ENABLE_CALIBRATION
|
||||
#include "BoatDataCalibration.h"
|
||||
#endif
|
||||
|
||||
class PageWindRoseFlex : public Page
|
||||
{
|
||||
|
@ -76,9 +73,7 @@ public:
|
|||
}
|
||||
String name1 = bvalue1->getName().c_str(); // 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
|
||||
#endif
|
||||
double value1 = bvalue1->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -96,9 +91,7 @@ public:
|
|||
}
|
||||
String name2 = bvalue2->getName().c_str(); // 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
|
||||
#endif
|
||||
double value2 = bvalue2->value; // Value as double in SI unit
|
||||
bool valid2 = bvalue2->valid; // Valid information
|
||||
if (simulation) {
|
||||
|
@ -115,9 +108,7 @@ public:
|
|||
GwApi::BoatValue *bvalue3 = pageData.values[0];
|
||||
String name3 = xdrDelete(bvalue3->getName()); // 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
|
||||
#endif
|
||||
double value3 = bvalue3->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -131,9 +122,7 @@ public:
|
|||
GwApi::BoatValue *bvalue4 = pageData.values[1];
|
||||
String name4 = xdrDelete(bvalue4->getName()); // 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
|
||||
#endif
|
||||
double value4 = bvalue4->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -147,9 +136,7 @@ public:
|
|||
GwApi::BoatValue *bvalue5 = pageData.values[2];
|
||||
String name5 = xdrDelete(bvalue5->getName()); // 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
|
||||
#endif
|
||||
double value5 = bvalue5->value; // Value as double in SI unit
|
||||
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
|
||||
|
@ -163,9 +150,7 @@ public:
|
|||
GwApi::BoatValue *bvalue6 = pageData.values[3];
|
||||
String name6 = xdrDelete(bvalue6->getName()); // 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
|
||||
#endif
|
||||
double value6 = bvalue6->value; // Value as double in SI unit
|
||||
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
|
||||
|
|
|
@ -383,7 +383,6 @@ bool addTrueWind(GwApi* api, BoatValueList* boatValues) {
|
|||
return isCalculated;
|
||||
}
|
||||
|
||||
|
||||
// Init history buffers for selected boat data
|
||||
void initHstryBuf(GwApi* api, BoatValueList* boatValues, tBoatHstryData hstryBufList) {
|
||||
|
||||
|
@ -701,11 +700,11 @@ void OBP60Task(GwApi *api){
|
|||
calibrationData.readConfig(config, logger);
|
||||
|
||||
// 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);
|
||||
|
||||
// Initialize history buffer for certain boat data
|
||||
//initHstryBuf(api, &boatValues, hstryBufList);
|
||||
initHstryBuf(api, &boatValues, hstryBufList);
|
||||
|
||||
// Display screenshot handler for HTTP request
|
||||
// http://192.168.15.1/api/user/OBP60Task/screenshot
|
||||
|
@ -1018,11 +1017,11 @@ void OBP60Task(GwApi *api){
|
|||
api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues);
|
||||
api->getStatus(commonData.status);
|
||||
|
||||
/*if (calcTrueWnds) {
|
||||
if (calcTrueWnds) {
|
||||
addTrueWind(api, &boatValues);
|
||||
}*/
|
||||
}
|
||||
// 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
|
||||
// epd->fillRect(0, 0, epd->width(), epd->height(), commonData.bgcolor);
|
||||
|
|
|
@ -51,8 +51,6 @@ build_flags=
|
|||
# -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_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}
|
||||
#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
|
||||
|
@ -96,8 +94,6 @@ build_flags=
|
|||
#-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 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}
|
||||
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
|
||||
|
|
|
@ -56,8 +56,6 @@ lib_ldf_mode = off
|
|||
monitor_speed = 115200
|
||||
build_flags =
|
||||
-D PIO_ENV_BUILD=$PIOENV
|
||||
# -D CONFIG_ASYNC_TCP_RUNNING_CORE=1 # async_tcp task core assignment (default is any core)
|
||||
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096 # reduce the stack size (default is 16K)
|
||||
-std=gnu++17
|
||||
build_unflags =
|
||||
-std=gnu++11
|
||||
|
|
Loading…
Reference in New Issue