Add DBT and STW in WindRose page

This commit is contained in:
norbert-walter 2023-08-18 17:14:21 +02:00
parent 333018cf0d
commit e5f945fc3c
1 changed files with 67 additions and 6 deletions

View File

@ -36,6 +36,10 @@ public:
static String unit3old = "";
static String svalue4old = "";
static String unit4old = "";
static String svalue5old = "";
static String unit5old = "";
static String svalue6old = "";
static String unit6old = "";
// Get config data
String lengthformat = config->getString(config->lengthFormat);
@ -45,7 +49,7 @@ public:
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
// Get boat values for AWS
// Get boat values for 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
@ -58,7 +62,7 @@ public:
unit1old = unit1; // Save old unit
}
// Get boat values for AWD
// Get boat values for AWS
GwApi::BoatValue *bvalue2 = pageData.values[1]; // First 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
@ -71,7 +75,7 @@ public:
unit2old = unit2; // Save old unit
}
// Get boat values #3
// Get boat values TWD
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
@ -84,7 +88,7 @@ public:
unit3old = unit3; // Save old unit
}
// Get boat values #4
// Get boat values TWS
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
@ -97,6 +101,32 @@ public:
unit4old = unit4; // Save old unit
}
// Get boat values DBT
GwApi::BoatValue *bvalue5 = pageData.values[4]; // Second element in list (only one value by PageOneValue)
String name5 = xdrDelete(bvalue5->getName()); // Value name
name5 = name5.substring(0, 6); // String length limit for value name
double value5 = bvalue5->value; // Value as double in SI unit
bool valid5 = bvalue5->valid; // Valid information
String svalue5 = formatValue(bvalue5, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit5 = formatValue(bvalue5, commonData).unit; // Unit of value
if(valid5 == true){
svalue5old = svalue5; // Save old value
unit5old = unit5; // Save old unit
}
// Get boat values STW
GwApi::BoatValue *bvalue6 = pageData.values[5]; // Second element in list (only one value by PageOneValue)
String name6 = xdrDelete(bvalue6->getName()); // Value name
name6 = name6.substring(0, 6); // String length limit for value name
double value6 = bvalue6->value; // Value as double in SI unit
bool valid6 = bvalue6->valid; // Valid information
String svalue6 = formatValue(bvalue6, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit6 = formatValue(bvalue6, commonData).unit; // Unit of value
if(valid6 == true){
svalue6old = svalue6; // Save old value
unit6old = unit6; // Save old unit
}
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
@ -105,7 +135,7 @@ public:
// Logging boat values
if (bvalue1 == NULL) return;
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f", name1, value1, name2, value2, name3, value3, name4, value4);
LOG_DEBUG(GwLog::LOG,"Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1, value1, name2, value2, name3, value3, name4, value4, name5, value5, name6, value6);
// Draw page
//***********************************************************
@ -307,6 +337,37 @@ public:
display.fillCircle(200, 150, startwidth + 4, pixelcolor);
//*******************************************************************************************
// Show values DBT
display.setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic16pt7b);
display.setCursor(160, 200);
display.print(svalue5); // Value
display.setFont(&Ubuntu_Bold8pt7b);
display.setCursor(190, 215);
display.print(" ");
if(holdvalues == false){
display.print(unit5); // Unit
}
else{
display.print(unit5old); // Unit
}
// Show values STW
display.setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic16pt7b);
display.setCursor(160, 130);
display.print(svalue6); // Value
display.setFont(&Ubuntu_Bold8pt7b);
display.setCursor(190, 90);
display.print(" ");
if(holdvalues == false){
display.print(unit6); // Unit
}
else{
display.print(unit6old); // Unit
}
// Key Layout
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b);
@ -343,7 +404,7 @@ PageDescription registerPageWindRose(
"WindRose", // Page name
createPage, // Action
0, // Number of bus values depends on selection in Web configuration
{"AWA", "AWS", "TWD", "TWS"}, // Bus values we need in the page
{"AWA", "AWS", "TWD", "TWS", "DBT", "STW"}, // Bus values we need in the page
true // Show display header on/off
);