Refactor color detection and usage
This commit is contained in:
parent
4ad82299fc
commit
2659fb9fb7
|
@ -5,21 +5,7 @@
|
|||
#include "OBP60Extensions.h"
|
||||
#include "qrcode.h"
|
||||
|
||||
void qrWiFi(String ssid, String passwd, String displaycolor){
|
||||
// Set display color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
void qrWiFi(String ssid, String passwd, uint16_t fgcolor, uint16_t bgcolor){
|
||||
|
||||
// Set start point and pixel size
|
||||
int16_t box_x = 100; // X offset
|
||||
|
@ -40,7 +26,7 @@ void qrWiFi(String ssid, String passwd, String displaycolor){
|
|||
// Each horizontal module
|
||||
for (uint8_t x = 0; x < qrcode.size; x++) {
|
||||
if(qrcode_getModule(&qrcode, x, y)){
|
||||
getdisplay().fillRect(box_x, box_y, box_s, box_s, pixelcolor);
|
||||
getdisplay().fillRect(box_x, box_y, box_s, box_s, fgcolor);
|
||||
} else {
|
||||
getdisplay().fillRect(box_x, box_y, box_s, box_s, bgcolor);
|
||||
}
|
||||
|
@ -50,10 +36,10 @@ void qrWiFi(String ssid, String passwd, String displaycolor){
|
|||
box_x = init_x;
|
||||
}
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(fgcolor);
|
||||
getdisplay().setCursor(140, 285);
|
||||
getdisplay().print("WiFi");
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -90,25 +89,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show values AWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 50);
|
||||
if(holdvalues == false){
|
||||
|
@ -127,7 +113,6 @@ public:
|
|||
}
|
||||
|
||||
// Show values AWD
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 260);
|
||||
if(holdvalues == false){
|
||||
|
@ -154,8 +139,8 @@ public:
|
|||
static int16_t y2 = y0;
|
||||
|
||||
//Draw instrument
|
||||
getdisplay().fillCircle(x0, y0, lp + 5, pixelcolor); // Black circle
|
||||
getdisplay().fillCircle(x0, y0, lp + 1, bgcolor); // White circle
|
||||
getdisplay().fillCircle(x0, y0, lp + 5, commonData.fgcolor);
|
||||
getdisplay().fillCircle(x0, y0, lp + 1, commonData.bgcolor);
|
||||
|
||||
// Calculation end point of pointer
|
||||
value2 = value2 - 3.14 / 2;
|
||||
|
@ -163,10 +148,9 @@ public:
|
|||
y1 = y0 + sin(value2) * lp * 0.6;
|
||||
x2 = x0 + cos(value2) * lp;
|
||||
y2 = y0 + sin(value2) * lp;
|
||||
getdisplay().drawLine(x1, y1, x2, y2, pixelcolor);
|
||||
getdisplay().drawLine(x1, y1, x2, y2, commonData.fgcolor);
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -205,4 +189,4 @@ PageDescription registerPageApparentWind(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,6 @@ class PageBME280 : public Page
|
|||
// Get config data
|
||||
String tempformat = config->getString(config->tempFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
String useenvsensor = config->getString(config->useEnvSensor);
|
||||
|
@ -105,33 +104,19 @@ class PageBME280 : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
getdisplay().print(unit1); // Unit
|
||||
|
@ -146,18 +131,16 @@ class PageBME280 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
getdisplay().print(unit2); // Unit
|
||||
|
@ -172,18 +155,16 @@ class PageBME280 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
getdisplay().print(unit3); // Unit
|
||||
|
@ -198,7 +179,6 @@ class PageBME280 : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -47,7 +47,6 @@ class PageBattery : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
String powsensor1 = config->getString(config->usePowSensor1);
|
||||
|
@ -153,25 +152,11 @@ class PageBattery : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
// Show average settings
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
switch (average) {
|
||||
case 0:
|
||||
|
@ -219,13 +204,11 @@ class PageBattery : public Page
|
|||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Value name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
getdisplay().print(unit1); // Unit
|
||||
|
@ -245,18 +228,16 @@ class PageBattery : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Value name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
getdisplay().print(unit2); // Unit
|
||||
|
@ -276,18 +257,16 @@ class PageBattery : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Value name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
getdisplay().print(unit3); // Unit
|
||||
|
@ -308,7 +287,6 @@ class PageBattery : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(10, 290);
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String batVoltage = config->getString(config->batteryVoltage);
|
||||
|
@ -178,37 +177,22 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Clear display, set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Bat.");
|
||||
|
||||
// Show battery type
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(90, 65);
|
||||
getdisplay().print(batType);
|
||||
|
||||
// Show voltage type
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
|
@ -219,7 +203,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show battery capacity
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(batCapacity <= 999) getdisplay().print(batCapacity, 0);
|
||||
|
@ -236,10 +219,9 @@ public:
|
|||
getdisplay().print("Battery Type");
|
||||
|
||||
// Show battery with fill level
|
||||
batteryGraphic(150, 45, batPercentage, pixelcolor, bgcolor);
|
||||
batteryGraphic(150, 45, batPercentage, commonData.fgcolor, commonData.bgcolor);
|
||||
|
||||
// Show average settings
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(150, 145);
|
||||
switch (average) {
|
||||
|
@ -261,7 +243,6 @@ public:
|
|||
}
|
||||
|
||||
// Show fill level in percent
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(batPercentage);
|
||||
|
@ -269,7 +250,6 @@ public:
|
|||
getdisplay().print("%");
|
||||
|
||||
// Show time to full discharge
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -297,7 +277,6 @@ public:
|
|||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
|
@ -326,7 +305,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -339,7 +317,6 @@ public:
|
|||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -352,7 +329,6 @@ public:
|
|||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(10, 290);
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -108,25 +107,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show values GPS date
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
if(holdvalues == false) getdisplay().print(svalue2); // Value
|
||||
|
@ -136,10 +122,9 @@ public:
|
|||
getdisplay().print("Date"); // Name
|
||||
|
||||
// Horizintal separator left
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
||||
|
||||
// Show values GPS time
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 250);
|
||||
if(holdvalues == false) getdisplay().print(svalue1); // Value
|
||||
|
@ -155,7 +140,6 @@ public:
|
|||
svalue5old = sunrise;
|
||||
}
|
||||
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 65);
|
||||
if(holdvalues == false) getdisplay().print(sunrise); // Value
|
||||
|
@ -165,7 +149,7 @@ public:
|
|||
getdisplay().print("SunR"); // Name
|
||||
|
||||
// Horizintal separator right
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
||||
|
||||
// Show values sunset
|
||||
String sunset = "---";
|
||||
|
@ -174,7 +158,6 @@ public:
|
|||
svalue6old = sunset;
|
||||
}
|
||||
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 250);
|
||||
if(holdvalues == false) getdisplay().print(sunset); // Value
|
||||
|
@ -189,8 +172,8 @@ public:
|
|||
int rInstrument = 110; // Radius of clock
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
|
||||
for(int i=0; i<360; i=i+1)
|
||||
{
|
||||
|
@ -231,7 +214,7 @@ public:
|
|||
if(i % 6 == 0){
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
sinx=sin(i/180.0*pi);
|
||||
cosx=cos(i/180.0*pi);
|
||||
}
|
||||
|
@ -245,23 +228,20 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// Print Unit in clock
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
if(holdvalues == false){
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit2old); // Unit
|
||||
}
|
||||
|
||||
|
@ -290,7 +270,7 @@ public:
|
|||
float yy2 = -(rInstrument * 0.5);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -300,7 +280,7 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Draw minute pointer
|
||||
|
@ -316,7 +296,7 @@ public:
|
|||
float yy2 = -(rInstrument - 15);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -326,16 +306,15 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -37,7 +37,6 @@ class PageDST810 : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -91,33 +90,19 @@ class PageDST810 : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print("Depth"); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
|
@ -146,18 +131,16 @@ class PageDST810 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print("Speed"); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
|
@ -186,18 +169,16 @@ class PageDST810 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 220);
|
||||
getdisplay().print("Log"); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
|
@ -226,18 +207,16 @@ class PageDST810 : public Page
|
|||
// ############### Vertical Line ################
|
||||
|
||||
// Vertical line 3 pix
|
||||
getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
|
||||
getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(220, 220);
|
||||
getdisplay().print("Temp"); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 240);
|
||||
if(holdvalues == false){
|
||||
|
@ -267,7 +246,6 @@ class PageDST810 : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -46,7 +46,7 @@ std::vector<Point> rotatePoints(const Point& origin, const std::vector<Point>& p
|
|||
return rotatedPoints;
|
||||
}
|
||||
|
||||
void fillPoly4(const std::vector<Point>& p4, int color) {
|
||||
void fillPoly4(const std::vector<Point>& p4, uint16_t color) {
|
||||
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[1].x, p4[1].y, p4[2].x, p4[2].y, color);
|
||||
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color);
|
||||
}
|
||||
|
@ -96,10 +96,12 @@ static unsigned char gasoline_bits[] = {
|
|||
|
||||
class PageFluid : public Page{
|
||||
bool keylock = false; // Keylock
|
||||
int fluidtype;
|
||||
|
||||
public:
|
||||
PageFluid(CommonData &common){
|
||||
common.logger->logDebug(GwLog::LOG,"Show PageFluid");
|
||||
fluidtype = common.config->getInt("page" + String(common.data.actpage) + "fluid", 0);
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
|
@ -116,7 +118,6 @@ class PageFluid : public Page{
|
|||
|
||||
// Get config data
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
||||
// Optical warning by limit violation (unused)
|
||||
|
@ -133,23 +134,14 @@ class PageFluid : public Page{
|
|||
double value1 = bvalue1->value;
|
||||
bool valid1 = bvalue1->valid;
|
||||
|
||||
int fluidtype = config->getInt("page" + String(commonData.data.actpage) + "fluid", 0);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor != "Normal"){
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height());
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// descriptions
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 60);
|
||||
|
@ -166,11 +158,11 @@ class PageFluid : public Page{
|
|||
uint8_t r = 110;
|
||||
|
||||
// circular frame
|
||||
getdisplay().drawCircle(c.x, c.y, r+5, pixelcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, r+2, pixelcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, r-1, bgcolor);
|
||||
getdisplay().drawCircle(c.x, c.y, r+5, commonData.fgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, r+2, commonData.fgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, r-1, commonData.bgcolor);
|
||||
// center of pointer as dot
|
||||
getdisplay().fillCircle(c.x, c.y, 8, pixelcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor);
|
||||
|
||||
// value down centered
|
||||
char buffer[6];
|
||||
|
@ -184,19 +176,19 @@ class PageFluid : public Page{
|
|||
// draw symbol (as bitmap)
|
||||
switch (fluidtype) {
|
||||
case 0:
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData.fgcolor);
|
||||
break;
|
||||
case 1:
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData.fgcolor);
|
||||
break;
|
||||
case 4:
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData.fgcolor);
|
||||
break;
|
||||
case 5:
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData.fgcolor);
|
||||
break;
|
||||
case 6:
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData.fgcolor);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -225,11 +217,11 @@ class PageFluid : public Page{
|
|||
{c.x + 2, c.y - (r - 16)},
|
||||
{c.x - 2, c.y - (r - 16)}
|
||||
};
|
||||
fillPoly4(rotatePoints(c, pts, -120), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, -60), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 0), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 60), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 120), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, -120), commonData.fgcolor);
|
||||
fillPoly4(rotatePoints(c, pts, -60), commonData.fgcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 0), commonData.fgcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 60), commonData.fgcolor);
|
||||
fillPoly4(rotatePoints(c, pts, 120), commonData.fgcolor);
|
||||
|
||||
// dots
|
||||
// rotate 0 to 360 in 12 degree steps
|
||||
|
@ -238,7 +230,7 @@ class PageFluid : public Page{
|
|||
continue;
|
||||
}
|
||||
p = rotatePoint(c, {c.x, c.y - r + 10}, angle);
|
||||
getdisplay().fillCircle(p.x, p.y, 3, pixelcolor);
|
||||
getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor);
|
||||
}
|
||||
|
||||
// pointer
|
||||
|
@ -249,9 +241,9 @@ class PageFluid : public Page{
|
|||
{c.x + 6, c.y + 15},
|
||||
{c.x - 6, c.y + 15}
|
||||
};
|
||||
fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), pixelcolor);
|
||||
fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData.fgcolor);
|
||||
// Pointer axis is white
|
||||
getdisplay().fillCircle(c.x, c.y, 6, bgcolor);
|
||||
getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor);
|
||||
}
|
||||
|
||||
// Key Layout
|
||||
|
|
|
@ -37,7 +37,6 @@ class PageFourValues : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -91,33 +90,19 @@ class PageFourValues : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 45);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 65);
|
||||
if(holdvalues == false){
|
||||
|
@ -156,18 +141,16 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 80, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 80, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 113);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 133);
|
||||
if(holdvalues == false){
|
||||
|
@ -206,18 +189,16 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 146, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 146, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 181);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 201);
|
||||
if(holdvalues == false){
|
||||
|
@ -256,18 +237,16 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 214, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 214, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 249);
|
||||
getdisplay().print(name4); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 269);
|
||||
if(holdvalues == false){
|
||||
|
@ -307,7 +286,6 @@ class PageFourValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -37,7 +37,6 @@ class PageFourValues2 : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -91,33 +90,19 @@ class PageFourValues2 : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
|
@ -156,18 +141,16 @@ class PageFourValues2 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
|
@ -206,18 +189,16 @@ class PageFourValues2 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 220);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
|
@ -256,18 +237,16 @@ class PageFourValues2 : public Page
|
|||
// ############### Vertical Line ################
|
||||
|
||||
// Vertical line 3 pix
|
||||
getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
|
||||
getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(220, 220);
|
||||
getdisplay().print(name4); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 240);
|
||||
if(holdvalues == false){
|
||||
|
@ -307,7 +286,6 @@ class PageFourValues2 : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -29,7 +29,6 @@ public:
|
|||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String batVoltage = config->getString(config->batteryVoltage);
|
||||
|
@ -85,25 +84,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Clear display, set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Power");
|
||||
|
@ -112,7 +98,6 @@ public:
|
|||
getdisplay().print("Generator");
|
||||
|
||||
// Show voltage type
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
|
@ -123,7 +108,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show solar power
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(genPower <= 999) getdisplay().print(genPower, 0);
|
||||
|
@ -140,10 +124,9 @@ public:
|
|||
getdisplay().print("Power Modul");
|
||||
|
||||
// Show generator
|
||||
generatorGraphic(200, 95, pixelcolor, bgcolor);
|
||||
generatorGraphic(200, 95, commonData.fgcolor, commonData.bgcolor);
|
||||
|
||||
// Show load level in percent
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(genPercentage);
|
||||
|
@ -171,7 +154,6 @@ public:
|
|||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
|
@ -200,7 +182,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -213,7 +194,6 @@ public:
|
|||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -226,7 +206,6 @@ public:
|
|||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -264,4 +243,4 @@ PageDescription registerPageGenerator(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -69,20 +68,6 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
|
@ -92,9 +77,9 @@ public:
|
|||
int rInstrument = 110; // Radius of KeelPosition
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle
|
||||
|
||||
for(int i=90; i<=270; i=i+10)
|
||||
{
|
||||
|
@ -132,7 +117,7 @@ public:
|
|||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -145,10 +130,10 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -182,7 +167,7 @@ public:
|
|||
float yy2 = -(rInstrument * 0.6);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -192,20 +177,19 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
|
||||
// Draw counterweight
|
||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, pixelcolor);
|
||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 140, startwidth + 22, bgcolor);
|
||||
getdisplay().fillCircle(200, 140, startwidth + 20, pixelcolor); // Boat circle
|
||||
getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, bgcolor); // Delete half top of boat circle
|
||||
getdisplay().fillRect(150, 150, 100, 4, pixelcolor); // Water line
|
||||
getdisplay().fillCircle(200, 140, startwidth + 22, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 140, startwidth + 20, commonData.fgcolor); // Boat circle
|
||||
getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData.bgcolor); // Delete half top of boat circle
|
||||
getdisplay().fillRect(150, 150, 100, 4, commonData.fgcolor); // Water line
|
||||
|
||||
// Print label
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(100, 70);
|
||||
getdisplay().print("Keel Position"); // Label
|
||||
|
@ -225,7 +209,6 @@ public:
|
|||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -264,4 +247,4 @@ PageDescription registerPageKeelPosition(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,6 @@ class PageOneValue : public Page{
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -57,31 +56,16 @@ class PageOneValue : public Page{
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(20, 100);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(270, 100);
|
||||
if(holdvalues == false){
|
||||
|
@ -118,7 +102,6 @@ class PageOneValue : public Page{
|
|||
}
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -157,4 +140,4 @@ PageDescription registerPageOneValue(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -118,25 +117,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show roll limit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print(rolllimit); // Value
|
||||
|
@ -150,10 +136,9 @@ public:
|
|||
getdisplay().print("DEG");
|
||||
|
||||
// Horizintal separator left
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
||||
|
||||
// Show roll value
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 270);
|
||||
if(holdvalues == false) getdisplay().print(svalue1); // Value
|
||||
|
@ -166,10 +151,9 @@ public:
|
|||
getdisplay().print("Deg");
|
||||
|
||||
// Horizintal separator right
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
||||
|
||||
// Show pitch value
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 270);
|
||||
if(holdvalues == false) getdisplay().print(svalue2); // Value
|
||||
|
@ -187,8 +171,8 @@ public:
|
|||
int rInstrument = 100; // Radius of instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
|
||||
for(int i=0; i<360; i=i+10)
|
||||
{
|
||||
|
@ -196,7 +180,7 @@ public:
|
|||
if((i >= 0 && i <= 60) || (i >= 300 && i <= 360)){
|
||||
// Scaling values
|
||||
float x = 200 + (rInstrument+25)*sin(i/180.0*pi); // x-coordinate dots
|
||||
float y = 150 - (rInstrument+25)*cos(i/180.0*pi); // y-coordinate cots
|
||||
float y = 150 - (rInstrument+25)*cos(i/180.0*pi); // y-coordinate cots
|
||||
const char *ii = "";
|
||||
switch (i)
|
||||
{
|
||||
|
@ -223,7 +207,7 @@ public:
|
|||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -236,10 +220,10 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +244,7 @@ public:
|
|||
float yy2 = -(rInstrument * 0.7);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -270,26 +254,26 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
|
||||
// Draw counterweight
|
||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, pixelcolor);
|
||||
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 22, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 20, pixelcolor); // Boat circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 22, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 20, commonData.fgcolor); // Boat circle
|
||||
int x0 = 200;
|
||||
int y0 = 150;
|
||||
int x1 = x0 + 50*cos(value1);
|
||||
int y1 = y0 + 50*sin(value1);
|
||||
int x2 = x0 + 50*cos(value1 - pi/2);
|
||||
int y2 = y0 + 50*sin(value1 - pi/2);
|
||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, bgcolor); // Clear half top side of boat circle (right triangle)
|
||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (right triangle)
|
||||
x1 = x0 + 50*cos(value1 + pi);
|
||||
y1 = y0 + 50*sin(value1 + pi);
|
||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, bgcolor); // Clear half top side of boat circle (left triangle)
|
||||
getdisplay().fillRect(150, 160, 100, 4, pixelcolor); // Water line
|
||||
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (left triangle)
|
||||
getdisplay().fillRect(150, 160, 100, 4, commonData.fgcolor); // Water line
|
||||
|
||||
// Draw roll pointer
|
||||
startwidth = 4; // Start width of pointer
|
||||
|
@ -304,7 +288,7 @@ public:
|
|||
float yy2 = -(rInstrument - 15);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -314,7 +298,7 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
else{
|
||||
// Print sensor info
|
||||
|
@ -325,7 +309,6 @@ public:
|
|||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -365,4 +348,4 @@ PageDescription registerPageRollPitch(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -74,20 +73,6 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
|
@ -97,9 +82,9 @@ public:
|
|||
int rInstrument = 110; // Radius of RudderPosition
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle
|
||||
|
||||
for(int i=90; i<=270; i=i+10)
|
||||
{
|
||||
|
@ -137,7 +122,7 @@ public:
|
|||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -150,16 +135,15 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Print label
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(80, 70);
|
||||
getdisplay().print("Rudder Position"); // Label
|
||||
|
@ -206,7 +190,7 @@ public:
|
|||
float yy2 = -(rInstrument * 0.5);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -216,16 +200,15 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -263,4 +246,4 @@ PageDescription registerPageRudderPosition(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,6 @@ public:
|
|||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String batVoltage = config->getString(config->batteryVoltage);
|
||||
|
@ -85,31 +84,17 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Clear display, set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Solar");
|
||||
|
||||
// Show voltage type
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
|
@ -120,7 +105,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show solar power
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(solPower <= 999) getdisplay().print(solPower, 0);
|
||||
|
@ -137,10 +121,9 @@ public:
|
|||
getdisplay().print("Solar Modul");
|
||||
|
||||
// Show solar panel
|
||||
solarGraphic(150, 45, pixelcolor, bgcolor);
|
||||
solarGraphic(150, 45, commonData.fgcolor, commonData.bgcolor);
|
||||
|
||||
// Show load level in percent
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(solPercentage);
|
||||
|
@ -168,7 +151,6 @@ public:
|
|||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
|
@ -197,7 +179,6 @@ public:
|
|||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -210,7 +191,6 @@ public:
|
|||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
|
@ -223,7 +203,6 @@ public:
|
|||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
@ -261,4 +240,4 @@ PageDescription registerPageSolar(
|
|||
true // Show display header on/off
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,6 @@ class PageThreeValues : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -80,33 +79,18 @@ class PageThreeValues : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
|
@ -145,18 +129,16 @@ class PageThreeValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
|
@ -195,18 +177,16 @@ class PageThreeValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
if(holdvalues == false){
|
||||
|
@ -246,7 +226,6 @@ class PageThreeValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -33,7 +33,6 @@ class PageTwoValues : public Page
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
// bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -69,33 +68,18 @@ class PageTwoValues : public Page
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 80);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 130);
|
||||
if(holdvalues == false){
|
||||
|
@ -134,18 +118,16 @@ class PageTwoValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
getdisplay().fillRect(0, 145, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 145, 400, 3, commonData.fgcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 190);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
|
@ -185,7 +167,6 @@ class PageTwoValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -45,7 +45,6 @@ public:
|
|||
|
||||
// Get config data
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String batVoltage = config->getString(config->batteryVoltage);
|
||||
|
@ -133,43 +132,26 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Clear display, set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
// Show name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(20, 100);
|
||||
getdisplay().print(name1); // Value name
|
||||
|
||||
// Show unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(270, 100);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show battery type
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(295, 100);
|
||||
getdisplay().print(batType);
|
||||
|
||||
// Show average settings
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(320, 84);
|
||||
switch (average) {
|
||||
|
@ -191,7 +173,6 @@ public:
|
|||
}
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(simulation == true){
|
||||
|
@ -226,23 +207,23 @@ public:
|
|||
// Trend indicator
|
||||
// Show trend indicator
|
||||
if(trend == true){
|
||||
getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
getdisplay().fillRect(315, 183, 35, 4, textcolor); // Draw separator
|
||||
getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area
|
||||
getdisplay().fillRect(315, 183, 35, 4, commonData.fgcolor); // Draw separator
|
||||
if(int(raw * 10) > int(valueTrend * 10)){
|
||||
displayTrendHigh(320, 174, 11, textcolor); // Show high indicator
|
||||
displayTrendHigh(320, 174, 11, commonData.fgcolor); // Show high indicator
|
||||
}
|
||||
if(int(raw * 10) < int(valueTrend * 10)){
|
||||
displayTrendLow(320, 195, 11, textcolor); // Show low indicator
|
||||
displayTrendLow(320, 195, 11, commonData.fgcolor); // Show low indicator
|
||||
}
|
||||
}
|
||||
// No trend indicator
|
||||
else{
|
||||
getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area
|
||||
}
|
||||
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(10, 290);
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -141,25 +140,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show values AWA
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print(svalue1); // Value
|
||||
|
@ -177,10 +163,9 @@ public:
|
|||
}
|
||||
|
||||
// Horizintal separator left
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
||||
|
||||
// Show values AWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 270);
|
||||
getdisplay().print(svalue2); // Value
|
||||
|
@ -198,7 +183,6 @@ public:
|
|||
}
|
||||
|
||||
// Show values TWD
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 65);
|
||||
if(valid3 == true){
|
||||
|
@ -221,10 +205,9 @@ public:
|
|||
}
|
||||
|
||||
// Horizintal separator right
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
||||
|
||||
// Show values TWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 270);
|
||||
getdisplay().print(svalue4); // Value
|
||||
|
@ -247,16 +230,16 @@ public:
|
|||
int rInstrument = 110; // Radius of grafic instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle
|
||||
|
||||
for(int i=0; i<360; i=i+10)
|
||||
{
|
||||
// Scaling values
|
||||
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||
const char *ii = "";
|
||||
switch (i)
|
||||
{
|
||||
|
@ -288,7 +271,7 @@ public:
|
|||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -301,10 +284,10 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +304,7 @@ public:
|
|||
float yy2 = -(rInstrument-15);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -331,17 +314,16 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
// Show values DBT
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 200);
|
||||
getdisplay().print(svalue5); // Value
|
||||
|
@ -356,7 +338,6 @@ public:
|
|||
}
|
||||
|
||||
// Show values STW
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 130);
|
||||
getdisplay().print(svalue6); // Value
|
||||
|
@ -371,7 +352,6 @@ public:
|
|||
}
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
// Get config data
|
||||
String lengthformat = config->getString(config->lengthFormat);
|
||||
bool simulation = config->getBool(config->useSimuData);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
bool holdvalues = config->getBool(config->holdvalues);
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
@ -141,25 +140,12 @@ public:
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// Show values AWA
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print(svalue1); // Value
|
||||
|
@ -177,10 +163,9 @@ public:
|
|||
}
|
||||
|
||||
// Horizintal separator left
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor);
|
||||
|
||||
// Show values AWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 270);
|
||||
getdisplay().print(svalue2); // Value
|
||||
|
@ -198,7 +183,6 @@ public:
|
|||
}
|
||||
|
||||
// Show values TWD
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 65);
|
||||
if(valid3 == true){
|
||||
|
@ -221,10 +205,9 @@ public:
|
|||
}
|
||||
|
||||
// Horizintal separator right
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor);
|
||||
|
||||
// Show values TWS
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 270);
|
||||
getdisplay().print(svalue4); // Value
|
||||
|
@ -247,16 +230,16 @@ public:
|
|||
int rInstrument = 110; // Radius of grafic instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle
|
||||
|
||||
for(int i=0; i<360; i=i+10)
|
||||
{
|
||||
// Scaling values
|
||||
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
|
||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
|
||||
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate dots
|
||||
const char *ii = "";
|
||||
switch (i)
|
||||
{
|
||||
|
@ -288,7 +271,7 @@ public:
|
|||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -301,10 +284,10 @@ public:
|
|||
float yy2 = -(rInstrument+10);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +304,7 @@ public:
|
|||
float yy2 = -(rInstrument-15);
|
||||
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor);
|
||||
// Inverted pointer
|
||||
// Pointer as triangle with center base 2*width
|
||||
float endwidth = 2; // End width of pointer
|
||||
|
@ -331,17 +314,16 @@ public:
|
|||
float iy2 = -endwidth;
|
||||
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
|
||||
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
// Show values DBT
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 200);
|
||||
getdisplay().print(svalue5); // Value
|
||||
|
@ -356,7 +338,6 @@ public:
|
|||
}
|
||||
|
||||
// Show values STW
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 130);
|
||||
getdisplay().print(svalue6); // Value
|
||||
|
@ -371,7 +352,6 @@ public:
|
|||
}
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
getdisplay().setCursor(130, 290);
|
||||
|
|
|
@ -65,7 +65,6 @@ class PageXTETrack : public Page{
|
|||
|
||||
// Get config data
|
||||
String flashLED = config->getString(config->flashLED);
|
||||
String displaycolor = config->getString(config->displaycolor);
|
||||
String backlightMode = config->getString(config->backlight);
|
||||
|
||||
String trackStep = config->getString(config->trackStep);
|
||||
|
@ -83,18 +82,11 @@ class PageXTETrack : public Page{
|
|||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
// Set background color and text color
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
if(displaycolor != "Normal"){
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
|
||||
// descriptions
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(50, 188);
|
||||
|
@ -141,7 +133,7 @@ class PageXTETrack : public Page{
|
|||
// XTETrack view
|
||||
|
||||
// draw ship symbol (as bitmap)
|
||||
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, pixelcolor);
|
||||
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData.fgcolor);
|
||||
|
||||
// draw next waypoint name
|
||||
String sval_wpname = "no data";
|
||||
|
@ -196,13 +188,13 @@ class PageXTETrack : public Page{
|
|||
}
|
||||
|
||||
// left segments
|
||||
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, pixelcolor, seg[2]);
|
||||
drawSegment(0, 100, 82, 24, 112, 24, 50, 100, pixelcolor, seg[1]);
|
||||
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, pixelcolor,seg[0]);
|
||||
drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData.fgcolor, seg[2]);
|
||||
drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData.fgcolor, seg[1]);
|
||||
drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData.fgcolor,seg[0]);
|
||||
// right segments
|
||||
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, pixelcolor, seg[3]);
|
||||
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, pixelcolor, seg[4]);
|
||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, pixelcolor, seg[5]);
|
||||
drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData.fgcolor, seg[3]);
|
||||
drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData.fgcolor, seg[4]);
|
||||
drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData.fgcolor, seg[5]);
|
||||
|
||||
// Key Layout
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
|
|
|
@ -68,6 +68,8 @@ typedef struct{
|
|||
SunData sundata;
|
||||
GwApi::BoatValue *time=NULL;
|
||||
GwApi::BoatValue *date=NULL;
|
||||
uint16_t fgcolor;
|
||||
uint16_t bgcolor;
|
||||
} CommonData;
|
||||
|
||||
//a base class that all pages must inherit from
|
||||
|
|
|
@ -249,12 +249,8 @@ void registerAllPages(PageList &list){
|
|||
}
|
||||
|
||||
// Undervoltage detection for shutdown display
|
||||
void underVoltageDetection(GwApi *api){
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
void underVoltageDetection(GwApi *api, CommonData &common){
|
||||
// Read settings
|
||||
String displaycolor = api->getConfig()->getConfigItem(api->getConfig()->displaycolor,true)->asString();
|
||||
float vslope = uint(api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asFloat());
|
||||
float voffset = uint(api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asFloat());
|
||||
// Read supplay voltage
|
||||
|
@ -267,17 +263,9 @@ void underVoltageDetection(GwApi *api){
|
|||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off
|
||||
// Shutdown EInk display
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear screen
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().fillScreen(common.bgcolor); // Clear screen
|
||||
getdisplay().setTextColor(common.fgcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(65, 150);
|
||||
getdisplay().print("Undervoltage");
|
||||
|
@ -300,6 +288,9 @@ void OBP60Task(GwApi *api){
|
|||
startLedTask(api);
|
||||
PageList allPages;
|
||||
registerAllPages(allPages);
|
||||
CommonData commonData;
|
||||
commonData.logger=logger;
|
||||
commonData.config=config;
|
||||
|
||||
tN2kMsg N2kMsg;
|
||||
|
||||
|
@ -311,14 +302,19 @@ void OBP60Task(GwApi *api){
|
|||
// Init E-Ink display
|
||||
String displaymode = api->getConfig()->getConfigItem(api->getConfig()->display,true)->asString();
|
||||
String displaycolor = api->getConfig()->getConfigItem(api->getConfig()->displaycolor,true)->asString();
|
||||
if (displaycolor == "Normal") {
|
||||
commonData.fgcolor = GxEPD_BLACK;
|
||||
commonData.bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
commonData.fgcolor = GxEPD_WHITE;
|
||||
commonData.bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
String systemname = api->getConfig()->getConfigItem(api->getConfig()->systemName,true)->asString();
|
||||
String wifipass = api->getConfig()->getConfigItem(api->getConfig()->apPassword,true)->asString();
|
||||
bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean();
|
||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
|
||||
int textcolor = GxEPD_BLACK;
|
||||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
|
||||
#ifdef DISPLAY_GDEY042T81
|
||||
getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
|
||||
|
@ -327,39 +323,29 @@ void OBP60Task(GwApi *api){
|
|||
#endif
|
||||
|
||||
getdisplay().setRotation(0); // Set display orientation (horizontal)
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
bgcolor = GxEPD_WHITE;
|
||||
}
|
||||
else{
|
||||
textcolor = GxEPD_WHITE;
|
||||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
getdisplay().setFullWindow(); // Set full Refresh
|
||||
getdisplay().firstPage(); // set first page
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().setTextColor(textcolor); // Set display color
|
||||
getdisplay().fillScreen(commonData.bgcolor);
|
||||
getdisplay().setTextColor(commonData.fgcolor);
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().fillScreen(commonData.bgcolor);
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), pixelcolor); // Draw start logo
|
||||
getdisplay().fillScreen(commonData.bgcolor);
|
||||
getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData.fgcolor); // Draw start logo
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
delay(SHOW_TIME); // Logo show time
|
||||
if(String(displaymode) == "Logo + QR Code"){
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection
|
||||
getdisplay().fillScreen(commonData.bgcolor);
|
||||
qrWiFi(systemname, wifipass, commonData.fgcolor, commonData.bgcolor); // Show QR code for WiFi connection
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
delay(SHOW_TIME); // QR code show time
|
||||
}
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().fillScreen(commonData.bgcolor);
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
getdisplay().nextPage(); // Fast Refresh
|
||||
}
|
||||
|
@ -367,9 +353,6 @@ void OBP60Task(GwApi *api){
|
|||
// Init pages
|
||||
int numPages=1;
|
||||
PageStruct pages[MAX_PAGE_NUMBER];
|
||||
CommonData commonData;
|
||||
commonData.logger=logger;
|
||||
commonData.config=config;
|
||||
BoatValueList boatValues; //all the boat values for the api query
|
||||
//commonData.distanceformat=config->getString(xxx);
|
||||
//add all necessary data to common data
|
||||
|
@ -439,10 +422,6 @@ void OBP60Task(GwApi *api){
|
|||
uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt());
|
||||
|
||||
// refreshmode defined in init section
|
||||
// displaycolor defined in init section
|
||||
// textcolor defined in init section
|
||||
// pixelcolor defined in init section
|
||||
// bgcolor defined in init section
|
||||
|
||||
// Boat values for main loop
|
||||
GwApi::BoatValue *date = boatValues.findValueOrCreate("GPSD"); // Load GpsDate
|
||||
|
@ -477,7 +456,7 @@ void OBP60Task(GwApi *api){
|
|||
|
||||
// Undervoltage detection
|
||||
if(uvoltage == true){
|
||||
underVoltageDetection(api);
|
||||
underVoltageDetection(api, commonData);
|
||||
}
|
||||
|
||||
// Set CPU speed after boot after 1min
|
||||
|
@ -587,10 +566,10 @@ void OBP60Task(GwApi *api){
|
|||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage();
|
||||
if(fastrefresh == "false"){
|
||||
getdisplay().fillScreen(pixelcolor);// Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.fgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
}
|
||||
delayedDisplayUpdate = false;
|
||||
}
|
||||
|
@ -604,10 +583,10 @@ void OBP60Task(GwApi *api){
|
|||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage();
|
||||
if(fastrefresh == "false"){
|
||||
getdisplay().fillScreen(pixelcolor);// Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.fgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,10 +597,10 @@ void OBP60Task(GwApi *api){
|
|||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage();
|
||||
if(fastrefresh == "false"){
|
||||
getdisplay().fillScreen(pixelcolor);// Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.fgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
||||
getdisplay().nextPage(); // Full update
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,10 +612,10 @@ void OBP60Task(GwApi *api){
|
|||
api->getStatus(commonData.status);
|
||||
|
||||
// Show header if enabled
|
||||
getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), bgcolor); // Clear display
|
||||
getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor); // Clear display
|
||||
if (pages[pageNumber].description && pages[pageNumber].description->header){
|
||||
//build some header and footer using commonData
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
||||
displayHeader(commonData, date, time, hdop); // Sown header
|
||||
}
|
||||
|
||||
|
@ -662,4 +641,4 @@ void OBP60Task(GwApi *api){
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue