Bugfix units and display function
This commit is contained in:
parent
d3e7aae21a
commit
1d1f8ef0db
|
@ -118,10 +118,18 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
|
||||||
static unsigned long tcpClTxOld = 0;
|
static unsigned long tcpClTxOld = 0;
|
||||||
static unsigned long n2kRxOld = 0;
|
static unsigned long n2kRxOld = 0;
|
||||||
static unsigned long n2kTxOld = 0;
|
static unsigned long n2kTxOld = 0;
|
||||||
|
int textcolor = GxEPD_BLACK;
|
||||||
|
|
||||||
|
if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){
|
||||||
|
textcolor = GxEPD_BLACK;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
textcolor = GxEPD_WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
// Show status info
|
// Show status info
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setTextColor(GxEPD_BLACK);
|
|
||||||
display.setCursor(0, 15);
|
display.setCursor(0, 15);
|
||||||
if(commonData.status.wifiApOn){
|
if(commonData.status.wifiApOn){
|
||||||
display.print(" AP ");
|
display.print(" AP ");
|
||||||
|
@ -155,6 +163,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
|
||||||
usbTxOld = commonData.status.usbTx;
|
usbTxOld = commonData.status.usbTx;
|
||||||
|
|
||||||
// Heartbeat as dot
|
// Heartbeat as dot
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold32pt7b);
|
display.setFont(&Ubuntu_Bold32pt7b);
|
||||||
display.setCursor(205, 14);
|
display.setCursor(205, 14);
|
||||||
if(heartbeat == true){
|
if(heartbeat == true){
|
||||||
|
@ -166,6 +175,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *hdop, GwApi::BoatVa
|
||||||
heartbeat = !heartbeat;
|
heartbeat = !heartbeat;
|
||||||
|
|
||||||
// Date and time
|
// Date and time
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(230, 15);
|
display.setCursor(230, 15);
|
||||||
if(hdop->valid == true && hdop->value <= 50){
|
if(hdop->valid == true && hdop->value <= 50){
|
||||||
|
|
|
@ -126,11 +126,11 @@ FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
else{
|
else{
|
||||||
speed = 4.0 + float(random(0, 40));
|
speed = 4.0 + float(random(0, 40));
|
||||||
}
|
}
|
||||||
if(String(speedFormat) == "km/h" || String(windspeedFormat) == "km/h"){
|
if((String(speedFormat) == "km/h" || String(windspeedFormat) == "km/h") && String(windspeedFormat) != "bft"){
|
||||||
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
speed = speed * 3.6; // Unit conversion form m/s to km/h
|
||||||
result.unit = "m/s";
|
result.unit = "m/s";
|
||||||
}
|
}
|
||||||
else if(String(speedFormat) == "kn" || String(windspeedFormat) == "kn"){
|
else if((String(speedFormat) == "kn" || String(windspeedFormat) == "kn") && String(windspeedFormat) != "bft"){
|
||||||
speed = speed * 1.94384; // Unit conversion form m/s to kn
|
speed = speed * 1.94384; // Unit conversion form m/s to kn
|
||||||
result.unit = "kn";
|
result.unit = "kn";
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
// Clear display by call in obp60task.cpp in main loop
|
// Clear display by call in obp60task.cpp in main loop
|
||||||
|
|
||||||
// Show values AWS
|
// Show values AWS
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold20pt7b);
|
display.setFont(&Ubuntu_Bold20pt7b);
|
||||||
display.setCursor(20, 50);
|
display.setCursor(20, 50);
|
||||||
if(holdvalues == false){
|
if(holdvalues == false){
|
||||||
|
@ -123,6 +124,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show values AWD
|
// Show values AWD
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold20pt7b);
|
display.setFont(&Ubuntu_Bold20pt7b);
|
||||||
display.setCursor(20, 260);
|
display.setCursor(20, 260);
|
||||||
if(holdvalues == false){
|
if(holdvalues == false){
|
||||||
|
@ -162,6 +164,7 @@ public:
|
||||||
display.drawLine(x1, y1, x2, y2, pixelcolor);
|
display.drawLine(x1, y1, x2, y2, pixelcolor);
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(115, 290);
|
display.setCursor(115, 290);
|
||||||
if(keylock == false){
|
if(keylock == false){
|
||||||
|
|
|
@ -71,11 +71,13 @@ class PageOneValue : public Page{
|
||||||
// Clear display by call in obp60task.cpp in main loop
|
// Clear display by call in obp60task.cpp in main loop
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold32pt7b);
|
display.setFont(&Ubuntu_Bold32pt7b);
|
||||||
display.setCursor(20, 100);
|
display.setCursor(20, 100);
|
||||||
display.print(name1); // Page name
|
display.print(name1); // Page name
|
||||||
|
|
||||||
// Show unit
|
// Show unit
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold20pt7b);
|
display.setFont(&Ubuntu_Bold20pt7b);
|
||||||
display.setCursor(270, 100);
|
display.setCursor(270, 100);
|
||||||
if(holdvalues == false){
|
if(holdvalues == false){
|
||||||
|
@ -112,6 +114,7 @@ class PageOneValue : public Page{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(115, 290);
|
display.setCursor(115, 290);
|
||||||
if(keylock == false){
|
if(keylock == false){
|
||||||
|
|
|
@ -72,16 +72,19 @@ public:
|
||||||
//Clear display in obp60task.cpp in main loop
|
//Clear display in obp60task.cpp in main loop
|
||||||
|
|
||||||
// Show name
|
// Show name
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold32pt7b);
|
display.setFont(&Ubuntu_Bold32pt7b);
|
||||||
display.setCursor(20, 100);
|
display.setCursor(20, 100);
|
||||||
display.print(name1); // Page name
|
display.print(name1); // Page name
|
||||||
|
|
||||||
// Show unit
|
// Show unit
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold20pt7b);
|
display.setFont(&Ubuntu_Bold20pt7b);
|
||||||
display.setCursor(270, 100);
|
display.setCursor(270, 100);
|
||||||
display.print("V");
|
display.print("V");
|
||||||
|
|
||||||
// Reading bus data or using simulation data
|
// Reading bus data or using simulation data
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&DSEG7Classic_BoldItalic60pt7b);
|
display.setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||||
display.setCursor(20, 240);
|
display.setCursor(20, 240);
|
||||||
if(simulation == true){
|
if(simulation == true){
|
||||||
|
@ -114,18 +117,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key Layout
|
// Key Layout
|
||||||
|
display.setTextColor(textcolor);
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(115, 290);
|
display.setCursor(115, 290);
|
||||||
if(keylock == false){
|
if(keylock == false){
|
||||||
display.print(" [ <<<<<< >>>>>> ]");
|
display.print(" [ <<<<<< >>>>>> ]");
|
||||||
|
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||||
|
display.setCursor(343, 290);
|
||||||
|
display.print("[ILUM]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
display.print(" [ Keylock active ]");
|
display.print(" [ Keylock active ]");
|
||||||
}
|
}
|
||||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
|
||||||
display.setCursor(343, 290);
|
|
||||||
display.print("[ILUM]");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update display
|
// Update display
|
||||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||||
|
|
Loading…
Reference in New Issue