First version with GxEPD2 Lib
This commit is contained in:
parent
c1d6a566aa
commit
8c73a8739f
|
@ -22,9 +22,13 @@
|
|||
#include "DSEG7Classic-BoldItalic42pt7b.h"
|
||||
#include "DSEG7Classic-BoldItalic60pt7b.h"
|
||||
|
||||
// SPI pin definitions for E-Ink display
|
||||
GxIO_Class io(SPI, OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST); // SPI, CS, DC, RST
|
||||
GxEPD_Class display(io, OBP_SPI_RST, OBP_SPI_BUSY); // io, RST, BUSY
|
||||
// E-Ink Display
|
||||
#define GxEPD_WIDTH 400 // Display width
|
||||
#define GxEPD_HEIGHT 300 // Display height
|
||||
// Set display type and SPI pins for display
|
||||
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398)
|
||||
// Export display in new funktion
|
||||
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay(){return display;}
|
||||
|
||||
// Horter I2C moduls
|
||||
PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 from Horter
|
||||
|
@ -48,6 +52,10 @@ void hardwareInit()
|
|||
// Init power rail 5.0V
|
||||
setPortPin(OBP_POWER_50, true);
|
||||
|
||||
// Init E-Ink display
|
||||
//display.init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
|
||||
|
||||
|
||||
// Init RGB LEDs
|
||||
FastLED.addLeds<WS2812B, OBP_FLASH_LED, GRB>(fled, NUM_FLASH_LED);
|
||||
FastLED.addLeds<WS2812B, OBP_BACKLIGHT_LED, GRB>(backlight, NUM_BACKLIGHT_LED);
|
||||
|
|
|
@ -4,12 +4,7 @@
|
|||
#include <Arduino.h>
|
||||
#include "OBP60Hardware.h"
|
||||
#include <FastLED.h> // Driver for WS2812 RGB LED
|
||||
#include <GxGDEW042T2/GxGDEW042T2.h> // 4.2" Waveshare S/W 300 x 400 pixel
|
||||
#include <GxIO/GxIO_SPI/GxIO_SPI.h> // GxEPD lip for SPI display communikation
|
||||
#include <GxIO/GxIO.h> // GxEPD lip for SPI
|
||||
|
||||
// E-Ink display
|
||||
extern GxEPD_Class display; // E-Ink display functions
|
||||
#include <GxEPD2_BW.h> // E-paper lib V2
|
||||
|
||||
// Fonts declarations for display (#inclues see OBP60Extensions.cpp)
|
||||
extern const GFXfont Ubuntu_Bold8pt7b;
|
||||
|
@ -24,6 +19,8 @@ extern const GFXfont DSEG7Classic_BoldItalic42pt7b;
|
|||
extern const GFXfont DSEG7Classic_BoldItalic60pt7b;
|
||||
|
||||
// Gloabl functions
|
||||
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay();
|
||||
|
||||
void hardwareInit();
|
||||
|
||||
void setPortPin(uint pin, bool value); // Set port pin for extension port
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _OBP60QRWIFI_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "OBP60Extensions.h"
|
||||
#include "qrcode.h"
|
||||
|
||||
void qrWiFi(String ssid, String passwd, String displaycolor){
|
||||
|
@ -39,20 +40,20 @@ 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)){
|
||||
display.fillRect(box_x, box_y, box_s, box_s, pixelcolor);
|
||||
getdisplay().fillRect(box_x, box_y, box_s, box_s, pixelcolor);
|
||||
} else {
|
||||
display.fillRect(box_x, box_y, box_s, box_s, bgcolor);
|
||||
getdisplay().fillRect(box_x, box_y, box_s, box_s, bgcolor);
|
||||
}
|
||||
box_x = box_x + box_s;
|
||||
}
|
||||
box_y = box_y + box_s;
|
||||
box_x = init_x;
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
display.setTextColor(textcolor);
|
||||
display.setCursor(140, 285);
|
||||
display.print("WiFi");
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setCursor(140, 285);
|
||||
getdisplay().print("WiFi");
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
}
|
||||
|
||||
#endif
|
|
@ -40,9 +40,13 @@ void underVoltageDetection(){
|
|||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off
|
||||
// Shutdown EInk display
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_WHITE); // Draw white sreen
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false); // Partial update
|
||||
display.update();
|
||||
/*
|
||||
display.setPartialWindow(0, 0, display.width(), display.height()); // Set partial update
|
||||
display.fillScreen(GxEPD_WHITE); // Draw white sreen
|
||||
display.nextPage(); // Partial update
|
||||
display.powerOff(); // Power off
|
||||
*/
|
||||
|
||||
// Stop system
|
||||
while(true){
|
||||
esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart).
|
||||
|
|
|
@ -104,44 +104,46 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values AWS
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 50);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 50);
|
||||
if(holdvalues == false){
|
||||
display.print(name1); // Value name
|
||||
display.print(": ");
|
||||
display.print(svalue1); // Value
|
||||
display.print(" ");
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(name1); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue1); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(name1); // Value name
|
||||
display.print(": ");
|
||||
display.print(svalue1old); // Value old
|
||||
display.print(" ");
|
||||
display.print(unit1old); // Unit old
|
||||
getdisplay().print(name1); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue1old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit1old); // Unit old
|
||||
}
|
||||
|
||||
// Show values AWD
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 260);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 260);
|
||||
if(holdvalues == false){
|
||||
display.print(name2); // Value name
|
||||
display.print(": ");
|
||||
display.print(svalue2); // Value
|
||||
display.print(" ");
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(name2); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue2); // Value
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(name2); // Value name
|
||||
display.print(": ");
|
||||
display.print(svalue2old); // Value old
|
||||
display.print(" ");
|
||||
display.print(unit2old); // Unit old
|
||||
getdisplay().print(name2); // Value name
|
||||
getdisplay().print(": ");
|
||||
getdisplay().print(svalue2old); // Value old
|
||||
getdisplay().print(" ");
|
||||
getdisplay().print(unit2old); // Unit old
|
||||
}
|
||||
|
||||
// Draw wind pointer
|
||||
|
@ -153,8 +155,8 @@ public:
|
|||
static int16_t y2 = y0;
|
||||
|
||||
//Draw instrument
|
||||
display.fillCircle(x0, y0, lp + 5, pixelcolor); // Black circle
|
||||
display.fillCircle(x0, y0, lp + 1, bgcolor); // White circle
|
||||
getdisplay().fillCircle(x0, y0, lp + 5, pixelcolor); // Black circle
|
||||
getdisplay().fillCircle(x0, y0, lp + 1, bgcolor); // White circle
|
||||
|
||||
// Calculation end point of pointer
|
||||
value2 = value2 - 3.14 / 2;
|
||||
|
@ -162,26 +164,26 @@ public:
|
|||
y1 = y0 + sin(value2) * lp * 0.6;
|
||||
x2 = x0 + cos(value2) * lp;
|
||||
y2 = y0 + sin(value2) * lp;
|
||||
display.drawLine(x1, y1, x2, y2, pixelcolor);
|
||||
getdisplay().drawLine(x1, y1, x2, y2, pixelcolor);
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -108,109 +108,114 @@ class PageBME280 : public 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;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 55);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 90);
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
getdisplay().print(unit1); // Unit
|
||||
|
||||
// Switch font if format for any values
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 90);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
|
||||
// Show bus data
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 145);
|
||||
display.print(name2); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 180);
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
getdisplay().print(unit2); // Unit
|
||||
|
||||
// Switch font if format for any values
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 180);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
|
||||
// Show bus data
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 235);
|
||||
display.print(name3); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 270);
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
getdisplay().print(unit3); // Unit
|
||||
|
||||
// Switch font if format for any values
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 270);
|
||||
|
||||
// Show bus data
|
||||
display.print(svalue3); // Real value as formated string
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
|
||||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -167,165 +167,167 @@ class PageBattery : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show average settings
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
switch (average) {
|
||||
case 0:
|
||||
display.setCursor(60, 90);
|
||||
display.print("Avg: 1s");
|
||||
display.setCursor(60, 180);
|
||||
display.print("Avg: 1s");
|
||||
display.setCursor(60, 270);
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 90);
|
||||
getdisplay().print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 180);
|
||||
getdisplay().print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 270);
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
case 1:
|
||||
display.setCursor(60, 90);
|
||||
display.print("Avg: 10s");
|
||||
display.setCursor(60, 180);
|
||||
display.print("Avg: 10s");
|
||||
display.setCursor(60, 270);
|
||||
display.print("Avg: 10s");
|
||||
getdisplay().setCursor(60, 90);
|
||||
getdisplay().print("Avg: 10s");
|
||||
getdisplay().setCursor(60, 180);
|
||||
getdisplay().print("Avg: 10s");
|
||||
getdisplay().setCursor(60, 270);
|
||||
getdisplay().print("Avg: 10s");
|
||||
break;
|
||||
case 2:
|
||||
display.setCursor(60, 90);
|
||||
display.print("Avg: 60s");
|
||||
display.setCursor(60, 180);
|
||||
display.print("Avg: 60s");
|
||||
display.setCursor(60, 270);
|
||||
display.print("Avg: 60s");
|
||||
getdisplay().setCursor(60, 90);
|
||||
getdisplay().print("Avg: 60s");
|
||||
getdisplay().setCursor(60, 180);
|
||||
getdisplay().print("Avg: 60s");
|
||||
getdisplay().setCursor(60, 270);
|
||||
getdisplay().print("Avg: 60s");
|
||||
break;
|
||||
case 3:
|
||||
display.setCursor(60, 90);
|
||||
display.print("Avg: 300s");
|
||||
display.setCursor(60, 180);
|
||||
display.print("Avg: 300s");
|
||||
display.setCursor(60, 270);
|
||||
display.print("Avg: 300s");
|
||||
getdisplay().setCursor(60, 90);
|
||||
getdisplay().print("Avg: 300s");
|
||||
getdisplay().setCursor(60, 180);
|
||||
getdisplay().print("Avg: 300s");
|
||||
getdisplay().setCursor(60, 270);
|
||||
getdisplay().print("Avg: 300s");
|
||||
break;
|
||||
default:
|
||||
display.setCursor(60, 90);
|
||||
display.print("Avg: 1s");
|
||||
display.setCursor(60, 180);
|
||||
display.print("Avg: 1s");
|
||||
display.setCursor(60, 270);
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 90);
|
||||
getdisplay().print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 180);
|
||||
getdisplay().print("Avg: 1s");
|
||||
getdisplay().setCursor(60, 270);
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
}
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 55);
|
||||
display.print(name1); // Value name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Value name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 90);
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
getdisplay().print(unit1); // Unit
|
||||
|
||||
// Show value
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 90);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
|
||||
// Show bus data
|
||||
if(String(powsensor1) != "off"){
|
||||
display.print(value1,2); // Real value as formated string
|
||||
getdisplay().print(value1,2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print("---"); // No sensor data (sensor is off)
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 145);
|
||||
display.print(name2); // Value name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Value name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 180);
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
getdisplay().print(unit2); // Unit
|
||||
|
||||
// Show value
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 180);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
|
||||
// Show bus data
|
||||
if(String(powsensor1) != "off"){
|
||||
display.print(value2,1); // Real value as formated string
|
||||
getdisplay().print(value2,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print("---"); // No sensor data (sensor is off)
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 235);
|
||||
display.print(name3); // Value name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Value name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 270);
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
getdisplay().print(unit3); // Unit
|
||||
|
||||
// Show value
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 270);
|
||||
|
||||
// Show bus data
|
||||
if(String(powsensor1) != "off"){
|
||||
display.print(value3,1); // Real value as formated string
|
||||
getdisplay().print(value3,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print("---"); // No sensor data (sensor is off)
|
||||
getdisplay().print("---"); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
|
||||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(10, 290);
|
||||
display.print("[AVG]");
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(10, 290);
|
||||
getdisplay().print("[AVG]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -193,113 +193,115 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print("Bat.");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Bat.");
|
||||
|
||||
// Show batery type
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(90, 65);
|
||||
display.print(batType);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(90, 65);
|
||||
getdisplay().print(batType);
|
||||
|
||||
// Show voltage type
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
if(String(batVoltage) == "12V") bvoltage = 12;
|
||||
else bvoltage = 24;
|
||||
display.print(bvoltage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().print(bvoltage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show batery capacity
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 200);
|
||||
if(batCapacity <= 999) display.print(batCapacity, 0);
|
||||
if(batCapacity > 999) display.print(float(batCapacity/1000.0), 1);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
if(batCapacity <= 999) display.print("Ah");
|
||||
if(batCapacity > 999) display.print("kAh");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(batCapacity <= 999) getdisplay().print(batCapacity, 0);
|
||||
if(batCapacity > 999) getdisplay().print(float(batCapacity/1000.0), 1);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
if(batCapacity <= 999) getdisplay().print("Ah");
|
||||
if(batCapacity > 999) getdisplay().print("kAh");
|
||||
|
||||
// Show info
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 235);
|
||||
display.print("Installed");
|
||||
display.setCursor(10, 255);
|
||||
display.print("Battery Type");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 235);
|
||||
getdisplay().print("Installed");
|
||||
getdisplay().setCursor(10, 255);
|
||||
getdisplay().print("Battery Type");
|
||||
|
||||
// Show battery with fill level
|
||||
batteryGraphic(150, 45, batPercentage, pixelcolor, bgcolor);
|
||||
|
||||
// Show average settings
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(150, 145);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(150, 145);
|
||||
switch (average) {
|
||||
case 0:
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
case 1:
|
||||
display.print("Avg: 10s");
|
||||
getdisplay().print("Avg: 10s");
|
||||
break;
|
||||
case 2:
|
||||
display.print("Avg: 60s");
|
||||
getdisplay().print("Avg: 60s");
|
||||
break;
|
||||
case 3:
|
||||
display.print("Avg: 300s");
|
||||
getdisplay().print("Avg: 300s");
|
||||
break;
|
||||
default:
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
}
|
||||
|
||||
// Show fill level in percent
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(150, 200);
|
||||
display.print(batPercentage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("%");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(batPercentage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("%");
|
||||
|
||||
// Show time to full discharge
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(150, 260);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(batRange < 9.9) display.print(batRange, 1);
|
||||
else display.print(batRange, 0);
|
||||
if(batRange < 9.9) getdisplay().print(batRange, 1);
|
||||
else getdisplay().print(batRange, 0);
|
||||
}
|
||||
else display.print("--");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("h");
|
||||
else getdisplay().print("--");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("h");
|
||||
|
||||
// Show sensor type info
|
||||
String i2cAddr = "";
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(270, 60);
|
||||
if(powerSensor == "off") display.print("Internal");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(270, 60);
|
||||
if(powerSensor == "off") getdisplay().print("Internal");
|
||||
if(powerSensor == "INA219"){
|
||||
display.print("INA219");
|
||||
getdisplay().print("INA219");
|
||||
}
|
||||
if(powerSensor == "INA226"){
|
||||
display.print("INA226");
|
||||
getdisplay().print("INA226");
|
||||
i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")";
|
||||
}
|
||||
display.print(i2cAddr);
|
||||
display.setCursor(270, 80);
|
||||
display.print("Sensor Modul");
|
||||
getdisplay().print(i2cAddr);
|
||||
getdisplay().setCursor(270, 80);
|
||||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
if(batVoltage == "12V"){
|
||||
value1 = 12.0;
|
||||
|
@ -308,69 +310,69 @@ public:
|
|||
value1 = 24.0;
|
||||
}
|
||||
value1 += float(random(0, 5)) / 10; // Simulation data
|
||||
display.print(value1,1);
|
||||
getdisplay().print(value1,1);
|
||||
}
|
||||
else{
|
||||
// Check for valid real data, display also if hold values activated
|
||||
if(valid1 == true || holdvalues == true){
|
||||
// Resolution switching
|
||||
if(value1 <= 9.9) display.print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1);
|
||||
if(value1 > 99.9) display.print(value1, 0);
|
||||
if(value1 <= 9.9) getdisplay().print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
|
||||
if(value1 > 99.9) getdisplay().print(value1, 0);
|
||||
}
|
||||
else{
|
||||
display.print("---"); // Missing bus data
|
||||
getdisplay().print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 200);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value2 <= 9.9) display.print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1);
|
||||
if(value2 > 99.9) display.print(value2, 0);
|
||||
if(value2 <= 9.9) getdisplay().print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
|
||||
if(value2 > 99.9) getdisplay().print(value2, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("A");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 260);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value3 <= 9.9) display.print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1);
|
||||
if(value3 > 99.9) display.print(value3, 0);
|
||||
if(value3 <= 9.9) getdisplay().print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
|
||||
if(value3 > 99.9) getdisplay().print(value3, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("W");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(10, 290);
|
||||
display.print("[AVG]");
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(10, 290);
|
||||
getdisplay().print("[AVG]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -105,30 +105,32 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values GPS date
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 65);
|
||||
if(holdvalues == false) display.print(svalue2); // Value
|
||||
else display.print(svalue2old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print("Date"); // Name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
if(holdvalues == false) getdisplay().print(svalue2); // Value
|
||||
else getdisplay().print(svalue2old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 95);
|
||||
getdisplay().print("Date"); // Name
|
||||
|
||||
// Horizintal separator left
|
||||
display.fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
||||
// Show values GPS time
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 250);
|
||||
if(holdvalues == false) display.print(svalue1); // Value
|
||||
else display.print(svalue1old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print("Time"); // Name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 250);
|
||||
if(holdvalues == false) getdisplay().print(svalue1); // Value
|
||||
else getdisplay().print(svalue1old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 220);
|
||||
getdisplay().print("Time"); // Name
|
||||
|
||||
// Show values sunrise
|
||||
String sunrise = "---";
|
||||
|
@ -137,17 +139,17 @@ public:
|
|||
svalue3old = sunrise;
|
||||
}
|
||||
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 65);
|
||||
if(holdvalues == false) display.print(sunrise); // Value
|
||||
else display.print(svalue3old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print("SunR"); // Name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 65);
|
||||
if(holdvalues == false) getdisplay().print(sunrise); // Value
|
||||
else getdisplay().print(svalue3old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(335, 95);
|
||||
getdisplay().print("SunR"); // Name
|
||||
|
||||
// Horizintal separator right
|
||||
display.fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
|
||||
// Show values sunset
|
||||
String sunset = "---";
|
||||
|
@ -156,14 +158,14 @@ public:
|
|||
svalue4old = sunset;
|
||||
}
|
||||
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 250);
|
||||
if(holdvalues == false) display.print(sunset); // Value
|
||||
else display.print(svalue4old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print("SunS"); // Name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 250);
|
||||
if(holdvalues == false) getdisplay().print(sunset); // Value
|
||||
else getdisplay().print(svalue4old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(335, 220);
|
||||
getdisplay().print("SunS"); // Name
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
|
@ -171,8 +173,8 @@ public:
|
|||
int rInstrument = 110; // Radius of clock
|
||||
float pi = 3.141592;
|
||||
|
||||
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
|
||||
for(int i=0; i<360; i=i+1)
|
||||
{
|
||||
|
@ -200,11 +202,11 @@ public:
|
|||
// Print text centered on position x, y
|
||||
int16_t x1, y1; // Return values of getTextBounds
|
||||
uint16_t w, h; // Return values of getTextBounds
|
||||
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
display.setCursor(x-w/2, y+h/2);
|
||||
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
getdisplay().setCursor(x-w/2, y+h/2);
|
||||
if(i % 30 == 0){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.print(ii);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().print(ii);
|
||||
}
|
||||
|
||||
// Draw sub scale with dots
|
||||
|
@ -213,7 +215,7 @@ public:
|
|||
if(i % 6 == 0){
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
sinx=sin(i/180.0*pi);
|
||||
cosx=cos(i/180.0*pi);
|
||||
}
|
||||
|
@ -225,26 +227,26 @@ public:
|
|||
float xx2 = +dx;
|
||||
float yy1 = -(rInstrument-10);
|
||||
float yy2 = -(rInstrument+10);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Print Unit in clock
|
||||
display.setTextColor(textcolor);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
if(holdvalues == false){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit2old); // Unit
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit2old); // Unit
|
||||
}
|
||||
|
||||
// Clock values
|
||||
|
@ -270,7 +272,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument * 0.5);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -280,7 +282,7 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument * 0.5);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
}
|
||||
|
@ -296,7 +298,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument - 15);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -306,34 +308,34 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument - 15);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -105,37 +105,39 @@ class PageDST810 : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 55);
|
||||
display.print("Depth"); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print("Depth"); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 90);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Set font
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 90);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -145,37 +147,37 @@ class PageDST810 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 145);
|
||||
display.print("Speed"); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print("Speed"); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 180);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old);
|
||||
getdisplay().print(unit2old);
|
||||
}
|
||||
|
||||
// Setfont
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 180);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue2old); // Old value as formated string
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
|
@ -185,37 +187,37 @@ class PageDST810 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 220);
|
||||
display.print("Log"); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 220);
|
||||
getdisplay().print("Log"); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old);
|
||||
getdisplay().print(unit3old);
|
||||
}
|
||||
|
||||
// Set font
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(80, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(80, 270);
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue3); // Real value as formated string
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue3old); // Old value as formated string
|
||||
getdisplay().print(svalue3old); // Old value as formated string
|
||||
}
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save the old value
|
||||
|
@ -225,37 +227,37 @@ class PageDST810 : public Page
|
|||
// ############### Vertical Line ################
|
||||
|
||||
// Vertical line 3 pix
|
||||
display.fillRect(200, 195, 3, 75, pixelcolor);
|
||||
getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(220, 220);
|
||||
display.print("Temp"); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(220, 220);
|
||||
getdisplay().print("Temp"); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(220, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 240);
|
||||
if(holdvalues == false){
|
||||
display.print(unit4); // Unit
|
||||
getdisplay().print(unit4); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit4old);
|
||||
getdisplay().print(unit4old);
|
||||
}
|
||||
|
||||
// Set font
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(280, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(280, 270);
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue4); // Real value as formated string
|
||||
getdisplay().print(svalue4); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue4old); // Old value as formated string
|
||||
getdisplay().print(svalue4old); // Old value as formated string
|
||||
}
|
||||
if(valid4 == true){
|
||||
svalue4old = svalue4; // Save the old value
|
||||
|
@ -266,23 +268,23 @@ class PageDST810 : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -105,47 +105,49 @@ class PageFourValues : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(20, 45);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 45);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 65);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 65);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(120, 55);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(120, 55);
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(150, 58);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(150, 58);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(180, 65);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(180, 65);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -155,47 +157,47 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 80, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 80, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(20, 113);
|
||||
display.print(name2); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 113);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 133);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 133);
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old);
|
||||
getdisplay().print(unit2old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(120, 123);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(120, 123);
|
||||
}
|
||||
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(150, 123);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(150, 123);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(180, 133);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(180, 133);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue2old); // Old value as formated string
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
|
@ -205,47 +207,47 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 146, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 146, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(20, 181);
|
||||
display.print(name3); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 181);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 201);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 201);
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old);
|
||||
getdisplay().print(unit3old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(120, 191);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(120, 191);
|
||||
}
|
||||
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(150, 191);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(150, 191);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(180, 201);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(180, 201);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue3); // Real value as formated string
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue3old); // Old value as formated string
|
||||
getdisplay().print(svalue3old); // Old value as formated string
|
||||
}
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save the old value
|
||||
|
@ -255,47 +257,47 @@ class PageFourValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 214, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 214, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(20, 249);
|
||||
display.print(name4); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(20, 249);
|
||||
getdisplay().print(name4); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 269);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 269);
|
||||
if(holdvalues == false){
|
||||
display.print(unit4); // Unit
|
||||
getdisplay().print(unit4); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit4old);
|
||||
getdisplay().print(unit4old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(120, 259);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(120, 259);
|
||||
}
|
||||
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(150, 259);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(150, 259);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(180, 269);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(180, 269);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue4); // Real value as formated string
|
||||
getdisplay().print(svalue4); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue4old); // Old value as formated string
|
||||
getdisplay().print(svalue4old); // Old value as formated string
|
||||
}
|
||||
if(valid4 == true){
|
||||
svalue4old = svalue4; // Save the old value
|
||||
|
@ -306,23 +308,23 @@ class PageFourValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -105,47 +105,49 @@ class PageFourValues2 : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 55);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 90);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(100, 90);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(100, 90);
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(180, 77);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(180, 77);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 90);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -155,47 +157,47 @@ class PageFourValues2 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 145);
|
||||
display.print(name2); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 180);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old);
|
||||
getdisplay().print(unit2old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(100, 180);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(100, 180);
|
||||
}
|
||||
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(180, 158);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(180, 158);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 180);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue2old); // Old value as formated string
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
|
@ -205,47 +207,47 @@ class PageFourValues2 : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 220);
|
||||
display.print(name3); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 220);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(20, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old);
|
||||
getdisplay().print(unit3old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(50, 240);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(50, 240);
|
||||
}
|
||||
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(100, 240);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(100, 240);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(80, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(80, 270);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue3); // Real value as formated string
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue3old); // Old value as formated string
|
||||
getdisplay().print(svalue3old); // Old value as formated string
|
||||
}
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save the old value
|
||||
|
@ -255,47 +257,47 @@ class PageFourValues2 : public Page
|
|||
// ############### Vertical Line ################
|
||||
|
||||
// Vertical line 3 pix
|
||||
display.fillRect(200, 195, 3, 75, pixelcolor);
|
||||
getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
|
||||
|
||||
// ############### Value 4 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(220, 220);
|
||||
display.print(name4); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(220, 220);
|
||||
getdisplay().print(name4); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(220, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(220, 240);
|
||||
if(holdvalues == false){
|
||||
display.print(unit4); // Unit
|
||||
getdisplay().print(unit4); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit4old);
|
||||
getdisplay().print(unit4old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(250, 240);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(250, 240);
|
||||
}
|
||||
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(300, 240);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(300, 240);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(280, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(280, 270);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue4); // Real value as formated string
|
||||
getdisplay().print(svalue4); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue4old); // Old value as formated string
|
||||
getdisplay().print(svalue4old); // Old value as formated string
|
||||
}
|
||||
if(valid4 == true){
|
||||
svalue4old = svalue4; // Save the old value
|
||||
|
@ -306,23 +308,23 @@ class PageFourValues2 : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -81,79 +81,81 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display in obp60task.cpp in main loop
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print("Gen.");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Gen.");
|
||||
|
||||
// Show voltage type
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
if(String(batVoltage) == "12V") bvoltage = 12;
|
||||
else bvoltage = 24;
|
||||
display.print(bvoltage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().print(bvoltage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show generator power level
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 200);
|
||||
if(generatorMaxPower <= 999) display.print(generatorMaxPower, 0);
|
||||
if(generatorMaxPower > 999) display.print(float(generatorMaxPower/1000.0), 1);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
if(generatorMaxPower <= 999) display.print("W");
|
||||
if(generatorMaxPower > 999) display.print("kw");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(generatorMaxPower <= 999) getdisplay().print(generatorMaxPower, 0);
|
||||
if(generatorMaxPower > 999) getdisplay().print(float(generatorMaxPower/1000.0), 1);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
if(generatorMaxPower <= 999) getdisplay().print("W");
|
||||
if(generatorMaxPower > 999) getdisplay().print("kw");
|
||||
|
||||
// Show info
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 235);
|
||||
display.print("Installed");
|
||||
display.setCursor(10, 255);
|
||||
display.print("Type");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 235);
|
||||
getdisplay().print("Installed");
|
||||
getdisplay().setCursor(10, 255);
|
||||
getdisplay().print("Type");
|
||||
|
||||
// Show generator icon
|
||||
batteryGraphic(150, 45, genPercentage, pixelcolor, bgcolor);
|
||||
|
||||
// Show average settings
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(150, 145);
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(150, 145);
|
||||
getdisplay().print("Avg: 1s");
|
||||
|
||||
// Show power level in percent
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(150, 200);
|
||||
display.print(genPercentage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("%");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(genPercentage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("%");
|
||||
|
||||
// Show sensor type info
|
||||
String i2cAddr = "";
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(270, 60);
|
||||
if(powerSensor == "off") display.print("Internal");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(270, 60);
|
||||
if(powerSensor == "off") getdisplay().print("Internal");
|
||||
if(powerSensor == "INA219"){
|
||||
display.print("INA219");
|
||||
getdisplay().print("INA219");
|
||||
}
|
||||
if(powerSensor == "INA226"){
|
||||
display.print("INA226");
|
||||
getdisplay().print("INA226");
|
||||
i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")";
|
||||
}
|
||||
display.print(i2cAddr);
|
||||
display.setCursor(270, 80);
|
||||
display.print("Sensor Modul");
|
||||
getdisplay().print(i2cAddr);
|
||||
getdisplay().setCursor(270, 80);
|
||||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
if(batVoltage == "12V"){
|
||||
value1 = 12.0;
|
||||
|
@ -162,67 +164,67 @@ public:
|
|||
value1 = 24.0;
|
||||
}
|
||||
value1 += float(random(0, 5)) / 10; // Simulation data
|
||||
display.print(value1,1);
|
||||
getdisplay().print(value1,1);
|
||||
}
|
||||
else{
|
||||
// Check for valid real data, display also if hold values activated
|
||||
if(valid1 == true || holdvalues == true){
|
||||
// Resolution switching
|
||||
if(value1 <= 9.9) display.print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1);
|
||||
if(value1 > 99.9) display.print(value1, 0);
|
||||
if(value1 <= 9.9) getdisplay().print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
|
||||
if(value1 > 99.9) getdisplay().print(value1, 0);
|
||||
}
|
||||
else{
|
||||
display.print("---"); // Missing bus data
|
||||
getdisplay().print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 200);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value2 <= 9.9) display.print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1);
|
||||
if(value2 > 99.9) display.print(value2, 0);
|
||||
if(value2 <= 9.9) getdisplay().print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
|
||||
if(value2 > 99.9) getdisplay().print(value2, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("A");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 260);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value3 <= 9.9) display.print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1);
|
||||
if(value3 > 99.9) display.print(value3, 0);
|
||||
if(value3 <= 9.9) getdisplay().print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
|
||||
if(value3 > 99.9) getdisplay().print(value3, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("W");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -83,7 +83,9 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
|
||||
//*******************************************************************************************
|
||||
|
@ -92,9 +94,9 @@ public:
|
|||
int rInstrument = 110; // Radius of KeelPosition
|
||||
float pi = 3.141592;
|
||||
|
||||
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||
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
|
||||
|
||||
for(int i=90; i<=270; i=i+10)
|
||||
{
|
||||
|
@ -122,17 +124,17 @@ public:
|
|||
// Print text centered on position x, y
|
||||
int16_t x1, y1; // Return values of getTextBounds
|
||||
uint16_t w, h; // Return values of getTextBounds
|
||||
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
display.setCursor(x-w/2, y+h/2);
|
||||
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
getdisplay().setCursor(x-w/2, y+h/2);
|
||||
if(i % 30 == 0){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.print(ii);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().print(ii);
|
||||
}
|
||||
|
||||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -143,10 +145,10 @@ public:
|
|||
float xx2 = +dx;
|
||||
float yy1 = -(rInstrument-10);
|
||||
float yy2 = -(rInstrument+10);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
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);
|
||||
}
|
||||
|
@ -180,7 +182,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument * 0.6);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -190,58 +192,58 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument * 0.6);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
|
||||
// Draw counterweight
|
||||
display.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, pixelcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 140, startwidth + 22, bgcolor);
|
||||
display.fillCircle(200, 140, startwidth + 20, pixelcolor); // Boat circle
|
||||
display.fillRect(200 - 30, 140 - 30, 2 * 30, 30, bgcolor); // Delete half top of boat circle
|
||||
display.fillRect(150, 150, 100, 4, pixelcolor); // Water line
|
||||
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
|
||||
|
||||
// Print label
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(100, 70);
|
||||
display.print("Keel Position"); // Label
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(100, 70);
|
||||
getdisplay().print("Keel Position"); // Label
|
||||
|
||||
if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){
|
||||
// Print Unit of keel position
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
// Print Unit of keel position
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 110);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(145, 110);
|
||||
getdisplay().print("No sensor data"); // Info missing sensor
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -71,45 +71,47 @@ class PageOneValue : public Page{
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
display.setCursor(20, 100);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(20, 100);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(270, 100);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(270, 100);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 180);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
display.setCursor(20, 200);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(20, 200);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
display.setCursor(20, 240);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -117,23 +119,23 @@ class PageOneValue : public Page{
|
|||
}
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -143,43 +143,45 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Horizintal separator left
|
||||
display.fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
||||
// Show roll value
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
if(holdvalues == false) display.print(svalue1); // Value
|
||||
else display.print(svalue1old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false) display.print(unit1); // Unit
|
||||
else display.print(unit1old);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 270);
|
||||
if(holdvalues == false) getdisplay().print(svalue1); // Value
|
||||
else getdisplay().print(svalue1old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 220);
|
||||
getdisplay().print(name1); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 190);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false) getdisplay().print(unit1); // Unit
|
||||
else getdisplay().print(unit1old);
|
||||
|
||||
// Horizintal separator right
|
||||
display.fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
|
||||
// Show pitch value
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
if(holdvalues == false) display.print(svalue2); // Value
|
||||
else display.print(svalue2old);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
if(holdvalues == false) display.print(unit1); // Unit
|
||||
else display.print(unit1old);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 270);
|
||||
if(holdvalues == false) getdisplay().print(svalue2); // Value
|
||||
else getdisplay().print(svalue2old);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(335, 220);
|
||||
getdisplay().print(name2); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 190);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false) getdisplay().print(unit1); // Unit
|
||||
else getdisplay().print(unit1old);
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
|
@ -187,8 +189,8 @@ public:
|
|||
int rInstrument = 100; // Radius of instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
|
||||
for(int i=0; i<360; i=i+10)
|
||||
{
|
||||
|
@ -213,17 +215,17 @@ public:
|
|||
// Print text centered on position x, y
|
||||
int16_t x1, y1; // Return values of getTextBounds
|
||||
uint16_t w, h; // Return values of getTextBounds
|
||||
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
display.setCursor(x-w/2, y+h/2);
|
||||
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
getdisplay().setCursor(x-w/2, y+h/2);
|
||||
if(i % 20 == 0){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.print(ii);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().print(ii);
|
||||
}
|
||||
|
||||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -234,10 +236,10 @@ public:
|
|||
float xx2 = +dx;
|
||||
float yy1 = -(rInstrument-10);
|
||||
float yy2 = -(rInstrument+10);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
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);
|
||||
}
|
||||
|
@ -258,7 +260,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument * 0.7);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -268,28 +270,28 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument * 0.7);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
|
||||
// Draw counterweight
|
||||
display.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, pixelcolor);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 22, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 20, pixelcolor); // Boat circle
|
||||
getdisplay().fillCircle(200, 150, startwidth + 22, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 20, pixelcolor); // 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);
|
||||
display.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, bgcolor); // Clear half top side of boat circle (right triangle)
|
||||
x1 = x0 + 50*cos(value1 + pi);
|
||||
y1 = y0 + 50*sin(value1 + pi);
|
||||
display.fillTriangle(x0, y0, x1, y1, x2, y2, bgcolor); // Clear half top side of boat circle (left triangle)
|
||||
display.fillRect(150, 160, 100, 4, pixelcolor); // Water line
|
||||
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
|
||||
|
||||
// Draw roll pointer
|
||||
startwidth = 4; // Start width of pointer
|
||||
|
@ -302,7 +304,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument - 15);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -312,36 +314,36 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument - 15);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
}
|
||||
else{
|
||||
// Print sensor info
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 200);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(145, 200);
|
||||
getdisplay().print("No sensor data"); // Info missing sensor
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -79,7 +79,9 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
|
||||
//*******************************************************************************************
|
||||
|
@ -88,9 +90,9 @@ public:
|
|||
int rInstrument = 110; // Radius of RudderPosition
|
||||
float pi = 3.141592;
|
||||
|
||||
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
|
||||
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
|
||||
|
||||
for(int i=90; i<=270; i=i+10)
|
||||
{
|
||||
|
@ -118,17 +120,17 @@ public:
|
|||
// Print text centered on position x, y
|
||||
int16_t x1, y1; // Return values of getTextBounds
|
||||
uint16_t w, h; // Return values of getTextBounds
|
||||
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
display.setCursor(x-w/2, y+h/2);
|
||||
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
getdisplay().setCursor(x-w/2, y+h/2);
|
||||
if(i % 30 == 0){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.print(ii);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().print(ii);
|
||||
}
|
||||
|
||||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -139,10 +141,10 @@ public:
|
|||
float xx2 = +dx;
|
||||
float yy1 = -(rInstrument-10);
|
||||
float yy2 = -(rInstrument+10);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
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);
|
||||
}
|
||||
|
@ -150,29 +152,29 @@ public:
|
|||
}
|
||||
|
||||
// Print label
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.setCursor(80, 70);
|
||||
display.print("Rudder Position"); // Label
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().setCursor(80, 70);
|
||||
getdisplay().print("Rudder Position"); // Label
|
||||
|
||||
// Print Unit in RudderPosition
|
||||
if(valid1 == true || simulation == true){
|
||||
if(holdvalues == false){
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(175, 110);
|
||||
display.print(unit1old); // Unit
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(175, 110);
|
||||
getdisplay().print(unit1old); // Unit
|
||||
}
|
||||
}
|
||||
else{
|
||||
// Print Unit of keel position
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(145, 110);
|
||||
display.print("No sensor data"); // Info missing sensor
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(145, 110);
|
||||
getdisplay().print("No sensor data"); // Info missing sensor
|
||||
}
|
||||
|
||||
// Calculate rudder position
|
||||
|
@ -195,7 +197,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument * 0.5);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -205,35 +207,34 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument * 0.5);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -81,79 +81,81 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print("Solar");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print("Solar");
|
||||
|
||||
// Show voltage type
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 140);
|
||||
int bvoltage = 0;
|
||||
if(String(batVoltage) == "12V") bvoltage = 12;
|
||||
else bvoltage = 24;
|
||||
display.print(bvoltage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().print(bvoltage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show solar power level
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 200);
|
||||
if(solarMaxPower <= 999) display.print(solarMaxPower, 0);
|
||||
if(solarMaxPower > 999) display.print(float(solarMaxPower/1000.0), 1);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
if(solarMaxPower <= 999) display.print("W");
|
||||
if(solarMaxPower > 999) display.print("kw");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 200);
|
||||
if(solarMaxPower <= 999) getdisplay().print(solarMaxPower, 0);
|
||||
if(solarMaxPower > 999) getdisplay().print(float(solarMaxPower/1000.0), 1);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
if(solarMaxPower <= 999) getdisplay().print("W");
|
||||
if(solarMaxPower > 999) getdisplay().print("kw");
|
||||
|
||||
// Show info
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 235);
|
||||
display.print("Installed");
|
||||
display.setCursor(10, 255);
|
||||
display.print("Power");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 235);
|
||||
getdisplay().print("Installed");
|
||||
getdisplay().setCursor(10, 255);
|
||||
getdisplay().print("Power");
|
||||
|
||||
// Show solar icon
|
||||
batteryGraphic(150, 45, solPercentage, pixelcolor, bgcolor);
|
||||
|
||||
// Show average settings
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(150, 145);
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(150, 145);
|
||||
getdisplay().print("Avg: 1s");
|
||||
|
||||
// Show power level in percent
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(150, 200);
|
||||
display.print(solPercentage);
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("%");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(150, 200);
|
||||
getdisplay().print(solPercentage);
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("%");
|
||||
|
||||
// Show sensor type info
|
||||
String i2cAddr = "";
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(270, 60);
|
||||
if(powerSensor == "off") display.print("Internal");
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(270, 60);
|
||||
if(powerSensor == "off") getdisplay().print("Internal");
|
||||
if(powerSensor == "INA219"){
|
||||
display.print("INA219");
|
||||
getdisplay().print("INA219");
|
||||
}
|
||||
if(powerSensor == "INA226"){
|
||||
display.print("INA226");
|
||||
getdisplay().print("INA226");
|
||||
i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")";
|
||||
}
|
||||
display.print(i2cAddr);
|
||||
display.setCursor(270, 80);
|
||||
display.print("Sensor Modul");
|
||||
getdisplay().print(i2cAddr);
|
||||
getdisplay().setCursor(270, 80);
|
||||
getdisplay().print("Sensor Modul");
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 140);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 140);
|
||||
if(simulation == true){
|
||||
if(batVoltage == "12V"){
|
||||
value1 = 12.0;
|
||||
|
@ -162,67 +164,67 @@ public:
|
|||
value1 = 24.0;
|
||||
}
|
||||
value1 += float(random(0, 5)) / 10; // Simulation data
|
||||
display.print(value1,1);
|
||||
getdisplay().print(value1,1);
|
||||
}
|
||||
else{
|
||||
// Check for valid real data, display also if hold values activated
|
||||
if(valid1 == true || holdvalues == true){
|
||||
// Resolution switching
|
||||
if(value1 <= 9.9) display.print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1);
|
||||
if(value1 > 99.9) display.print(value1, 0);
|
||||
if(value1 <= 9.9) getdisplay().print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
|
||||
if(value1 > 99.9) getdisplay().print(value1, 0);
|
||||
}
|
||||
else{
|
||||
display.print("---"); // Missing bus data
|
||||
getdisplay().print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("V");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show actual current in A
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 200);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 200);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value2 <= 9.9) display.print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1);
|
||||
if(value2 > 99.9) display.print(value2, 0);
|
||||
if(value2 <= 9.9) getdisplay().print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
|
||||
if(value2 > 99.9) getdisplay().print(value2, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("A");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(260, 260);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(260, 260);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value3 <= 9.9) display.print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1);
|
||||
if(value3 > 99.9) display.print(value3, 0);
|
||||
if(value3 <= 9.9) getdisplay().print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
|
||||
if(value3 > 99.9) getdisplay().print(value3, 0);
|
||||
}
|
||||
else display.print("---");
|
||||
display.setFont(&Ubuntu_Bold16pt7b);
|
||||
display.print("W");
|
||||
else getdisplay().print("---");
|
||||
getdisplay().setFont(&Ubuntu_Bold16pt7b);
|
||||
getdisplay().print("W");
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -94,47 +94,49 @@ class PageThreeValues : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
/// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 55);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 55);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 90);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 90);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(50, 90);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(50, 90);
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(170, 68);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(170, 68);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 90);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 90);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -144,47 +146,47 @@ class PageThreeValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 105, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 145);
|
||||
display.print(name2); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 145);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 180);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 180);
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old);
|
||||
getdisplay().print(unit2old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(50, 180);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(50, 180);
|
||||
}
|
||||
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(170, 158);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(170, 158);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 180);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 180);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue2old); // Old value as formated string
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
|
@ -194,47 +196,47 @@ class PageThreeValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 195, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 3 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 235);
|
||||
display.print(name3); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 235);
|
||||
getdisplay().print(name3); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 270);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 270);
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old);
|
||||
getdisplay().print(unit3old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(50, 270);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(50, 270);
|
||||
}
|
||||
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(170, 248);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(170, 248);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
display.setCursor(180, 270);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
|
||||
getdisplay().setCursor(180, 270);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue3); // Real value as formated string
|
||||
getdisplay().print(svalue3); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue3old); // Old value as formated string
|
||||
getdisplay().print(svalue3old); // Old value as formated string
|
||||
}
|
||||
if(valid3 == true){
|
||||
svalue3old = svalue3; // Save the old value
|
||||
|
@ -245,24 +247,23 @@ class PageThreeValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -83,47 +83,49 @@ class PageTwoValues : public Page
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// ############### Value 1 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 80);
|
||||
display.print(name1); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 80);
|
||||
getdisplay().print(name1); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 130);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 130);
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old);
|
||||
getdisplay().print(unit1old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(50, 130);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(50, 130);
|
||||
}
|
||||
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(170, 105);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(170, 105);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic42pt7b);
|
||||
display.setCursor(180, 130);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b);
|
||||
getdisplay().setCursor(180, 130);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue1); // Real value as formated string
|
||||
getdisplay().print(svalue1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue1old); // Old value as formated string
|
||||
getdisplay().print(svalue1old); // Old value as formated string
|
||||
}
|
||||
if(valid1 == true){
|
||||
svalue1old = svalue1; // Save the old value
|
||||
|
@ -133,47 +135,47 @@ class PageTwoValues : public Page
|
|||
// ############### Horizontal Line ################
|
||||
|
||||
// Horizontal line 3 pix
|
||||
display.fillRect(0, 145, 400, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 145, 400, 3, pixelcolor);
|
||||
|
||||
// ############### Value 2 ################
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(20, 190);
|
||||
display.print(name2); // Page name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(20, 190);
|
||||
getdisplay().print(name2); // Page name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(20, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old);
|
||||
getdisplay().print(unit2old);
|
||||
}
|
||||
|
||||
// Switch font if format for any values
|
||||
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(50, 240);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(50, 240);
|
||||
}
|
||||
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(170, 215);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(170, 215);
|
||||
}
|
||||
else{
|
||||
display.setFont(&DSEG7Classic_BoldItalic42pt7b);
|
||||
display.setCursor(180, 240);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b);
|
||||
getdisplay().setCursor(180, 240);
|
||||
}
|
||||
|
||||
// Show bus data
|
||||
if(holdvalues == false){
|
||||
display.print(svalue2); // Real value as formated string
|
||||
getdisplay().print(svalue2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
display.print(svalue2old); // Old value as formated string
|
||||
getdisplay().print(svalue2old); // Old value as formated string
|
||||
}
|
||||
if(valid2 == true){
|
||||
svalue2old = svalue2; // Save the old value
|
||||
|
@ -184,24 +186,23 @@ class PageTwoValues : public Page
|
|||
// ############### Key Layout ################
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -147,52 +147,54 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
//Clear display in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show name
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold32pt7b);
|
||||
display.setCursor(20, 100);
|
||||
display.print(name1); // Value name
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold32pt7b);
|
||||
getdisplay().setCursor(20, 100);
|
||||
getdisplay().print(name1); // Value name
|
||||
|
||||
// Show unit
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold20pt7b);
|
||||
display.setCursor(270, 100);
|
||||
display.print("V");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold20pt7b);
|
||||
getdisplay().setCursor(270, 100);
|
||||
getdisplay().print("V");
|
||||
|
||||
// Show batery type
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(295, 100);
|
||||
display.print(batType);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(295, 100);
|
||||
getdisplay().print(batType);
|
||||
|
||||
// Show average settings
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(320, 100);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(320, 100);
|
||||
switch (average) {
|
||||
case 0:
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
case 1:
|
||||
display.print("Avg: 10s");
|
||||
getdisplay().print("Avg: 10s");
|
||||
break;
|
||||
case 2:
|
||||
display.print("Avg: 60s");
|
||||
getdisplay().print("Avg: 60s");
|
||||
break;
|
||||
case 3:
|
||||
display.print("Avg: 300s");
|
||||
getdisplay().print("Avg: 300s");
|
||||
break;
|
||||
default:
|
||||
display.print("Avg: 1s");
|
||||
getdisplay().print("Avg: 1s");
|
||||
break;
|
||||
}
|
||||
|
||||
// Reading bus data or using simulation data
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
display.setCursor(20, 240);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
|
||||
getdisplay().setCursor(20, 240);
|
||||
if(simulation == true){
|
||||
if(batVoltage == "12V"){
|
||||
value1 = 12.0;
|
||||
|
@ -201,32 +203,32 @@ public:
|
|||
value1 = 24.0;
|
||||
}
|
||||
value1 += float(random(0, 5)) / 10; // Simulation data
|
||||
display.print(value1,1);
|
||||
getdisplay().print(value1,1);
|
||||
}
|
||||
else{
|
||||
// Check for valid real data, display also if hold values activated
|
||||
if(valid1 == true || holdvalues == true){
|
||||
// Resolution switching
|
||||
if(value1 < 10){
|
||||
display.print(value1,2);
|
||||
getdisplay().print(value1,2);
|
||||
}
|
||||
if(value1 >= 10 && value1 < 100){
|
||||
display.print(value1,1);
|
||||
getdisplay().print(value1,1);
|
||||
}
|
||||
if(value1 >= 100){
|
||||
display.print(value1,0);
|
||||
getdisplay().print(value1,0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.print("---"); // Missing bus data
|
||||
getdisplay().print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
|
||||
// Trend indicator
|
||||
// Show trend indicator
|
||||
if(trend == true){
|
||||
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
display.fillRect(315, 183, 35, 4, textcolor); // Draw separator
|
||||
getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
getdisplay().fillRect(315, 183, 35, 4, textcolor); // Draw separator
|
||||
if(int(raw * 10) > int(valueTrend * 10)){
|
||||
displayTrendHigh(320, 174, 11, textcolor); // Show high indicator
|
||||
}
|
||||
|
@ -236,32 +238,32 @@ public:
|
|||
}
|
||||
// No trend indicator
|
||||
else{
|
||||
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
|
||||
}
|
||||
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(10, 290);
|
||||
display.print("[AVG]");
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
display.setCursor(293, 290);
|
||||
display.print("[TRD]");
|
||||
getdisplay().setCursor(10, 290);
|
||||
getdisplay().print("[AVG]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(293, 290);
|
||||
getdisplay().print("[TRD]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -33,11 +33,12 @@ class PageWhite : public Page{
|
|||
// Set background color
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Update display
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -154,89 +154,91 @@ public:
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
// Clear display by call in obp60task.cpp in main loop
|
||||
// Set display in partial refresh mode
|
||||
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
|
||||
getdisplay().fillScreen(bgcolor); // Clear display
|
||||
|
||||
// Show values AWA
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 65);
|
||||
display.print(svalue1); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 95);
|
||||
display.print(name1); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 115);
|
||||
display.print(" ");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 65);
|
||||
getdisplay().print(svalue1); // Value
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 95);
|
||||
getdisplay().print(name1); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 115);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit1); // Unit
|
||||
getdisplay().print(unit1); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit1old); // Unit
|
||||
getdisplay().print(unit1old); // Unit
|
||||
}
|
||||
|
||||
// Horizintal separator left
|
||||
display.fillRect(0, 149, 60, 3, pixelcolor);
|
||||
getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
|
||||
|
||||
// Show values AWS
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(10, 270);
|
||||
display.print(svalue2); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(10, 220);
|
||||
display.print(name2); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(10, 190);
|
||||
display.print(" ");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(10, 270);
|
||||
getdisplay().print(svalue2); // Value
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(10, 220);
|
||||
getdisplay().print(name2); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(10, 190);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit2); // Unit
|
||||
getdisplay().print(unit2); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit2old); // Unit
|
||||
getdisplay().print(unit2old); // Unit
|
||||
}
|
||||
|
||||
// Show values TWD
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 65);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 65);
|
||||
if(valid3 == true){
|
||||
display.print(abs(value3 * 360 / PI), 0); // Value
|
||||
getdisplay().print(abs(value3 * 360 / PI), 0); // Value
|
||||
}
|
||||
else{
|
||||
display.print("---"); // Value
|
||||
getdisplay().print("---"); // Value
|
||||
}
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 95);
|
||||
display.print(name3); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 115);
|
||||
display.print(" ");
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(335, 95);
|
||||
getdisplay().print(name3); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 115);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit3); // Unit
|
||||
getdisplay().print(unit3); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit3old); // Unit
|
||||
getdisplay().print(unit3old); // Unit
|
||||
}
|
||||
|
||||
// Horizintal separator right
|
||||
display.fillRect(340, 149, 80, 3, pixelcolor);
|
||||
getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
|
||||
|
||||
// Show values TWS
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
display.setCursor(295, 270);
|
||||
display.print(svalue4); // Value
|
||||
display.setFont(&Ubuntu_Bold12pt7b);
|
||||
display.setCursor(335, 220);
|
||||
display.print(name4); // Name
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(335, 190);
|
||||
display.print(" ");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
getdisplay().setCursor(295, 270);
|
||||
getdisplay().print(svalue4); // Value
|
||||
getdisplay().setFont(&Ubuntu_Bold12pt7b);
|
||||
getdisplay().setCursor(335, 220);
|
||||
getdisplay().print(name4); // Name
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(335, 190);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit4); // Unit
|
||||
getdisplay().print(unit4); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit4old); // Unit
|
||||
getdisplay().print(unit4old); // Unit
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
|
@ -245,10 +247,10 @@ public:
|
|||
int rInstrument = 110; // Radius of grafic instrument
|
||||
float pi = 3.141592;
|
||||
|
||||
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
|
||||
display.fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle
|
||||
display.fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle
|
||||
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
|
||||
|
||||
for(int i=0; i<360; i=i+10)
|
||||
{
|
||||
|
@ -276,17 +278,17 @@ public:
|
|||
// Print text centered on position x, y
|
||||
int16_t x1, y1; // Return values of getTextBounds
|
||||
uint16_t w, h; // Return values of getTextBounds
|
||||
display.getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
display.setCursor(x-w/2, y+h/2);
|
||||
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
|
||||
getdisplay().setCursor(x-w/2, y+h/2);
|
||||
if(i % 30 == 0){
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.print(ii);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().print(ii);
|
||||
}
|
||||
|
||||
// Draw sub scale with dots
|
||||
float x1c = 200 + rInstrument*sin(i/180.0*pi);
|
||||
float y1c = 150 - rInstrument*cos(i/180.0*pi);
|
||||
display.fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
getdisplay().fillCircle((int)x1c, (int)y1c, 2, pixelcolor);
|
||||
float sinx=sin(i/180.0*pi);
|
||||
float cosx=cos(i/180.0*pi);
|
||||
|
||||
|
@ -297,10 +299,10 @@ public:
|
|||
float xx2 = +dx;
|
||||
float yy1 = -(rInstrument-10);
|
||||
float yy2 = -(rInstrument+10);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
display.fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
|
||||
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);
|
||||
}
|
||||
|
@ -317,7 +319,7 @@ public:
|
|||
float xx2 = startwidth;
|
||||
float yy1 = -startwidth;
|
||||
float yy2 = -(rInstrument-15);
|
||||
display.fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1),
|
||||
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);
|
||||
// Inverted pointer
|
||||
|
@ -327,66 +329,65 @@ public:
|
|||
float ix2 = -endwidth;
|
||||
float iy1 = -(rInstrument-15);
|
||||
float iy2 = -endwidth;
|
||||
display.fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1),
|
||||
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);
|
||||
}
|
||||
|
||||
// Center circle
|
||||
display.fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
display.fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
|
||||
getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
|
||||
|
||||
//*******************************************************************************************
|
||||
|
||||
// Show values DBT
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
display.setCursor(160, 200);
|
||||
display.print(svalue5); // Value
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(190, 215);
|
||||
display.print(" ");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 200);
|
||||
getdisplay().print(svalue5); // Value
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(190, 215);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit5); // Unit
|
||||
getdisplay().print(unit5); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit5old); // Unit
|
||||
getdisplay().print(unit5old); // Unit
|
||||
}
|
||||
|
||||
// Show values STW
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
display.setCursor(160, 130);
|
||||
display.print(svalue6); // Value
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
display.setCursor(190, 90);
|
||||
display.print(" ");
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||
getdisplay().setCursor(160, 130);
|
||||
getdisplay().print(svalue6); // Value
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setCursor(190, 90);
|
||||
getdisplay().print(" ");
|
||||
if(holdvalues == false){
|
||||
display.print(unit6); // Unit
|
||||
getdisplay().print(unit6); // Unit
|
||||
}
|
||||
else{
|
||||
display.print(unit6old); // Unit
|
||||
getdisplay().print(unit6old); // Unit
|
||||
}
|
||||
|
||||
// Key Layout
|
||||
display.setTextColor(textcolor);
|
||||
display.setFont(&Ubuntu_Bold8pt7b);
|
||||
getdisplay().setTextColor(textcolor);
|
||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||
if(keylock == false){
|
||||
display.setCursor(130, 290);
|
||||
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
|
||||
if(String(backlightMode) == "Control by Key"){ // Key for illumination
|
||||
display.setCursor(343, 290);
|
||||
display.print("[ILUM]");
|
||||
getdisplay().setCursor(343, 290);
|
||||
getdisplay().print("[ILUM]");
|
||||
}
|
||||
}
|
||||
else{
|
||||
display.setCursor(130, 290);
|
||||
display.print(" [ Keylock active ]");
|
||||
getdisplay().setCursor(130, 290);
|
||||
getdisplay().print(" [ Keylock active ]");
|
||||
}
|
||||
|
||||
// Update display
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
|
||||
getdisplay().nextPage(); // Partial update (fast)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <NMEA0183.h> // NMEA0183
|
||||
#include <NMEA0183Msg.h>
|
||||
#include <NMEA0183Messages.h>
|
||||
#include <GxEPD.h> // GxEPD lib for E-Ink displays
|
||||
#include <GxEPD2_BW.h> // GxEPD2 lib for black 6 white E-Ink displays
|
||||
#include "OBP60Extensions.h" // Functions lib for extension board
|
||||
#include "OBP60Keypad.h" // Functions for keypad
|
||||
|
||||
|
@ -245,8 +245,8 @@ void OBP60Task(GwApi *api){
|
|||
int pixelcolor = GxEPD_BLACK;
|
||||
int bgcolor = GxEPD_WHITE;
|
||||
|
||||
display.init(); // Initialize and clear display
|
||||
display.setRotation(0); // Set display orientation (horizontal)
|
||||
getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
|
||||
getdisplay().setRotation(0); // Set display orientation (horizontal)
|
||||
if(displaycolor == "Normal"){
|
||||
textcolor = GxEPD_BLACK;
|
||||
pixelcolor = GxEPD_BLACK;
|
||||
|
@ -257,32 +257,22 @@ void OBP60Task(GwApi *api){
|
|||
pixelcolor = GxEPD_WHITE;
|
||||
bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen
|
||||
display.setTextColor(textcolor); // Set display color
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);
|
||||
display.update(); // Full update (slow)
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);
|
||||
getdisplay().setFullWindow(); // Set full Refresh
|
||||
getdisplay().firstPage(); // set first page
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().setTextColor(textcolor); // Set display color
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
|
||||
if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){
|
||||
display.drawBitmap(gImage_Logo_OBP_400x300_sw, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, pixelcolor); // Draw start logo
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), pixelcolor); // Draw start logo
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
delay(SHOW_TIME); // Logo show time
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen
|
||||
if(refreshmode == true){
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Needs partial update before full update to refresh the frame buffer
|
||||
display.update(); // Full update
|
||||
}
|
||||
else{
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
|
||||
}
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
if(String(displaymode) == "Logo + QR Code"){
|
||||
qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection
|
||||
delay(SHOW_TIME); // Logo show time
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Needs partial update before full update to refresh the frame buffer
|
||||
display.update(); // Full update
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);
|
||||
delay(SHOW_TIME); // QR code show time
|
||||
getdisplay().fillScreen(bgcolor); // Draw white sreen
|
||||
getdisplay().nextPage(); // Full Refresh
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,7 +467,8 @@ void OBP60Task(GwApi *api){
|
|||
|
||||
// Full display update afer a new selected page and 4s wait time
|
||||
if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){
|
||||
display.update(); // Full update
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
delayedDisplayUpdate = false;
|
||||
}
|
||||
|
||||
|
@ -486,17 +477,18 @@ void OBP60Task(GwApi *api){
|
|||
if(millis() < firststart + (5 * 60 * 1000) && millis() > starttime1 + (60 * 1000)){
|
||||
starttime1 = millis();
|
||||
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min");
|
||||
display.update(); // Full update
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
}
|
||||
|
||||
// Subtask E-Ink full refresh
|
||||
if(millis() > starttime2 + FULL_REFRESH_TIME * 1000){
|
||||
starttime2 = millis();
|
||||
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh");
|
||||
display.update(); // Full update
|
||||
getdisplay().setFullWindow(); // Set full update
|
||||
getdisplay().nextPage(); // Full Update
|
||||
}
|
||||
|
||||
|
||||
// Refresh display data all 1s
|
||||
if(millis() > starttime3 + 1000){
|
||||
starttime3 = millis();
|
||||
|
@ -505,7 +497,7 @@ void OBP60Task(GwApi *api){
|
|||
api->getStatus(commonData.status);
|
||||
|
||||
// Show header if enabled
|
||||
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Clear display
|
||||
getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), bgcolor); // Clear display
|
||||
if (pages[pageNumber].description && pages[pageNumber].description->header){
|
||||
//build some header and footer using commonData
|
||||
displayHeader(commonData, date, time);
|
||||
|
|
|
@ -22,7 +22,7 @@ lib_deps =
|
|||
blemasle/MCP23017@2.0.0
|
||||
adafruit/Adafruit BusIO@1.5.0
|
||||
adafruit/Adafruit GFX Library@1.11.9
|
||||
zinggjm/GxEPD@3.1.3
|
||||
zinggjm/GxEPD2@1.5.6
|
||||
sstaub/Ticker@4.4.0
|
||||
adafruit/Adafruit BMP280 Library@2.6.2
|
||||
adafruit/Adafruit BME280 Library@2.2.2
|
||||
|
|
Loading…
Reference in New Issue