mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-09-11 19:55:14 +02:00
Enable pages OneValue, TwoValue, ThreeValue,
FourValue, FourValue2 for small decimals
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
|
||||
class PageThreeValues : public Page
|
||||
{
|
||||
private:
|
||||
static constexpr int8_t LEFT = 0;
|
||||
static constexpr int8_t CENTER = 1;
|
||||
static constexpr int8_t RIGHT = 2;
|
||||
|
||||
public:
|
||||
PageThreeValues(CommonData &common){
|
||||
commonData = &common;
|
||||
@@ -24,6 +29,9 @@ class PageThreeValues : public Page
|
||||
GwConfigHandler *config = commonData->config;
|
||||
GwLog *logger = commonData->logger;
|
||||
|
||||
int valueX, valueY;
|
||||
int DsegFontSize;
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
static String unit1old = "";
|
||||
@@ -33,11 +41,10 @@ class PageThreeValues : public Page
|
||||
static String unit3old = "";
|
||||
|
||||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
bool smallDecimals = config->getBool(config->smallDecimals);
|
||||
|
||||
// Get boat values #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
@@ -101,25 +108,26 @@ class PageThreeValues : public Page
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
valueX = 380;
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(50, 90);
|
||||
valueY = 90;
|
||||
DsegFontSize = 20;
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(170, 68);
|
||||
valueY = 80;
|
||||
DsegFontSize = 20;
|
||||
}
|
||||
else{
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
valueY = 90;
|
||||
DsegFontSize = 30;
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
printBoatValue(svalue1, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
printBoatValue(svalue1old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
@@ -150,24 +158,30 @@ class PageThreeValues : public Page
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
|
||||
valueY = 180;
|
||||
DsegFontSize = 20;
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(50, 180);
|
||||
}
|
||||
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
|
||||
valueY = 170;
|
||||
DsegFontSize = 20;
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(170, 158);
|
||||
}
|
||||
else{
|
||||
valueY = 180;
|
||||
DsegFontSize = 30;
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
printBoatValue(svalue2, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
printBoatValue(svalue2old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
@@ -198,24 +212,24 @@ class PageThreeValues : public Page
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(50, 270);
|
||||
valueY = 270;
|
||||
DsegFontSize = 20;
|
||||
}
|
||||
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt8b);
|
||||
getdisplay().setCursor(170, 248);
|
||||
valueY = 260;
|
||||
DsegFontSize = 20;
|
||||
}
|
||||
else{
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 270);
|
||||
valueY = 270;
|
||||
DsegFontSize = 30;
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
printBoatValue(svalue3, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print(svalue3old); // Old value as formated string
|
||||
printBoatValue(svalue3old, valueX, valueY, RIGHT, DsegFontSize, smallDecimals); // Real value as formated string
|
||||
}
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save the old value
|
||||
|
||||
Reference in New Issue
Block a user