1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-15 15:03:07 +01:00

First version with GxEPD2 Lib

This commit is contained in:
norbert-walter
2024-03-23 21:17:11 +01:00
parent c1d6a566aa
commit 8c73a8739f
25 changed files with 1218 additions and 1180 deletions

View File

@@ -105,37 +105,39 @@ class PageDST810 : public Page
pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK;
}
// Clear display by call in obp60task.cpp in main loop
// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(bgcolor); // Clear display
// ############### Value 1 ################
// Show name
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 55);
display.print("Depth"); // Page name
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold20pt7b);
getdisplay().setCursor(20, 55);
getdisplay().print("Depth"); // Page name
// Show unit
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 90);
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(20, 90);
if(holdvalues == false){
display.print(unit1); // Unit
getdisplay().print(unit1); // Unit
}
else{
display.print(unit1old);
getdisplay().print(unit1old);
}
// Set font
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 90);
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90);
// Show bus data
if(holdvalues == false){
display.print(svalue1); // Real value as formated string
getdisplay().print(svalue1); // Real value as formated string
}
else{
display.print(svalue1old); // Old value as formated string
getdisplay().print(svalue1old); // Old value as formated string
}
if(valid1 == true){
svalue1old = svalue1; // Save the old value
@@ -145,37 +147,37 @@ class PageDST810 : public Page
// ############### Horizontal Line ################
// Horizontal line 3 pix
display.fillRect(0, 105, 400, 3, pixelcolor);
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
// ############### Value 2 ################
// Show name
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 145);
display.print("Speed"); // Page name
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold20pt7b);
getdisplay().setCursor(20, 145);
getdisplay().print("Speed"); // Page name
// Show unit
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 180);
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(20, 180);
if(holdvalues == false){
display.print(unit2); // Unit
getdisplay().print(unit2); // Unit
}
else{
display.print(unit2old);
getdisplay().print(unit2old);
}
// Setfont
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 180);
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180);
// Show bus data
if(holdvalues == false){
display.print(svalue2); // Real value as formated string
getdisplay().print(svalue2); // Real value as formated string
}
else{
display.print(svalue2old); // Old value as formated string
getdisplay().print(svalue2old); // Old value as formated string
}
if(valid2 == true){
svalue2old = svalue2; // Save the old value
@@ -185,37 +187,37 @@ class PageDST810 : public Page
// ############### Horizontal Line ################
// Horizontal line 3 pix
display.fillRect(0, 195, 400, 3, pixelcolor);
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
// ############### Value 3 ################
// Show name
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 220);
display.print("Log"); // Page name
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(20, 220);
getdisplay().print("Log"); // Page name
// Show unit
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 240);
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold8pt7b);
getdisplay().setCursor(20, 240);
if(holdvalues == false){
display.print(unit3); // Unit
getdisplay().print(unit3); // Unit
}
else{
display.print(unit3old);
getdisplay().print(unit3old);
}
// Set font
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(80, 270);
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(80, 270);
// Show bus data
if(holdvalues == false){
display.print(svalue3); // Real value as formated string
getdisplay().print(svalue3); // Real value as formated string
}
else{
display.print(svalue3old); // Old value as formated string
getdisplay().print(svalue3old); // Old value as formated string
}
if(valid3 == true){
svalue3old = svalue3; // Save the old value
@@ -225,37 +227,37 @@ class PageDST810 : public Page
// ############### Vertical Line ################
// Vertical line 3 pix
display.fillRect(200, 195, 3, 75, pixelcolor);
getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
// ############### Value 4 ################
// Show name
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b);
display.setCursor(220, 220);
display.print("Temp"); // Page name
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(220, 220);
getdisplay().print("Temp"); // Page name
// Show unit
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b);
display.setCursor(220, 240);
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold8pt7b);
getdisplay().setCursor(220, 240);
if(holdvalues == false){
display.print(unit4); // Unit
getdisplay().print(unit4); // Unit
}
else{
display.print(unit4old);
getdisplay().print(unit4old);
}
// Set font
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(280, 270);
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(280, 270);
// Show bus data
if(holdvalues == false){
display.print(svalue4); // Real value as formated string
getdisplay().print(svalue4); // Real value as formated string
}
else{
display.print(svalue4old); // Old value as formated string
getdisplay().print(svalue4old); // Old value as formated string
}
if(valid4 == true){
svalue4old = svalue4; // Save the old value
@@ -266,23 +268,23 @@ class PageDST810 : public Page
// ############### Key Layout ################
// Key Layout
display.setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b);
getdisplay().setTextColor(textcolor);
getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){
display.setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
getdisplay().setCursor(130, 290);
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290);
display.print("[ILUM]");
getdisplay().setCursor(343, 290);
getdisplay().print("[ILUM]");
}
}
else{
display.setCursor(130, 290);
display.print(" [ Keylock active ]");
getdisplay().setCursor(130, 290);
getdisplay().print(" [ Keylock active ]");
}
// Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
getdisplay().nextPage(); // Partial update (fast)
};
};