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
|
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
|
int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -56,6 +60,7 @@ class PageBattery : public Page
|
|||||||
String backlightMode = config->getString(config->backlight);
|
String backlightMode = config->getString(config->backlight);
|
||||||
String powsensor1 = config->getString(config->usePowSensor1);
|
String powsensor1 = config->getString(config->usePowSensor1);
|
||||||
bool simulation = config->getBool(config->useSimuData);
|
bool simulation = config->getBool(config->useSimuData);
|
||||||
|
bool smallDecimals = config->getBool(config->smallDecimals);
|
||||||
|
|
||||||
// Get voltage value
|
// Get voltage value
|
||||||
String name1 = "VBat"; // Value name
|
String name1 = "VBat"; // Value name
|
||||||
@@ -218,17 +223,13 @@ class PageBattery : public Page
|
|||||||
getdisplay().setCursor(20, 90);
|
getdisplay().setCursor(20, 90);
|
||||||
getdisplay().print(unit1); // Unit
|
getdisplay().print(unit1); // Unit
|
||||||
|
|
||||||
// Show value
|
// Show bus value
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
|
||||||
getdisplay().setCursor(180, 90);
|
|
||||||
|
|
||||||
// Show bus data
|
|
||||||
if(String(powsensor1) != "off"){
|
if(String(powsensor1) != "off"){
|
||||||
getdisplay().print(value1,2); // Real value as formated string
|
svalue1 = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
||||||
}
|
} else{
|
||||||
else{
|
svalue1 = "---";
|
||||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
|
||||||
}
|
}
|
||||||
|
printBoatValue(svalue1, 380, 90, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||||
|
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
@@ -247,17 +248,13 @@ class PageBattery : public Page
|
|||||||
getdisplay().setCursor(20, 180);
|
getdisplay().setCursor(20, 180);
|
||||||
getdisplay().print(unit2); // Unit
|
getdisplay().print(unit2); // Unit
|
||||||
|
|
||||||
// Show value
|
// Show bus value
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
|
||||||
getdisplay().setCursor(180, 180);
|
|
||||||
|
|
||||||
// Show bus data
|
|
||||||
if(String(powsensor1) != "off"){
|
if(String(powsensor1) != "off"){
|
||||||
getdisplay().print(value2,1); // Real value as formated string
|
svalue2 = formatValue(value2, String("formatXdr:U:V"), *commonData);
|
||||||
}
|
} else{
|
||||||
else{
|
svalue2 = "---";
|
||||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
|
||||||
}
|
}
|
||||||
|
printBoatValue(svalue2, 380, 180, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||||
|
|
||||||
// ############### Horizontal Line ################
|
// ############### Horizontal Line ################
|
||||||
|
|
||||||
@@ -276,17 +273,13 @@ class PageBattery : public Page
|
|||||||
getdisplay().setCursor(20, 270);
|
getdisplay().setCursor(20, 270);
|
||||||
getdisplay().print(unit3); // Unit
|
getdisplay().print(unit3); // Unit
|
||||||
|
|
||||||
// Show value
|
// Show bus value
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
|
||||||
getdisplay().setCursor(180, 270);
|
|
||||||
|
|
||||||
// Show bus data
|
|
||||||
if(String(powsensor1) != "off"){
|
if(String(powsensor1) != "off"){
|
||||||
getdisplay().print(value3,1); // Real value as formated string
|
svalue3 = formatValue(value3, String("formatXdr:U:V"), *commonData);
|
||||||
}
|
} else{
|
||||||
else{
|
svalue3 = "---";
|
||||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
|
||||||
}
|
}
|
||||||
|
printBoatValue(svalue3, 380, 270, RIGHT, 30, smallDecimals); // Real value as formated string
|
||||||
|
|
||||||
return PAGE_UPDATE;
|
return PAGE_UPDATE;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ public:
|
|||||||
bool smallDecimals = config->getBool(config->smallDecimals);
|
bool smallDecimals = config->getBool(config->smallDecimals);
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0;
|
||||||
|
String svalue = "---";
|
||||||
double valueTrend = 0; // Average over 10 values
|
double valueTrend = 0; // Average over 10 values
|
||||||
|
|
||||||
// Get voltage value
|
// Get voltage value
|
||||||
@@ -239,10 +240,12 @@ public:
|
|||||||
printAvg(average, 320, 84, true);
|
printAvg(average, 320, 84, true);
|
||||||
|
|
||||||
// Reading bus data or using simulation data
|
// Reading bus data or using simulation data
|
||||||
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
|
if(valid1 == true || holdvalues == true){
|
||||||
getdisplay().setCursor(20, 240);
|
svalue = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
||||||
String sValue = formatValue(value1, String("formatXdr:U:V"), *commonData);
|
} else {
|
||||||
printBoatValue(sValue, 300, 240, RIGHT, 60, smallDecimals);
|
svalue = "---"; // Missing bus data
|
||||||
|
}
|
||||||
|
printBoatValue(svalue, 300, 240, RIGHT, 60, smallDecimals);
|
||||||
|
|
||||||
// Show trend indicator
|
// Show trend indicator
|
||||||
if(trend == true){
|
if(trend == true){
|
||||||
|
|||||||
Reference in New Issue
Block a user