First version with GxEPD2 Lib

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

View File

@ -5,7 +5,7 @@
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter #include <PCF8574.h> // Driver for PCF8574 output modul from Horter
#include <Wire.h> // I2C #include <Wire.h> // I2C
#include <RTClib.h> // Driver for DS1388 RTC #include <RTClib.h> // Driver for DS1388 RTC
#include "SunRise.h" // Lib for sunrise and sunset calculation #include "SunRise.h" // Lib for sunrise and sunset calculation
#include "Pagedata.h" #include "Pagedata.h"
#include "OBP60Hardware.h" #include "OBP60Hardware.h"
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
@ -22,9 +22,13 @@
#include "DSEG7Classic-BoldItalic42pt7b.h" #include "DSEG7Classic-BoldItalic42pt7b.h"
#include "DSEG7Classic-BoldItalic60pt7b.h" #include "DSEG7Classic-BoldItalic60pt7b.h"
// SPI pin definitions for E-Ink display // E-Ink Display
GxIO_Class io(SPI, OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST); // SPI, CS, DC, RST #define GxEPD_WIDTH 400 // Display width
GxEPD_Class display(io, OBP_SPI_RST, OBP_SPI_BUSY); // io, RST, BUSY #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 // Horter I2C moduls
PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 from Horter PCF8574 pcf8574_Out(PCF8574_I2C_ADDR1); // First digital output modul PCF8574 from Horter
@ -48,6 +52,10 @@ void hardwareInit()
// Init power rail 5.0V // Init power rail 5.0V
setPortPin(OBP_POWER_50, true); 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 // Init RGB LEDs
FastLED.addLeds<WS2812B, OBP_FLASH_LED, GRB>(fled, NUM_FLASH_LED); FastLED.addLeds<WS2812B, OBP_FLASH_LED, GRB>(fled, NUM_FLASH_LED);
FastLED.addLeds<WS2812B, OBP_BACKLIGHT_LED, GRB>(backlight, NUM_BACKLIGHT_LED); FastLED.addLeds<WS2812B, OBP_BACKLIGHT_LED, GRB>(backlight, NUM_BACKLIGHT_LED);

View File

@ -4,12 +4,7 @@
#include <Arduino.h> #include <Arduino.h>
#include "OBP60Hardware.h" #include "OBP60Hardware.h"
#include <FastLED.h> // Driver for WS2812 RGB LED #include <FastLED.h> // Driver for WS2812 RGB LED
#include <GxGDEW042T2/GxGDEW042T2.h> // 4.2" Waveshare S/W 300 x 400 pixel #include <GxEPD2_BW.h> // E-paper lib V2
#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
// Fonts declarations for display (#inclues see OBP60Extensions.cpp) // Fonts declarations for display (#inclues see OBP60Extensions.cpp)
extern const GFXfont Ubuntu_Bold8pt7b; extern const GFXfont Ubuntu_Bold8pt7b;
@ -24,6 +19,8 @@ extern const GFXfont DSEG7Classic_BoldItalic42pt7b;
extern const GFXfont DSEG7Classic_BoldItalic60pt7b; extern const GFXfont DSEG7Classic_BoldItalic60pt7b;
// Gloabl functions // Gloabl functions
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay();
void hardwareInit(); void hardwareInit();
void setPortPin(uint pin, bool value); // Set port pin for extension port void setPortPin(uint pin, bool value); // Set port pin for extension port

View File

@ -2,6 +2,7 @@
#define _OBP60QRWIFI_H #define _OBP60QRWIFI_H
#include <Arduino.h> #include <Arduino.h>
#include "OBP60Extensions.h"
#include "qrcode.h" #include "qrcode.h"
void qrWiFi(String ssid, String passwd, String displaycolor){ void qrWiFi(String ssid, String passwd, String displaycolor){
@ -39,20 +40,20 @@ void qrWiFi(String ssid, String passwd, String displaycolor){
// Each horizontal module // Each horizontal module
for (uint8_t x = 0; x < qrcode.size; x++) { for (uint8_t x = 0; x < qrcode.size; x++) {
if(qrcode_getModule(&qrcode, x, y)){ 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 { } 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_x = box_x + box_s;
} }
box_y = box_y + box_s; box_y = box_y + box_s;
box_x = init_x; box_x = init_x;
} }
display.setFont(&Ubuntu_Bold32pt7b); getdisplay().setFont(&Ubuntu_Bold32pt7b);
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setCursor(140, 285); getdisplay().setCursor(140, 285);
display.print("WiFi"); getdisplay().print("WiFi");
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Full Refresh
} }
#endif #endif

View File

@ -40,9 +40,13 @@ void underVoltageDetection(){
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off
// Shutdown EInk display // 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.setPartialWindow(0, 0, display.width(), display.height()); // Set partial update
display.update(); display.fillScreen(GxEPD_WHITE); // Draw white sreen
display.nextPage(); // Partial update
display.powerOff(); // Power off
*/
// Stop system // Stop system
while(true){ while(true){
esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart). esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart).

View File

@ -104,44 +104,46 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show values AWS
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 50); getdisplay().setCursor(20, 50);
if(holdvalues == false){ if(holdvalues == false){
display.print(name1); // Value name getdisplay().print(name1); // Value name
display.print(": "); getdisplay().print(": ");
display.print(svalue1); // Value getdisplay().print(svalue1); // Value
display.print(" "); getdisplay().print(" ");
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(name1); // Value name getdisplay().print(name1); // Value name
display.print(": "); getdisplay().print(": ");
display.print(svalue1old); // Value old getdisplay().print(svalue1old); // Value old
display.print(" "); getdisplay().print(" ");
display.print(unit1old); // Unit old getdisplay().print(unit1old); // Unit old
} }
// Show values AWD // Show values AWD
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 260); getdisplay().setCursor(20, 260);
if(holdvalues == false){ if(holdvalues == false){
display.print(name2); // Value name getdisplay().print(name2); // Value name
display.print(": "); getdisplay().print(": ");
display.print(svalue2); // Value getdisplay().print(svalue2); // Value
display.print(" "); getdisplay().print(" ");
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(name2); // Value name getdisplay().print(name2); // Value name
display.print(": "); getdisplay().print(": ");
display.print(svalue2old); // Value old getdisplay().print(svalue2old); // Value old
display.print(" "); getdisplay().print(" ");
display.print(unit2old); // Unit old getdisplay().print(unit2old); // Unit old
} }
// Draw wind pointer // Draw wind pointer
@ -153,8 +155,8 @@ public:
static int16_t y2 = y0; static int16_t y2 = y0;
//Draw instrument //Draw instrument
display.fillCircle(x0, y0, lp + 5, pixelcolor); // Black circle getdisplay().fillCircle(x0, y0, lp + 5, pixelcolor); // Black circle
display.fillCircle(x0, y0, lp + 1, bgcolor); // White circle getdisplay().fillCircle(x0, y0, lp + 1, bgcolor); // White circle
// Calculation end point of pointer // Calculation end point of pointer
value2 = value2 - 3.14 / 2; value2 = value2 - 3.14 / 2;
@ -162,26 +164,26 @@ public:
y1 = y0 + sin(value2) * lp * 0.6; y1 = y0 + sin(value2) * lp * 0.6;
x2 = x0 + cos(value2) * lp; x2 = x0 + cos(value2) * lp;
y2 = y0 + sin(value2) * lp; y2 = y0 + sin(value2) * lp;
display.drawLine(x1, y1, x2, y2, pixelcolor); getdisplay().drawLine(x1, y1, x2, y2, pixelcolor);
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -108,109 +108,114 @@ class PageBME280 : public Page
// Set background color and text color // Set background color and text color
int textcolor = GxEPD_BLACK; int textcolor = GxEPD_BLACK;
int pixelcolor = GxEPD_BLACK; int pixelcolor = GxEPD_BLACK;
int bgcolor = GxEPD_WHITE;
if(displaycolor == "Normal"){ if(displaycolor == "Normal"){
textcolor = GxEPD_BLACK; textcolor = GxEPD_BLACK;
pixelcolor = GxEPD_BLACK; pixelcolor = GxEPD_BLACK;
bgcolor = GxEPD_WHITE;
} }
else{ else{
textcolor = GxEPD_WHITE; textcolor = GxEPD_WHITE;
pixelcolor = 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 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 55); getdisplay().setCursor(20, 55);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 90); getdisplay().setCursor(20, 90);
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
// Switch font if format for any values // Switch font if format for any values
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 90); getdisplay().setCursor(180, 90);
// Show bus data // Show bus data
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 105, 400, 3, pixelcolor); getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 145); getdisplay().setCursor(20, 145);
display.print(name2); // Page name getdisplay().print(name2); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 180); getdisplay().setCursor(20, 180);
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
// Switch font if format for any values // Switch font if format for any values
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 180); getdisplay().setCursor(180, 180);
// Show bus data // Show bus data
display.print(svalue2); // Real value as formated string getdisplay().print(svalue2); // Real value as formated string
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 195, 400, 3, pixelcolor); getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 235); getdisplay().setCursor(20, 235);
display.print(name3); // Page name getdisplay().print(name3); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 270); getdisplay().setCursor(20, 270);
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
// Switch font if format for any values // Switch font if format for any values
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 270); getdisplay().setCursor(180, 270);
// Show bus data // Show bus data
display.print(svalue3); // Real value as formated string getdisplay().print(svalue3); // Real value as formated string
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -167,165 +167,167 @@ class PageBattery : public Page
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show average settings
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
switch (average) { switch (average) {
case 0: case 0:
display.setCursor(60, 90); getdisplay().setCursor(60, 90);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
display.setCursor(60, 180); getdisplay().setCursor(60, 180);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
display.setCursor(60, 270); getdisplay().setCursor(60, 270);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
case 1: case 1:
display.setCursor(60, 90); getdisplay().setCursor(60, 90);
display.print("Avg: 10s"); getdisplay().print("Avg: 10s");
display.setCursor(60, 180); getdisplay().setCursor(60, 180);
display.print("Avg: 10s"); getdisplay().print("Avg: 10s");
display.setCursor(60, 270); getdisplay().setCursor(60, 270);
display.print("Avg: 10s"); getdisplay().print("Avg: 10s");
break; break;
case 2: case 2:
display.setCursor(60, 90); getdisplay().setCursor(60, 90);
display.print("Avg: 60s"); getdisplay().print("Avg: 60s");
display.setCursor(60, 180); getdisplay().setCursor(60, 180);
display.print("Avg: 60s"); getdisplay().print("Avg: 60s");
display.setCursor(60, 270); getdisplay().setCursor(60, 270);
display.print("Avg: 60s"); getdisplay().print("Avg: 60s");
break; break;
case 3: case 3:
display.setCursor(60, 90); getdisplay().setCursor(60, 90);
display.print("Avg: 300s"); getdisplay().print("Avg: 300s");
display.setCursor(60, 180); getdisplay().setCursor(60, 180);
display.print("Avg: 300s"); getdisplay().print("Avg: 300s");
display.setCursor(60, 270); getdisplay().setCursor(60, 270);
display.print("Avg: 300s"); getdisplay().print("Avg: 300s");
break; break;
default: default:
display.setCursor(60, 90); getdisplay().setCursor(60, 90);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
display.setCursor(60, 180); getdisplay().setCursor(60, 180);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
display.setCursor(60, 270); getdisplay().setCursor(60, 270);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
} }
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 55); getdisplay().setCursor(20, 55);
display.print(name1); // Value name getdisplay().print(name1); // Value name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 90); getdisplay().setCursor(20, 90);
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
// Show value // Show value
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 90); getdisplay().setCursor(180, 90);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
display.print(value1,2); // Real value as formated string getdisplay().print(value1,2); // Real value as formated string
} }
else{ else{
display.print("---"); // No sensor data (sensor is off) getdisplay().print("---"); // No sensor data (sensor is off)
} }
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 105, 400, 3, pixelcolor); getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 145); getdisplay().setCursor(20, 145);
display.print(name2); // Value name getdisplay().print(name2); // Value name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 180); getdisplay().setCursor(20, 180);
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
// Show value // Show value
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 180); getdisplay().setCursor(180, 180);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
display.print(value2,1); // Real value as formated string getdisplay().print(value2,1); // Real value as formated string
} }
else{ else{
display.print("---"); // No sensor data (sensor is off) getdisplay().print("---"); // No sensor data (sensor is off)
} }
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 195, 400, 3, pixelcolor); getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 235); getdisplay().setCursor(20, 235);
display.print(name3); // Value name getdisplay().print(name3); // Value name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 270); getdisplay().setCursor(20, 270);
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
// Show value // Show value
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 270); getdisplay().setCursor(180, 270);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
display.print(value3,1); // Real value as formated string getdisplay().print(value3,1); // Real value as formated string
} }
else{ else{
display.print("---"); // No sensor data (sensor is off) getdisplay().print("---"); // No sensor data (sensor is off)
} }
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(10, 290); getdisplay().setCursor(10, 290);
display.print("[AVG]"); getdisplay().print("[AVG]");
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -193,113 +193,115 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(10, 65); getdisplay().setCursor(10, 65);
display.print("Bat."); getdisplay().print("Bat.");
// Show batery type // Show batery type
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(90, 65); getdisplay().setCursor(90, 65);
display.print(batType); getdisplay().print(batType);
// Show voltage type // Show voltage type
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 140); getdisplay().setCursor(10, 140);
int bvoltage = 0; int bvoltage = 0;
if(String(batVoltage) == "12V") bvoltage = 12; if(String(batVoltage) == "12V") bvoltage = 12;
else bvoltage = 24; else bvoltage = 24;
display.print(bvoltage); getdisplay().print(bvoltage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show batery capacity // Show batery capacity
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 200); getdisplay().setCursor(10, 200);
if(batCapacity <= 999) display.print(batCapacity, 0); if(batCapacity <= 999) getdisplay().print(batCapacity, 0);
if(batCapacity > 999) display.print(float(batCapacity/1000.0), 1); if(batCapacity > 999) getdisplay().print(float(batCapacity/1000.0), 1);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
if(batCapacity <= 999) display.print("Ah"); if(batCapacity <= 999) getdisplay().print("Ah");
if(batCapacity > 999) display.print("kAh"); if(batCapacity > 999) getdisplay().print("kAh");
// Show info // Show info
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 235); getdisplay().setCursor(10, 235);
display.print("Installed"); getdisplay().print("Installed");
display.setCursor(10, 255); getdisplay().setCursor(10, 255);
display.print("Battery Type"); getdisplay().print("Battery Type");
// Show battery with fill level // Show battery with fill level
batteryGraphic(150, 45, batPercentage, pixelcolor, bgcolor); batteryGraphic(150, 45, batPercentage, pixelcolor, bgcolor);
// Show average settings // Show average settings
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(150, 145); getdisplay().setCursor(150, 145);
switch (average) { switch (average) {
case 0: case 0:
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
case 1: case 1:
display.print("Avg: 10s"); getdisplay().print("Avg: 10s");
break; break;
case 2: case 2:
display.print("Avg: 60s"); getdisplay().print("Avg: 60s");
break; break;
case 3: case 3:
display.print("Avg: 300s"); getdisplay().print("Avg: 300s");
break; break;
default: default:
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
} }
// Show fill level in percent // Show fill level in percent
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(150, 200); getdisplay().setCursor(150, 200);
display.print(batPercentage); getdisplay().print(batPercentage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("%"); getdisplay().print("%");
// Show time to full discharge // Show time to full discharge
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(150, 260); getdisplay().setCursor(150, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(batRange < 9.9) display.print(batRange, 1); if(batRange < 9.9) getdisplay().print(batRange, 1);
else display.print(batRange, 0); else getdisplay().print(batRange, 0);
} }
else display.print("--"); else getdisplay().print("--");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("h"); getdisplay().print("h");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(270, 60); getdisplay().setCursor(270, 60);
if(powerSensor == "off") display.print("Internal"); if(powerSensor == "off") getdisplay().print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
display.print("INA219"); getdisplay().print("INA219");
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
display.print("INA226"); getdisplay().print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")";
} }
display.print(i2cAddr); getdisplay().print(i2cAddr);
display.setCursor(270, 80); getdisplay().setCursor(270, 80);
display.print("Sensor Modul"); getdisplay().print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 140); getdisplay().setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -308,69 +310,69 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
display.print(value1,1); getdisplay().print(value1,1);
} }
else{ else{
// Check for valid real data, display also if hold values activated // Check for valid real data, display also if hold values activated
if(valid1 == true || holdvalues == true){ if(valid1 == true || holdvalues == true){
// Resolution switching // Resolution switching
if(value1 <= 9.9) display.print(value1, 2); if(value1 <= 9.9) getdisplay().print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
if(value1 > 99.9) display.print(value1, 0); if(value1 > 99.9) getdisplay().print(value1, 0);
} }
else{ else{
display.print("---"); // Missing bus data getdisplay().print("---"); // Missing bus data
} }
} }
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show actual current in A // Show actual current in A
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 200); getdisplay().setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) display.print(value2, 2); if(value2 <= 9.9) getdisplay().print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
if(value2 > 99.9) display.print(value2, 0); if(value2 > 99.9) getdisplay().print(value2, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("A"); getdisplay().print("A");
// Show actual consumption in W // Show actual consumption in W
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 260); getdisplay().setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) display.print(value3, 2); if(value3 <= 9.9) getdisplay().print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
if(value3 > 99.9) display.print(value3, 0); if(value3 > 99.9) getdisplay().print(value3, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("W"); getdisplay().print("W");
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(10, 290); getdisplay().setCursor(10, 290);
display.print("[AVG]"); getdisplay().print("[AVG]");
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -105,30 +105,32 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show values GPS date
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 65); getdisplay().setCursor(10, 65);
if(holdvalues == false) display.print(svalue2); // Value if(holdvalues == false) getdisplay().print(svalue2); // Value
else display.print(svalue2old); else getdisplay().print(svalue2old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(10, 95); getdisplay().setCursor(10, 95);
display.print("Date"); // Name getdisplay().print("Date"); // Name
// Horizintal separator left // Horizintal separator left
display.fillRect(0, 149, 60, 3, pixelcolor); getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
// Show values GPS time // Show values GPS time
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 250); getdisplay().setCursor(10, 250);
if(holdvalues == false) display.print(svalue1); // Value if(holdvalues == false) getdisplay().print(svalue1); // Value
else display.print(svalue1old); else getdisplay().print(svalue1old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(10, 220); getdisplay().setCursor(10, 220);
display.print("Time"); // Name getdisplay().print("Time"); // Name
// Show values sunrise // Show values sunrise
String sunrise = "---"; String sunrise = "---";
@ -137,17 +139,17 @@ public:
svalue3old = sunrise; svalue3old = sunrise;
} }
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(335, 65); getdisplay().setCursor(335, 65);
if(holdvalues == false) display.print(sunrise); // Value if(holdvalues == false) getdisplay().print(sunrise); // Value
else display.print(svalue3old); else getdisplay().print(svalue3old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(335, 95); getdisplay().setCursor(335, 95);
display.print("SunR"); // Name getdisplay().print("SunR"); // Name
// Horizintal separator right // Horizintal separator right
display.fillRect(340, 149, 80, 3, pixelcolor); getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
// Show values sunset // Show values sunset
String sunset = "---"; String sunset = "---";
@ -156,14 +158,14 @@ public:
svalue4old = sunset; svalue4old = sunset;
} }
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(335, 250); getdisplay().setCursor(335, 250);
if(holdvalues == false) display.print(sunset); // Value if(holdvalues == false) getdisplay().print(sunset); // Value
else display.print(svalue4old); else getdisplay().print(svalue4old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(335, 220); getdisplay().setCursor(335, 220);
display.print("SunS"); // Name getdisplay().print("SunS"); // Name
//******************************************************************************************* //*******************************************************************************************
@ -171,8 +173,8 @@ public:
int rInstrument = 110; // Radius of clock int rInstrument = 110; // Radius of clock
float pi = 3.141592; float pi = 3.141592;
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
for(int i=0; i<360; i=i+1) for(int i=0; i<360; i=i+1)
{ {
@ -200,11 +202,11 @@ public:
// Print text centered on position x, y // Print text centered on position x, y
int16_t x1, y1; // Return values of getTextBounds int16_t x1, y1; // Return values of getTextBounds
uint16_t w, h; // 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 getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
display.setCursor(x-w/2, y+h/2); getdisplay().setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.print(ii); getdisplay().print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
@ -213,7 +215,7 @@ public:
if(i % 6 == 0){ if(i % 6 == 0){
float x1c = 200 + rInstrument*sin(i/180.0*pi); float x1c = 200 + rInstrument*sin(i/180.0*pi);
float y1c = 150 - rInstrument*cos(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); sinx=sin(i/180.0*pi);
cosx=cos(i/180.0*pi); cosx=cos(i/180.0*pi);
} }
@ -225,26 +227,26 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
} }
} }
// Print Unit in clock // Print Unit in clock
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
if(holdvalues == false){ if(holdvalues == false){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(175, 110); getdisplay().setCursor(175, 110);
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(175, 110); getdisplay().setCursor(175, 110);
display.print(unit2old); // Unit getdisplay().print(unit2old); // Unit
} }
// Clock values // Clock values
@ -270,7 +272,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.5); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -280,7 +282,7 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.5); float iy1 = -(rInstrument * 0.5);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
} }
@ -296,7 +298,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument - 15); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -306,34 +308,34 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument - 15); float iy1 = -(rInstrument - 15);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
} }
// Center circle // Center circle
display.fillCircle(200, 150, startwidth + 6, bgcolor); getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
display.fillCircle(200, 150, startwidth + 4, pixelcolor); getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
//******************************************************************************************* //*******************************************************************************************
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

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

View File

@ -105,47 +105,49 @@ class PageFourValues : public Page
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(20, 45); getdisplay().setCursor(20, 45);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 65); getdisplay().setCursor(20, 65);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); getdisplay().print(unit1old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(120, 55); getdisplay().setCursor(120, 55);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(150, 58); getdisplay().setCursor(150, 58);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(180, 65); getdisplay().setCursor(180, 65);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
} }
else{ else{
display.print(svalue1old); // Old value as formated string getdisplay().print(svalue1old); // Old value as formated string
} }
if(valid1 == true){ if(valid1 == true){
svalue1old = svalue1; // Save the old value svalue1old = svalue1; // Save the old value
@ -155,47 +157,47 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 80, 400, 3, pixelcolor); getdisplay().fillRect(0, 80, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(20, 113); getdisplay().setCursor(20, 113);
display.print(name2); // Page name getdisplay().print(name2); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 133); getdisplay().setCursor(20, 133);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(unit2old); getdisplay().print(unit2old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(120, 123); getdisplay().setCursor(120, 123);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(150, 123); getdisplay().setCursor(150, 123);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(180, 133); getdisplay().setCursor(180, 133);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue2); // Real value as formated string getdisplay().print(svalue2); // Real value as formated string
} }
else{ else{
display.print(svalue2old); // Old value as formated string getdisplay().print(svalue2old); // Old value as formated string
} }
if(valid2 == true){ if(valid2 == true){
svalue2old = svalue2; // Save the old value svalue2old = svalue2; // Save the old value
@ -205,47 +207,47 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 146, 400, 3, pixelcolor); getdisplay().fillRect(0, 146, 400, 3, pixelcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(20, 181); getdisplay().setCursor(20, 181);
display.print(name3); // Page name getdisplay().print(name3); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 201); getdisplay().setCursor(20, 201);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
} }
else{ else{
display.print(unit3old); getdisplay().print(unit3old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(120, 191); getdisplay().setCursor(120, 191);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(150, 191); getdisplay().setCursor(150, 191);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(180, 201); getdisplay().setCursor(180, 201);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue3); // Real value as formated string getdisplay().print(svalue3); // Real value as formated string
} }
else{ else{
display.print(svalue3old); // Old value as formated string getdisplay().print(svalue3old); // Old value as formated string
} }
if(valid3 == true){ if(valid3 == true){
svalue3old = svalue3; // Save the old value svalue3old = svalue3; // Save the old value
@ -255,47 +257,47 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 214, 400, 3, pixelcolor); getdisplay().fillRect(0, 214, 400, 3, pixelcolor);
// ############### Value 4 ################ // ############### Value 4 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(20, 249); getdisplay().setCursor(20, 249);
display.print(name4); // Page name getdisplay().print(name4); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 269); getdisplay().setCursor(20, 269);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit4); // Unit getdisplay().print(unit4); // Unit
} }
else{ else{
display.print(unit4old); getdisplay().print(unit4old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(120, 259); getdisplay().setCursor(120, 259);
} }
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(150, 259); getdisplay().setCursor(150, 259);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(180, 269); getdisplay().setCursor(180, 269);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue4); // Real value as formated string getdisplay().print(svalue4); // Real value as formated string
} }
else{ else{
display.print(svalue4old); // Old value as formated string getdisplay().print(svalue4old); // Old value as formated string
} }
if(valid4 == true){ if(valid4 == true){
svalue4old = svalue4; // Save the old value svalue4old = svalue4; // Save the old value
@ -306,23 +308,23 @@ class PageFourValues : public Page
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -105,47 +105,49 @@ class PageFourValues2 : public Page
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 55); getdisplay().setCursor(20, 55);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 90); getdisplay().setCursor(20, 90);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); getdisplay().print(unit1old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(100, 90); getdisplay().setCursor(100, 90);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(180, 77); getdisplay().setCursor(180, 77);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 90); getdisplay().setCursor(180, 90);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
} }
else{ else{
display.print(svalue1old); // Old value as formated string getdisplay().print(svalue1old); // Old value as formated string
} }
if(valid1 == true){ if(valid1 == true){
svalue1old = svalue1; // Save the old value svalue1old = svalue1; // Save the old value
@ -155,47 +157,47 @@ class PageFourValues2 : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 105, 400, 3, pixelcolor); getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 145); getdisplay().setCursor(20, 145);
display.print(name2); // Page name getdisplay().print(name2); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 180); getdisplay().setCursor(20, 180);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(unit2old); getdisplay().print(unit2old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(100, 180); getdisplay().setCursor(100, 180);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(180, 158); getdisplay().setCursor(180, 158);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 180); getdisplay().setCursor(180, 180);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue2); // Real value as formated string getdisplay().print(svalue2); // Real value as formated string
} }
else{ else{
display.print(svalue2old); // Old value as formated string getdisplay().print(svalue2old); // Old value as formated string
} }
if(valid2 == true){ if(valid2 == true){
svalue2old = svalue2; // Save the old value svalue2old = svalue2; // Save the old value
@ -205,47 +207,47 @@ class PageFourValues2 : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 195, 400, 3, pixelcolor); getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 220); getdisplay().setCursor(20, 220);
display.print(name3); // Page name getdisplay().print(name3); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(20, 240); getdisplay().setCursor(20, 240);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
} }
else{ else{
display.print(unit3old); getdisplay().print(unit3old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(50, 240); getdisplay().setCursor(50, 240);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(100, 240); getdisplay().setCursor(100, 240);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(80, 270); getdisplay().setCursor(80, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue3); // Real value as formated string getdisplay().print(svalue3); // Real value as formated string
} }
else{ else{
display.print(svalue3old); // Old value as formated string getdisplay().print(svalue3old); // Old value as formated string
} }
if(valid3 == true){ if(valid3 == true){
svalue3old = svalue3; // Save the old value svalue3old = svalue3; // Save the old value
@ -255,47 +257,47 @@ class PageFourValues2 : public Page
// ############### Vertical Line ################ // ############### Vertical Line ################
// Vertical line 3 pix // Vertical line 3 pix
display.fillRect(200, 195, 3, 75, pixelcolor); getdisplay().fillRect(200, 195, 3, 75, pixelcolor);
// ############### Value 4 ################ // ############### Value 4 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(220, 220); getdisplay().setCursor(220, 220);
display.print(name4); // Page name getdisplay().print(name4); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(220, 240); getdisplay().setCursor(220, 240);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit4); // Unit getdisplay().print(unit4); // Unit
} }
else{ else{
display.print(unit4old); getdisplay().print(unit4old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(250, 240); getdisplay().setCursor(250, 240);
} }
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(300, 240); getdisplay().setCursor(300, 240);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(280, 270); getdisplay().setCursor(280, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue4); // Real value as formated string getdisplay().print(svalue4); // Real value as formated string
} }
else{ else{
display.print(svalue4old); // Old value as formated string getdisplay().print(svalue4old); // Old value as formated string
} }
if(valid4 == true){ if(valid4 == true){
svalue4old = svalue4; // Save the old value svalue4old = svalue4; // Save the old value
@ -306,23 +308,23 @@ class PageFourValues2 : public Page
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -81,79 +81,81 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(10, 65); getdisplay().setCursor(10, 65);
display.print("Gen."); getdisplay().print("Gen.");
// Show voltage type // Show voltage type
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 140); getdisplay().setCursor(10, 140);
int bvoltage = 0; int bvoltage = 0;
if(String(batVoltage) == "12V") bvoltage = 12; if(String(batVoltage) == "12V") bvoltage = 12;
else bvoltage = 24; else bvoltage = 24;
display.print(bvoltage); getdisplay().print(bvoltage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show generator power level // Show generator power level
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 200); getdisplay().setCursor(10, 200);
if(generatorMaxPower <= 999) display.print(generatorMaxPower, 0); if(generatorMaxPower <= 999) getdisplay().print(generatorMaxPower, 0);
if(generatorMaxPower > 999) display.print(float(generatorMaxPower/1000.0), 1); if(generatorMaxPower > 999) getdisplay().print(float(generatorMaxPower/1000.0), 1);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
if(generatorMaxPower <= 999) display.print("W"); if(generatorMaxPower <= 999) getdisplay().print("W");
if(generatorMaxPower > 999) display.print("kw"); if(generatorMaxPower > 999) getdisplay().print("kw");
// Show info // Show info
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 235); getdisplay().setCursor(10, 235);
display.print("Installed"); getdisplay().print("Installed");
display.setCursor(10, 255); getdisplay().setCursor(10, 255);
display.print("Type"); getdisplay().print("Type");
// Show generator icon // Show generator icon
batteryGraphic(150, 45, genPercentage, pixelcolor, bgcolor); batteryGraphic(150, 45, genPercentage, pixelcolor, bgcolor);
// Show average settings // Show average settings
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(150, 145); getdisplay().setCursor(150, 145);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
// Show power level in percent // Show power level in percent
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(150, 200); getdisplay().setCursor(150, 200);
display.print(genPercentage); getdisplay().print(genPercentage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("%"); getdisplay().print("%");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(270, 60); getdisplay().setCursor(270, 60);
if(powerSensor == "off") display.print("Internal"); if(powerSensor == "off") getdisplay().print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
display.print("INA219"); getdisplay().print("INA219");
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
display.print("INA226"); getdisplay().print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")";
} }
display.print(i2cAddr); getdisplay().print(i2cAddr);
display.setCursor(270, 80); getdisplay().setCursor(270, 80);
display.print("Sensor Modul"); getdisplay().print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 140); getdisplay().setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -162,67 +164,67 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
display.print(value1,1); getdisplay().print(value1,1);
} }
else{ else{
// Check for valid real data, display also if hold values activated // Check for valid real data, display also if hold values activated
if(valid1 == true || holdvalues == true){ if(valid1 == true || holdvalues == true){
// Resolution switching // Resolution switching
if(value1 <= 9.9) display.print(value1, 2); if(value1 <= 9.9) getdisplay().print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
if(value1 > 99.9) display.print(value1, 0); if(value1 > 99.9) getdisplay().print(value1, 0);
} }
else{ else{
display.print("---"); // Missing bus data getdisplay().print("---"); // Missing bus data
} }
} }
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show actual current in A // Show actual current in A
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 200); getdisplay().setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) display.print(value2, 2); if(value2 <= 9.9) getdisplay().print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
if(value2 > 99.9) display.print(value2, 0); if(value2 > 99.9) getdisplay().print(value2, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("A"); getdisplay().print("A");
// Show actual consumption in W // Show actual consumption in W
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 260); getdisplay().setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) display.print(value3, 2); if(value3 <= 9.9) getdisplay().print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
if(value3 > 99.9) display.print(value3, 0); if(value3 > 99.9) getdisplay().print(value3, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("W"); getdisplay().print("W");
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -83,7 +83,9 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 int rInstrument = 110; // Radius of KeelPosition
float pi = 3.141592; float pi = 3.141592;
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle getdisplay().fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
for(int i=90; i<=270; i=i+10) for(int i=90; i<=270; i=i+10)
{ {
@ -122,17 +124,17 @@ public:
// Print text centered on position x, y // Print text centered on position x, y
int16_t x1, y1; // Return values of getTextBounds int16_t x1, y1; // Return values of getTextBounds
uint16_t w, h; // 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 getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
display.setCursor(x-w/2, y+h/2); getdisplay().setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.print(ii); getdisplay().print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*pi); float x1c = 200 + rInstrument*sin(i/180.0*pi);
float y1c = 150 - rInstrument*cos(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 sinx=sin(i/180.0*pi);
float cosx=cos(i/180.0*pi); float cosx=cos(i/180.0*pi);
@ -143,10 +145,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
} }
@ -180,7 +182,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.6); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -190,58 +192,58 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.6); float iy1 = -(rInstrument * 0.6);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
// Draw counterweight // 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 // Center circle
display.fillCircle(200, 140, startwidth + 22, bgcolor); getdisplay().fillCircle(200, 140, startwidth + 22, bgcolor);
display.fillCircle(200, 140, startwidth + 20, pixelcolor); // Boat circle getdisplay().fillCircle(200, 140, startwidth + 20, pixelcolor); // Boat circle
display.fillRect(200 - 30, 140 - 30, 2 * 30, 30, bgcolor); // Delete half top of boat circle getdisplay().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().fillRect(150, 150, 100, 4, pixelcolor); // Water line
// Print label // Print label
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(100, 70); getdisplay().setCursor(100, 70);
display.print("Keel Position"); // Label getdisplay().print("Keel Position"); // Label
if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){ if(rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true || simulation == true)){
// Print Unit of keel position // Print Unit of keel position
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(175, 110); getdisplay().setCursor(175, 110);
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
// Print Unit of keel position // Print Unit of keel position
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(145, 110); getdisplay().setCursor(145, 110);
display.print("No sensor data"); // Info missing sensor getdisplay().print("No sensor data"); // Info missing sensor
} }
//******************************************************************************************* //*******************************************************************************************
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -71,45 +71,47 @@ class PageOneValue : public Page{
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold32pt7b); getdisplay().setFont(&Ubuntu_Bold32pt7b);
display.setCursor(20, 100); getdisplay().setCursor(20, 100);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(270, 100); getdisplay().setCursor(270, 100);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); getdisplay().print(unit1old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 180); getdisplay().setCursor(20, 180);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold32pt7b); getdisplay().setFont(&Ubuntu_Bold32pt7b);
display.setCursor(20, 200); getdisplay().setCursor(20, 200);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic60pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
display.setCursor(20, 240); getdisplay().setCursor(20, 240);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
} }
else{ else{
display.print(svalue1old); // Old value as formated string getdisplay().print(svalue1old); // Old value as formated string
} }
if(valid1 == true){ if(valid1 == true){
svalue1old = svalue1; // Save the old value svalue1old = svalue1; // Save the old value
@ -117,23 +119,23 @@ class PageOneValue : public Page{
} }
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -143,43 +143,45 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Horizintal separator left
display.fillRect(0, 149, 60, 3, pixelcolor); getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
// Show roll value // Show roll value
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 270); getdisplay().setCursor(10, 270);
if(holdvalues == false) display.print(svalue1); // Value if(holdvalues == false) getdisplay().print(svalue1); // Value
else display.print(svalue1old); else getdisplay().print(svalue1old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(10, 220); getdisplay().setCursor(10, 220);
display.print(name1); // Name getdisplay().print(name1); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 190); getdisplay().setCursor(10, 190);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false) display.print(unit1); // Unit if(holdvalues == false) getdisplay().print(unit1); // Unit
else display.print(unit1old); else getdisplay().print(unit1old);
// Horizintal separator right // Horizintal separator right
display.fillRect(340, 149, 80, 3, pixelcolor); getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
// Show pitch value // Show pitch value
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(295, 270); getdisplay().setCursor(295, 270);
if(holdvalues == false) display.print(svalue2); // Value if(holdvalues == false) getdisplay().print(svalue2); // Value
else display.print(svalue2old); else getdisplay().print(svalue2old);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(335, 220); getdisplay().setCursor(335, 220);
display.print(name2); // Name getdisplay().print(name2); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(335, 190); getdisplay().setCursor(335, 190);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false) display.print(unit1); // Unit if(holdvalues == false) getdisplay().print(unit1); // Unit
else display.print(unit1old); else getdisplay().print(unit1old);
//******************************************************************************************* //*******************************************************************************************
@ -187,8 +189,8 @@ public:
int rInstrument = 100; // Radius of instrument int rInstrument = 100; // Radius of instrument
float pi = 3.141592; float pi = 3.141592;
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
for(int i=0; i<360; i=i+10) for(int i=0; i<360; i=i+10)
{ {
@ -213,17 +215,17 @@ public:
// Print text centered on position x, y // Print text centered on position x, y
int16_t x1, y1; // Return values of getTextBounds int16_t x1, y1; // Return values of getTextBounds
uint16_t w, h; // 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 getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
display.setCursor(x-w/2, y+h/2); getdisplay().setCursor(x-w/2, y+h/2);
if(i % 20 == 0){ if(i % 20 == 0){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.print(ii); getdisplay().print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*pi); float x1c = 200 + rInstrument*sin(i/180.0*pi);
float y1c = 150 - rInstrument*cos(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 sinx=sin(i/180.0*pi);
float cosx=cos(i/180.0*pi); float cosx=cos(i/180.0*pi);
@ -234,10 +236,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
} }
@ -258,7 +260,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.7); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -268,28 +270,28 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.7); float iy1 = -(rInstrument * 0.7);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
// Draw counterweight // 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 // Center circle
display.fillCircle(200, 150, startwidth + 22, bgcolor); getdisplay().fillCircle(200, 150, startwidth + 22, bgcolor);
display.fillCircle(200, 150, startwidth + 20, pixelcolor); // Boat circle getdisplay().fillCircle(200, 150, startwidth + 20, pixelcolor); // Boat circle
int x0 = 200; int x0 = 200;
int y0 = 150; int y0 = 150;
int x1 = x0 + 50*cos(value1); int x1 = x0 + 50*cos(value1);
int y1 = y0 + 50*sin(value1); int y1 = y0 + 50*sin(value1);
int x2 = x0 + 50*cos(value1 - pi/2); int x2 = x0 + 50*cos(value1 - pi/2);
int y2 = y0 + 50*sin(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); x1 = x0 + 50*cos(value1 + pi);
y1 = y0 + 50*sin(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) getdisplay().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().fillRect(150, 160, 100, 4, pixelcolor); // Water line
// Draw roll pointer // Draw roll pointer
startwidth = 4; // Start width of pointer startwidth = 4; // Start width of pointer
@ -302,7 +304,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument - 15); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -312,36 +314,36 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument - 15); float iy1 = -(rInstrument - 15);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
} }
else{ else{
// Print sensor info // Print sensor info
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(145, 200); getdisplay().setCursor(145, 200);
display.print("No sensor data"); // Info missing sensor getdisplay().print("No sensor data"); // Info missing sensor
} }
//******************************************************************************************* //*******************************************************************************************
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -79,7 +79,9 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 int rInstrument = 110; // Radius of RudderPosition
float pi = 3.141592; float pi = 3.141592;
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
display.fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle getdisplay().fillRect(0, 30, 400, 122, bgcolor); // Delete half top circle
for(int i=90; i<=270; i=i+10) for(int i=90; i<=270; i=i+10)
{ {
@ -118,17 +120,17 @@ public:
// Print text centered on position x, y // Print text centered on position x, y
int16_t x1, y1; // Return values of getTextBounds int16_t x1, y1; // Return values of getTextBounds
uint16_t w, h; // 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 getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
display.setCursor(x-w/2, y+h/2); getdisplay().setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.print(ii); getdisplay().print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*pi); float x1c = 200 + rInstrument*sin(i/180.0*pi);
float y1c = 150 - rInstrument*cos(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 sinx=sin(i/180.0*pi);
float cosx=cos(i/180.0*pi); float cosx=cos(i/180.0*pi);
@ -139,10 +141,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
} }
@ -150,29 +152,29 @@ public:
} }
// Print label // Print label
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.setCursor(80, 70); getdisplay().setCursor(80, 70);
display.print("Rudder Position"); // Label getdisplay().print("Rudder Position"); // Label
// Print Unit in RudderPosition // Print Unit in RudderPosition
if(valid1 == true || simulation == true){ if(valid1 == true || simulation == true){
if(holdvalues == false){ if(holdvalues == false){
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(175, 110); getdisplay().setCursor(175, 110);
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(175, 110); getdisplay().setCursor(175, 110);
display.print(unit1old); // Unit getdisplay().print(unit1old); // Unit
} }
} }
else{ else{
// Print Unit of keel position // Print Unit of keel position
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(145, 110); getdisplay().setCursor(145, 110);
display.print("No sensor data"); // Info missing sensor getdisplay().print("No sensor data"); // Info missing sensor
} }
// Calculate rudder position // Calculate rudder position
@ -195,7 +197,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.5); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -205,35 +207,34 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.5); float iy1 = -(rInstrument * 0.5);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
} }
// Center circle // Center circle
display.fillCircle(200, 150, startwidth + 6, bgcolor); getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
display.fillCircle(200, 150, startwidth + 4, pixelcolor); getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
//******************************************************************************************* //*******************************************************************************************
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -81,79 +81,81 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(10, 65); getdisplay().setCursor(10, 65);
display.print("Solar"); getdisplay().print("Solar");
// Show voltage type // Show voltage type
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 140); getdisplay().setCursor(10, 140);
int bvoltage = 0; int bvoltage = 0;
if(String(batVoltage) == "12V") bvoltage = 12; if(String(batVoltage) == "12V") bvoltage = 12;
else bvoltage = 24; else bvoltage = 24;
display.print(bvoltage); getdisplay().print(bvoltage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show solar power level // Show solar power level
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 200); getdisplay().setCursor(10, 200);
if(solarMaxPower <= 999) display.print(solarMaxPower, 0); if(solarMaxPower <= 999) getdisplay().print(solarMaxPower, 0);
if(solarMaxPower > 999) display.print(float(solarMaxPower/1000.0), 1); if(solarMaxPower > 999) getdisplay().print(float(solarMaxPower/1000.0), 1);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
if(solarMaxPower <= 999) display.print("W"); if(solarMaxPower <= 999) getdisplay().print("W");
if(solarMaxPower > 999) display.print("kw"); if(solarMaxPower > 999) getdisplay().print("kw");
// Show info // Show info
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 235); getdisplay().setCursor(10, 235);
display.print("Installed"); getdisplay().print("Installed");
display.setCursor(10, 255); getdisplay().setCursor(10, 255);
display.print("Power"); getdisplay().print("Power");
// Show solar icon // Show solar icon
batteryGraphic(150, 45, solPercentage, pixelcolor, bgcolor); batteryGraphic(150, 45, solPercentage, pixelcolor, bgcolor);
// Show average settings // Show average settings
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(150, 145); getdisplay().setCursor(150, 145);
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
// Show power level in percent // Show power level in percent
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(150, 200); getdisplay().setCursor(150, 200);
display.print(solPercentage); getdisplay().print(solPercentage);
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("%"); getdisplay().print("%");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(270, 60); getdisplay().setCursor(270, 60);
if(powerSensor == "off") display.print("Internal"); if(powerSensor == "off") getdisplay().print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
display.print("INA219"); getdisplay().print("INA219");
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
display.print("INA226"); getdisplay().print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")";
} }
display.print(i2cAddr); getdisplay().print(i2cAddr);
display.setCursor(270, 80); getdisplay().setCursor(270, 80);
display.print("Sensor Modul"); getdisplay().print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 140); getdisplay().setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -162,67 +164,67 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
display.print(value1,1); getdisplay().print(value1,1);
} }
else{ else{
// Check for valid real data, display also if hold values activated // Check for valid real data, display also if hold values activated
if(valid1 == true || holdvalues == true){ if(valid1 == true || holdvalues == true){
// Resolution switching // Resolution switching
if(value1 <= 9.9) display.print(value1, 2); if(value1 <= 9.9) getdisplay().print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)display.print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1);
if(value1 > 99.9) display.print(value1, 0); if(value1 > 99.9) getdisplay().print(value1, 0);
} }
else{ else{
display.print("---"); // Missing bus data getdisplay().print("---"); // Missing bus data
} }
} }
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("V"); getdisplay().print("V");
// Show actual current in A // Show actual current in A
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 200); getdisplay().setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) display.print(value2, 2); if(value2 <= 9.9) getdisplay().print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)display.print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1);
if(value2 > 99.9) display.print(value2, 0); if(value2 > 99.9) getdisplay().print(value2, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("A"); getdisplay().print("A");
// Show actual consumption in W // Show actual consumption in W
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(260, 260); getdisplay().setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) display.print(value3, 2); if(value3 <= 9.9) getdisplay().print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)display.print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1);
if(value3 > 99.9) display.print(value3, 0); if(value3 > 99.9) getdisplay().print(value3, 0);
} }
else display.print("---"); else getdisplay().print("---");
display.setFont(&Ubuntu_Bold16pt7b); getdisplay().setFont(&Ubuntu_Bold16pt7b);
display.print("W"); getdisplay().print("W");
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -94,47 +94,49 @@ class PageThreeValues : public Page
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 55); getdisplay().setCursor(20, 55);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 90); getdisplay().setCursor(20, 90);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); getdisplay().print(unit1old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(50, 90); getdisplay().setCursor(50, 90);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(170, 68); getdisplay().setCursor(170, 68);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 90); getdisplay().setCursor(180, 90);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
} }
else{ else{
display.print(svalue1old); // Old value as formated string getdisplay().print(svalue1old); // Old value as formated string
} }
if(valid1 == true){ if(valid1 == true){
svalue1old = svalue1; // Save the old value svalue1old = svalue1; // Save the old value
@ -144,47 +146,47 @@ class PageThreeValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 105, 400, 3, pixelcolor); getdisplay().fillRect(0, 105, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 145); getdisplay().setCursor(20, 145);
display.print(name2); // Page name getdisplay().print(name2); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 180); getdisplay().setCursor(20, 180);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(unit2old); getdisplay().print(unit2old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(50, 180); getdisplay().setCursor(50, 180);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(170, 158); getdisplay().setCursor(170, 158);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 180); getdisplay().setCursor(180, 180);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue2); // Real value as formated string getdisplay().print(svalue2); // Real value as formated string
} }
else{ else{
display.print(svalue2old); // Old value as formated string getdisplay().print(svalue2old); // Old value as formated string
} }
if(valid2 == true){ if(valid2 == true){
svalue2old = svalue2; // Save the old value svalue2old = svalue2; // Save the old value
@ -194,47 +196,47 @@ class PageThreeValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 195, 400, 3, pixelcolor); getdisplay().fillRect(0, 195, 400, 3, pixelcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 235); getdisplay().setCursor(20, 235);
display.print(name3); // Page name getdisplay().print(name3); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 270); getdisplay().setCursor(20, 270);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
} }
else{ else{
display.print(unit3old); getdisplay().print(unit3old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(50, 270); getdisplay().setCursor(50, 270);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(170, 248); getdisplay().setCursor(170, 248);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic30pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
display.setCursor(180, 270); getdisplay().setCursor(180, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue3); // Real value as formated string getdisplay().print(svalue3); // Real value as formated string
} }
else{ else{
display.print(svalue3old); // Old value as formated string getdisplay().print(svalue3old); // Old value as formated string
} }
if(valid3 == true){ if(valid3 == true){
svalue3old = svalue3; // Save the old value svalue3old = svalue3; // Save the old value
@ -245,24 +247,23 @@ class PageThreeValues : public Page
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -83,47 +83,49 @@ class PageTwoValues : public Page
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 ################ // ############### Value 1 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 80); getdisplay().setCursor(20, 80);
display.print(name1); // Page name getdisplay().print(name1); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 130); getdisplay().setCursor(20, 130);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); getdisplay().print(unit1old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(50, 130); getdisplay().setCursor(50, 130);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(170, 105); getdisplay().setCursor(170, 105);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic42pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b);
display.setCursor(180, 130); getdisplay().setCursor(180, 130);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue1); // Real value as formated string getdisplay().print(svalue1); // Real value as formated string
} }
else{ else{
display.print(svalue1old); // Old value as formated string getdisplay().print(svalue1old); // Old value as formated string
} }
if(valid1 == true){ if(valid1 == true){
svalue1old = svalue1; // Save the old value svalue1old = svalue1; // Save the old value
@ -133,47 +135,47 @@ class PageTwoValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
display.fillRect(0, 145, 400, 3, pixelcolor); getdisplay().fillRect(0, 145, 400, 3, pixelcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(20, 190); getdisplay().setCursor(20, 190);
display.print(name2); // Page name getdisplay().print(name2); // Page name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(20, 240); getdisplay().setCursor(20, 240);
if(holdvalues == false){ if(holdvalues == false){
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(unit2old); getdisplay().print(unit2old);
} }
// Switch font if format for any values // Switch font if format for any values
if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(50, 240); getdisplay().setCursor(50, 240);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(170, 215); getdisplay().setCursor(170, 215);
} }
else{ else{
display.setFont(&DSEG7Classic_BoldItalic42pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b);
display.setCursor(180, 240); getdisplay().setCursor(180, 240);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
display.print(svalue2); // Real value as formated string getdisplay().print(svalue2); // Real value as formated string
} }
else{ else{
display.print(svalue2old); // Old value as formated string getdisplay().print(svalue2old); // Old value as formated string
} }
if(valid2 == true){ if(valid2 == true){
svalue2old = svalue2; // Save the old value svalue2old = svalue2; // Save the old value
@ -184,24 +186,23 @@ class PageTwoValues : public Page
// ############### Key Layout ################ // ############### Key Layout ################
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -147,52 +147,54 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show name
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold32pt7b); getdisplay().setFont(&Ubuntu_Bold32pt7b);
display.setCursor(20, 100); getdisplay().setCursor(20, 100);
display.print(name1); // Value name getdisplay().print(name1); // Value name
// Show unit // Show unit
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold20pt7b); getdisplay().setFont(&Ubuntu_Bold20pt7b);
display.setCursor(270, 100); getdisplay().setCursor(270, 100);
display.print("V"); getdisplay().print("V");
// Show batery type // Show batery type
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(295, 100); getdisplay().setCursor(295, 100);
display.print(batType); getdisplay().print(batType);
// Show average settings // Show average settings
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(320, 100); getdisplay().setCursor(320, 100);
switch (average) { switch (average) {
case 0: case 0:
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
case 1: case 1:
display.print("Avg: 10s"); getdisplay().print("Avg: 10s");
break; break;
case 2: case 2:
display.print("Avg: 60s"); getdisplay().print("Avg: 60s");
break; break;
case 3: case 3:
display.print("Avg: 300s"); getdisplay().print("Avg: 300s");
break; break;
default: default:
display.print("Avg: 1s"); getdisplay().print("Avg: 1s");
break; break;
} }
// Reading bus data or using simulation data // Reading bus data or using simulation data
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic60pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b);
display.setCursor(20, 240); getdisplay().setCursor(20, 240);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -201,32 +203,32 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
display.print(value1,1); getdisplay().print(value1,1);
} }
else{ else{
// Check for valid real data, display also if hold values activated // Check for valid real data, display also if hold values activated
if(valid1 == true || holdvalues == true){ if(valid1 == true || holdvalues == true){
// Resolution switching // Resolution switching
if(value1 < 10){ if(value1 < 10){
display.print(value1,2); getdisplay().print(value1,2);
} }
if(value1 >= 10 && value1 < 100){ if(value1 >= 10 && value1 < 100){
display.print(value1,1); getdisplay().print(value1,1);
} }
if(value1 >= 100){ if(value1 >= 100){
display.print(value1,0); getdisplay().print(value1,0);
} }
} }
else{ else{
display.print("---"); // Missing bus data getdisplay().print("---"); // Missing bus data
} }
} }
// Trend indicator // Trend indicator
// Show trend indicator // Show trend indicator
if(trend == true){ if(trend == true){
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
display.fillRect(315, 183, 35, 4, textcolor); // Draw separator getdisplay().fillRect(315, 183, 35, 4, textcolor); // Draw separator
if(int(raw * 10) > int(valueTrend * 10)){ if(int(raw * 10) > int(valueTrend * 10)){
displayTrendHigh(320, 174, 11, textcolor); // Show high indicator displayTrendHigh(320, 174, 11, textcolor); // Show high indicator
} }
@ -236,32 +238,32 @@ public:
} }
// No trend indicator // No trend indicator
else{ else{
display.fillRect(310, 240, 40, 120, bgcolor); // Clear area getdisplay().fillRect(310, 240, 40, 120, bgcolor); // Clear area
} }
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(10, 290); getdisplay().setCursor(10, 290);
display.print("[AVG]"); getdisplay().print("[AVG]");
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
display.setCursor(293, 290); getdisplay().setCursor(293, 290);
display.print("[TRD]"); getdisplay().print("[TRD]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -33,11 +33,12 @@ class PageWhite : public Page{
// Set background color // Set background color
int bgcolor = GxEPD_WHITE; 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 // Update display
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen getdisplay().nextPage(); // Partial update (fast)
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast)
}; };
}; };

View File

@ -154,89 +154,91 @@ public:
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; 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 // Show values AWA
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 65); getdisplay().setCursor(10, 65);
display.print(svalue1); // Value getdisplay().print(svalue1); // Value
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(10, 95); getdisplay().setCursor(10, 95);
display.print(name1); // Name getdisplay().print(name1); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 115); getdisplay().setCursor(10, 115);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit1); // Unit getdisplay().print(unit1); // Unit
} }
else{ else{
display.print(unit1old); // Unit getdisplay().print(unit1old); // Unit
} }
// Horizintal separator left // Horizintal separator left
display.fillRect(0, 149, 60, 3, pixelcolor); getdisplay().fillRect(0, 149, 60, 3, pixelcolor);
// Show values AWS // Show values AWS
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(10, 270); getdisplay().setCursor(10, 270);
display.print(svalue2); // Value getdisplay().print(svalue2); // Value
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(10, 220); getdisplay().setCursor(10, 220);
display.print(name2); // Name getdisplay().print(name2); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(10, 190); getdisplay().setCursor(10, 190);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit2); // Unit getdisplay().print(unit2); // Unit
} }
else{ else{
display.print(unit2old); // Unit getdisplay().print(unit2old); // Unit
} }
// Show values TWD // Show values TWD
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(295, 65); getdisplay().setCursor(295, 65);
if(valid3 == true){ if(valid3 == true){
display.print(abs(value3 * 360 / PI), 0); // Value getdisplay().print(abs(value3 * 360 / PI), 0); // Value
} }
else{ else{
display.print("---"); // Value getdisplay().print("---"); // Value
} }
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(335, 95); getdisplay().setCursor(335, 95);
display.print(name3); // Name getdisplay().print(name3); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(335, 115); getdisplay().setCursor(335, 115);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit3); // Unit getdisplay().print(unit3); // Unit
} }
else{ else{
display.print(unit3old); // Unit getdisplay().print(unit3old); // Unit
} }
// Horizintal separator right // Horizintal separator right
display.fillRect(340, 149, 80, 3, pixelcolor); getdisplay().fillRect(340, 149, 80, 3, pixelcolor);
// Show values TWS // Show values TWS
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic20pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b);
display.setCursor(295, 270); getdisplay().setCursor(295, 270);
display.print(svalue4); // Value getdisplay().print(svalue4); // Value
display.setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
display.setCursor(335, 220); getdisplay().setCursor(335, 220);
display.print(name4); // Name getdisplay().print(name4); // Name
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(335, 190); getdisplay().setCursor(335, 190);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit4); // Unit getdisplay().print(unit4); // Unit
} }
else{ else{
display.print(unit4old); // Unit getdisplay().print(unit4old); // Unit
} }
//******************************************************************************************* //*******************************************************************************************
@ -245,10 +247,10 @@ public:
int rInstrument = 110; // Radius of grafic instrument int rInstrument = 110; // Radius of grafic instrument
float pi = 3.141592; float pi = 3.141592;
display.fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 10, pixelcolor); // Outer circle
display.fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle getdisplay().fillCircle(200, 150, rInstrument + 7, bgcolor); // Outer circle
display.fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle getdisplay().fillCircle(200, 150, rInstrument - 10, pixelcolor); // Inner circle
display.fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle getdisplay().fillCircle(200, 150, rInstrument - 13, bgcolor); // Inner circle
for(int i=0; i<360; i=i+10) for(int i=0; i<360; i=i+10)
{ {
@ -276,17 +278,17 @@ public:
// Print text centered on position x, y // Print text centered on position x, y
int16_t x1, y1; // Return values of getTextBounds int16_t x1, y1; // Return values of getTextBounds
uint16_t w, h; // 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 getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
display.setCursor(x-w/2, y+h/2); getdisplay().setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.print(ii); getdisplay().print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*pi); float x1c = 200 + rInstrument*sin(i/180.0*pi);
float y1c = 150 - rInstrument*cos(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 sinx=sin(i/180.0*pi);
float cosx=cos(i/180.0*pi); float cosx=cos(i/180.0*pi);
@ -297,10 +299,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),pixelcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),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*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),
200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),pixelcolor);
} }
@ -317,7 +319,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument-15); 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*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1),
200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),pixelcolor);
// Inverted pointer // Inverted pointer
@ -327,66 +329,65 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument-15); float iy1 = -(rInstrument-15);
float iy2 = -endwidth; 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*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1),
200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),pixelcolor);
} }
// Center circle // Center circle
display.fillCircle(200, 150, startwidth + 6, bgcolor); getdisplay().fillCircle(200, 150, startwidth + 6, bgcolor);
display.fillCircle(200, 150, startwidth + 4, pixelcolor); getdisplay().fillCircle(200, 150, startwidth + 4, pixelcolor);
//******************************************************************************************* //*******************************************************************************************
// Show values DBT // Show values DBT
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic16pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
display.setCursor(160, 200); getdisplay().setCursor(160, 200);
display.print(svalue5); // Value getdisplay().print(svalue5); // Value
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(190, 215); getdisplay().setCursor(190, 215);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit5); // Unit getdisplay().print(unit5); // Unit
} }
else{ else{
display.print(unit5old); // Unit getdisplay().print(unit5old); // Unit
} }
// Show values STW // Show values STW
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&DSEG7Classic_BoldItalic16pt7b); getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b);
display.setCursor(160, 130); getdisplay().setCursor(160, 130);
display.print(svalue6); // Value getdisplay().print(svalue6); // Value
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
display.setCursor(190, 90); getdisplay().setCursor(190, 90);
display.print(" "); getdisplay().print(" ");
if(holdvalues == false){ if(holdvalues == false){
display.print(unit6); // Unit getdisplay().print(unit6); // Unit
} }
else{ else{
display.print(unit6old); // Unit getdisplay().print(unit6old); // Unit
} }
// Key Layout // Key Layout
display.setTextColor(textcolor); getdisplay().setTextColor(textcolor);
display.setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
if(keylock == false){ if(keylock == false){
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]");
if(String(backlightMode) == "Control by Key"){ // Key for illumination if(String(backlightMode) == "Control by Key"){ // Key for illumination
display.setCursor(343, 290); getdisplay().setCursor(343, 290);
display.print("[ILUM]"); getdisplay().print("[ILUM]");
} }
} }
else{ else{
display.setCursor(130, 290); getdisplay().setCursor(130, 290);
display.print(" [ Keylock active ]"); getdisplay().print(" [ Keylock active ]");
} }
// Update display // Update display
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Partial update (fast)
}; };
}; };

View File

@ -9,7 +9,7 @@
#include <NMEA0183.h> // NMEA0183 #include <NMEA0183.h> // NMEA0183
#include <NMEA0183Msg.h> #include <NMEA0183Msg.h>
#include <NMEA0183Messages.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 "OBP60Extensions.h" // Functions lib for extension board
#include "OBP60Keypad.h" // Functions for keypad #include "OBP60Keypad.h" // Functions for keypad
@ -245,8 +245,8 @@ void OBP60Task(GwApi *api){
int pixelcolor = GxEPD_BLACK; int pixelcolor = GxEPD_BLACK;
int bgcolor = GxEPD_WHITE; int bgcolor = GxEPD_WHITE;
display.init(); // Initialize and clear display getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
display.setRotation(0); // Set display orientation (horizontal) getdisplay().setRotation(0); // Set display orientation (horizontal)
if(displaycolor == "Normal"){ if(displaycolor == "Normal"){
textcolor = GxEPD_BLACK; textcolor = GxEPD_BLACK;
pixelcolor = GxEPD_BLACK; pixelcolor = GxEPD_BLACK;
@ -257,32 +257,22 @@ void OBP60Task(GwApi *api){
pixelcolor = GxEPD_WHITE; pixelcolor = GxEPD_WHITE;
bgcolor = GxEPD_BLACK; bgcolor = GxEPD_BLACK;
} }
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen getdisplay().setFullWindow(); // Set full Refresh
display.setTextColor(textcolor); // Set display color getdisplay().firstPage(); // set first page
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); getdisplay().fillScreen(bgcolor); // Draw white sreen
display.update(); // Full update (slow) getdisplay().setTextColor(textcolor); // Set display color
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); getdisplay().nextPage(); // Full Refresh
if(String(displaymode) == "Logo + QR Code" || String(displaymode) == "Logo"){ 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 getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), pixelcolor); // Draw start logo
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Partial update (fast) getdisplay().nextPage(); // Full Refresh
delay(SHOW_TIME); // Logo show time delay(SHOW_TIME); // Logo show time
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen getdisplay().nextPage(); // Full Refresh
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)
}
if(String(displaymode) == "Logo + QR Code"){ if(String(displaymode) == "Logo + QR Code"){
qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection qrWiFi(systemname, wifipass, displaycolor); // Show QR code for WiFi connection
delay(SHOW_TIME); // Logo show time delay(SHOW_TIME); // QR code show time
display.fillRect(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, bgcolor); // Draw white sreen getdisplay().fillScreen(bgcolor); // Draw white sreen
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true); // Needs partial update before full update to refresh the frame buffer getdisplay().nextPage(); // Full Refresh
display.update(); // Full update
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, true);
} }
} }
@ -477,7 +467,8 @@ void OBP60Task(GwApi *api){
// Full display update afer a new selected page and 4s wait time // Full display update afer a new selected page and 4s wait time
if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){ if(millis() > starttime4 + 4000 && delayedDisplayUpdate == true){
display.update(); // Full update getdisplay().setFullWindow(); // Set full update
getdisplay().nextPage(); // Full Update
delayedDisplayUpdate = false; delayedDisplayUpdate = false;
} }
@ -486,16 +477,17 @@ void OBP60Task(GwApi *api){
if(millis() < firststart + (5 * 60 * 1000) && millis() > starttime1 + (60 * 1000)){ if(millis() < firststart + (5 * 60 * 1000) && millis() > starttime1 + (60 * 1000)){
starttime1 = millis(); starttime1 = millis();
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min"); 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 // Subtask E-Ink full refresh
if(millis() > starttime2 + FULL_REFRESH_TIME * 1000){ if(millis() > starttime2 + FULL_REFRESH_TIME * 1000){
starttime2 = millis(); starttime2 = millis();
LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh"); 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 // Refresh display data all 1s
if(millis() > starttime3 + 1000){ if(millis() > starttime3 + 1000){
@ -505,7 +497,7 @@ void OBP60Task(GwApi *api){
api->getStatus(commonData.status); api->getStatus(commonData.status);
// Show header if enabled // 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){ if (pages[pageNumber].description && pages[pageNumber].description->header){
//build some header and footer using commonData //build some header and footer using commonData
displayHeader(commonData, date, time); displayHeader(commonData, date, time);

View File

@ -22,7 +22,7 @@ lib_deps =
blemasle/MCP23017@2.0.0 blemasle/MCP23017@2.0.0
adafruit/Adafruit BusIO@1.5.0 adafruit/Adafruit BusIO@1.5.0
adafruit/Adafruit GFX Library@1.11.9 adafruit/Adafruit GFX Library@1.11.9
zinggjm/GxEPD@3.1.3 zinggjm/GxEPD2@1.5.6
sstaub/Ticker@4.4.0 sstaub/Ticker@4.4.0
adafruit/Adafruit BMP280 Library@2.6.2 adafruit/Adafruit BMP280 Library@2.6.2
adafruit/Adafruit BME280 Library@2.2.2 adafruit/Adafruit BME280 Library@2.2.2