mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-09-11 19:55:14 +02:00
Enable page Battery for small decimals; small adjustment for PageVoltage
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
|
||||
class PageBattery : public Page
|
||||
{
|
||||
static constexpr int8_t LEFT = 0;
|
||||
static constexpr int8_t CENTER = 1;
|
||||
static constexpr int8_t RIGHT = 2;
|
||||
|
||||
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||
|
||||
public:
|
||||
@@ -56,6 +60,7 @@ class PageBattery : public Page
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
String powsensor1 = config->getString(config->usePowSensor1);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
bool smallDecimals = config->getBool(config->smallDecimals);
|
||||
|
||||
// Get voltage value
|
||||
String name1 = "VBat"; // Value name
|
||||
@@ -218,17 +223,13 @@ class PageBattery : public Page
|
||||
getdisplay().setCursor(20, 90);
|
||||
getdisplay().print(unit1); // Unit
|
||||
|
||||
// Show value
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
|
||||
// Show bus data
|
||||
// Show bus value
|
||||
if(String(powsensor1) != "off"){
|
||||
getdisplay().print(value1,2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
svalue1 = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
||||
} else{
|
||||
svalue1 = "---";
|
||||
}
|
||||
printBoatValue(svalue1, 380, 90, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
@@ -247,17 +248,13 @@ class PageBattery : public Page
|
||||
getdisplay().setCursor(20, 180);
|
||||
getdisplay().print(unit2); // Unit
|
||||
|
||||
// Show value
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
|
||||
// Show bus data
|
||||
// Show bus value
|
||||
if(String(powsensor1) != "off"){
|
||||
getdisplay().print(value2,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
svalue2 = formatValue(value2, String("formatXdr:U:V"), *commonData);
|
||||
} else{
|
||||
svalue2 = "---";
|
||||
}
|
||||
printBoatValue(svalue2, 380, 180, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
@@ -276,17 +273,13 @@ class PageBattery : public Page
|
||||
getdisplay().setCursor(20, 270);
|
||||
getdisplay().print(unit3); // Unit
|
||||
|
||||
// Show value
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 270);
|
||||
|
||||
// Show bus data
|
||||
// Show bus value
|
||||
if(String(powsensor1) != "off"){
|
||||
getdisplay().print(value3,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
svalue3 = formatValue(value3, String("formatXdr:U:V"), *commonData);
|
||||
} else{
|
||||
svalue3 = "---";
|
||||
}
|
||||
printBoatValue(svalue3, 380, 270, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||
|
||||
return PAGE_UPDATE;
|
||||
};
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
bool smallDecimals = config->getBool(config->smallDecimals);
|
||||
|
||||
double value1 = 0;
|
||||
String svalue = "---";
|
||||
double valueTrend = 0; // Average over 10 values
|
||||
|
||||
// Get voltage value
|
||||
@@ -239,10 +240,12 @@ public:
|
||||
printAvg(average, 320, 84, true);
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
String sValue = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
||||
printBoatValue(sValue, 300, 240, RIGHT, 60, smallDecimals);
|
||||
if(valid1 == true || holdvalues == true){
|
||||
svalue = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
||||
} else {
|
||||
svalue = "---"; // Missing bus data
|
||||
}
|
||||
printBoatValue(svalue, 300, 240, RIGHT, 60, smallDecimals);
|
||||
|
||||
// Show trend indicator
|
||||
if(trend == true){
|
||||
|
||||
Reference in New Issue
Block a user