Finalize switch to epd pointer instead if getdisplay()

This commit is contained in:
Thomas Hooge 2025-08-05 08:52:45 +02:00
parent 7cff3e62e6
commit b8a31f2280
31 changed files with 1516 additions and 1513 deletions

View File

@ -33,34 +33,20 @@
#ifdef DISPLAY_GDEW042T2 #ifdef DISPLAY_GDEW042T2
// Set display type and SPI pins for display // 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) 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;} // DEPRECATED
gxepd2display *epd = &display;
#endif #endif
#ifdef DISPLAY_GDEY042T81 #ifdef DISPLAY_GDEY042T81
// Set display type and SPI pins for display // Set display type and SPI pins for display
GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> display(GxEPD2_420_GDEY042T81(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> display(GxEPD2_420_GDEY042T81(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_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> & getdisplay(){return display;} // DEPRECATED
gxepd2display *epd = &display;
#endif #endif
#ifdef DISPLAY_GYE042A87 #ifdef DISPLAY_GYE042A87
// Set display type and SPI pins for display // Set display type and SPI pins for display
GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> display(GxEPD2_420_GYE042A87(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> display(GxEPD2_420_GYE042A87(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_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> & getdisplay(){return display;} // DEPRECATED
gxepd2display *epd = &display;
#endif #endif
#ifdef DISPLAY_SE0420NQ04 #ifdef DISPLAY_SE0420NQ04
// Set display type and SPI pins for display // Set display type and SPI pins for display
GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> display(GxEPD2_420_SE0420NQ04(OBP_SPI_CS, OBP_SPI_DC, OBP_SPI_RST, OBP_SPI_BUSY)); // GDEW042T2 400x300, UC8176 (IL0398) GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> display(GxEPD2_420_SE0420NQ04(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_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay(){return display;} // DEPRECATED
gxepd2display *epd = &display;
#endif #endif
gxepd2display *epd = &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
@ -210,17 +196,17 @@ void deepSleep(CommonData &common){
setFlashLED(false); // Flash LED Off setFlashLED(false); // Flash LED Off
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
// Shutdown EInk display // Shutdown EInk display
getdisplay().setFullWindow(); // Set full Refresh epd->setFullWindow(); // Set full Refresh
getdisplay().fillScreen(common.bgcolor); // Clear screen epd->fillScreen(common.bgcolor); // Clear screen
getdisplay().setTextColor(common.fgcolor); epd->setTextColor(common.fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(85, 150); epd->setCursor(85, 150);
getdisplay().print("Sleep Mode"); epd->print("Sleep Mode");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(65, 175); epd->setCursor(65, 175);
getdisplay().print("To wake up press key and wait 5s"); epd->print("To wake up press key and wait 5s");
getdisplay().nextPage(); // Update display contents epd->nextPage(); // Update display contents
getdisplay().powerOff(); // Display power off epd->powerOff(); // Display power off
setPortPin(OBP_POWER_50, false); // Power off ePaper display setPortPin(OBP_POWER_50, false); // Power off ePaper display
// Stop system // Stop system
esp_deep_sleep_start(); // Deep Sleep with weakup via touch pin esp_deep_sleep_start(); // Deep Sleep with weakup via touch pin
@ -234,18 +220,18 @@ void deepSleep(CommonData &common){
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
setFlashLED(false); // Flash LED Off setFlashLED(false); // Flash LED Off
// Shutdown EInk display // Shutdown EInk display
getdisplay().setFullWindow(); // Set full Refresh epd->setFullWindow(); // Set full Refresh
//getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update //epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().fillScreen(common.bgcolor); // Clear screen epd->fillScreen(common.bgcolor); // Clear screen
getdisplay().setTextColor(common.fgcolor); epd->setTextColor(common.fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(85, 150); epd->setCursor(85, 150);
getdisplay().print("Sleep Mode"); epd->print("Sleep Mode");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(65, 175); epd->setCursor(65, 175);
getdisplay().print("To wake up press wheel and wait 5s"); epd->print("To wake up press wheel and wait 5s");
getdisplay().nextPage(); // Partial update epd->nextPage(); // Partial update
getdisplay().powerOff(); // Display power off epd->powerOff(); // Display power off
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
setPortPin(OBP_POWER_SD, false); // Power off SD card setPortPin(OBP_POWER_SD, false); // Power off SD card
// Stop system // Stop system
@ -353,17 +339,17 @@ String xdrDelete(String input){
} }
void fillPoly4(const std::vector<Point>& p4, uint16_t color) { void fillPoly4(const std::vector<Point>& p4, uint16_t color) {
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[1].x, p4[1].y, p4[2].x, p4[2].y, color); epd->fillTriangle(p4[0].x, p4[0].y, p4[1].x, p4[1].y, p4[2].x, p4[2].y, color);
getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color); epd->fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color);
} }
void drawPoly(const std::vector<Point>& points, uint16_t color) { void drawPoly(const std::vector<Point>& points, uint16_t color) {
size_t polysize = points.size(); size_t polysize = points.size();
for (size_t i = 0; i < polysize - 1; i++) { for (size_t i = 0; i < polysize - 1; i++) {
getdisplay().drawLine(points[i].x, points[i].y, points[i+1].x, points[i+1].y, color); epd->drawLine(points[i].x, points[i].y, points[i+1].x, points[i+1].y, color);
} }
// close path // close path
getdisplay().drawLine(points[polysize-1].x, points[polysize-1].y, points[0].x, points[0].y, color); epd->drawLine(points[polysize-1].x, points[polysize-1].y, points[0].x, points[0].y, color);
} }
// Split string into words, whitespace separated // Split string into words, whitespace separated
@ -413,46 +399,46 @@ std::vector<String> wordwrap(String &line, uint16_t maxwidth) {
void drawTextCenter(int16_t cx, int16_t cy, String text) { void drawTextCenter(int16_t cx, int16_t cy, String text) {
int16_t x1, y1; int16_t x1, y1;
uint16_t w, h; uint16_t w, h;
getdisplay().getTextBounds(text, 0, 150, &x1, &y1, &w, &h); epd->getTextBounds(text, 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(cx - w / 2, cy + h / 2); epd->setCursor(cx - w / 2, cy + h / 2);
getdisplay().print(text); epd->print(text);
} }
// Draw right aligned text // Draw right aligned text
void drawTextRalign(int16_t x, int16_t y, String text) { void drawTextRalign(int16_t x, int16_t y, String text) {
int16_t x1, y1; int16_t x1, y1;
uint16_t w, h; uint16_t w, h;
getdisplay().getTextBounds(text, 0, 150, &x1, &y1, &w, &h); epd->getTextBounds(text, 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(x - w, y); epd->setCursor(x - w, y);
getdisplay().print(text); epd->print(text);
} }
// Draw text inside box, normal or inverted // Draw text inside box, normal or inverted
void drawTextBoxed(Rect box, String text, uint16_t fg, uint16_t bg, bool inverted, bool border) { void drawTextBoxed(Rect box, String text, uint16_t fg, uint16_t bg, bool inverted, bool border) {
if (inverted) { if (inverted) {
getdisplay().fillRect(box.x, box.y, box.w, box.h, fg); epd->fillRect(box.x, box.y, box.w, box.h, fg);
getdisplay().setTextColor(bg); epd->setTextColor(bg);
} else { } else {
if (border) { if (border) {
getdisplay().fillRect(box.x + 1, box.y + 1, box.w - 2, box.h - 2, bg); epd->fillRect(box.x + 1, box.y + 1, box.w - 2, box.h - 2, bg);
getdisplay().drawRect(box.x, box.y, box.w, box.h, fg); epd->drawRect(box.x, box.y, box.w, box.h, fg);
} }
getdisplay().setTextColor(fg); epd->setTextColor(fg);
} }
uint16_t border_offset = box.h / 4; // 25% of box height uint16_t border_offset = box.h / 4; // 25% of box height
getdisplay().setCursor(box.x + border_offset, box.y + box.h - border_offset); epd->setCursor(box.x + border_offset, box.y + box.h - border_offset);
getdisplay().print(text); epd->print(text);
getdisplay().setTextColor(fg); epd->setTextColor(fg);
} }
// Show a triangle for trend direction high (x, y is the left edge) // Show a triangle for trend direction high (x, y is the left edge)
void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){ void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color){
getdisplay().fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color); epd->fillTriangle(x, y, x+size*2, y, x+size, y-size*2, color);
} }
// Show a triangle for trend direction low (x, y is the left edge) // Show a triangle for trend direction low (x, y is the left edge)
void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
getdisplay().fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color); epd->fillTriangle(x, y, x+size*2, y, x+size, y+size*2, color);
} }
// Show header informations // Show header informations
@ -482,57 +468,57 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
} }
// Show status info // Show status info
getdisplay().setTextColor(commonData.fgcolor); epd->setTextColor(commonData.fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(0, 15); epd->setCursor(0, 15);
if (commonData.status.wifiApOn) { if (commonData.status.wifiApOn) {
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["AP"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["AP"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print(" AP "); epd->print(" AP ");
} }
} }
// If receive new telegram data then display bus name // If receive new telegram data then display bus name
if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){ if(commonData.status.tcpClRx != tcpClRxOld || commonData.status.tcpClTx != tcpClTxOld || commonData.status.tcpSerRx != tcpSerRxOld || commonData.status.tcpSerTx != tcpSerTxOld){
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["TCP"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["TCP"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print("TCP "); epd->print("TCP ");
} }
} }
if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){ if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["N2K"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["N2K"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print("N2K "); epd->print("N2K ");
} }
} }
if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){ if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["0183"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["0183"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print("183 "); epd->print("183 ");
} }
} }
if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){ if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["USB"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["USB"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print("USB "); epd->print("USB ");
} }
} }
double gpshdop = formatValue(hdop, commonData).value; double gpshdop = formatValue(hdop, commonData).value;
if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){ if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){
if (symbolmode) { if (symbolmode) {
getdisplay().drawXBitmap(symbol_x, 1, iconmap["GPS"], icon_width, icon_height, commonData.fgcolor); epd->drawXBitmap(symbol_x, 1, iconmap["GPS"], icon_width, icon_height, commonData.fgcolor);
symbol_x += symbol_offset; symbol_x += symbol_offset;
} else { } else {
getdisplay().print("GPS"); epd->print("GPS");
} }
} }
// Save old telegram counter // Save old telegram counter

View File

@ -50,28 +50,18 @@ extern const GFXfont Atari16px;
// Global functions // Global functions
#ifdef DISPLAY_GDEW042T2 #ifdef DISPLAY_GDEW042T2
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> & getdisplay(); // DEPRECATED
typedef GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> gxepd2display; typedef GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> gxepd2display;
extern gxepd2display *epd;
#endif #endif
#ifdef DISPLAY_GDEY042T81 #ifdef DISPLAY_GDEY042T81
GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> & getdisplay(); // DEPRECATED
typedef GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> gxepd2display; typedef GxEPD2_BW<GxEPD2_420_GDEY042T81, GxEPD2_420_GDEY042T81::HEIGHT> gxepd2display;
extern gxepd2display *epd;
#endif #endif
#ifdef DISPLAY_GYE042A87 #ifdef DISPLAY_GYE042A87
GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> & getdisplay(); // DEPRECATED
typedef GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> gxepd2display; typedef GxEPD2_BW<GxEPD2_420_GYE042A87, GxEPD2_420_GYE042A87::HEIGHT> gxepd2display;
extern gxepd2display *epd;
#endif #endif
#ifdef DISPLAY_SE0420NQ04 #ifdef DISPLAY_SE0420NQ04
GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> & getdisplay(); // DEPRECATED
typedef GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> gxepd2display; typedef GxEPD2_BW<GxEPD2_420_SE0420NQ04, GxEPD2_420_SE0420NQ04::HEIGHT> gxepd2display;
extern gxepd2display *epd;
#endif #endif
extern gxepd2display *epd;
// Page display return values // Page display return values
#define PAGE_OK 0 // all ok, do nothing #define PAGE_OK 0 // all ok, do nothing

View File

@ -26,20 +26,20 @@ void qrWiFi(String ssid, String passwd, uint16_t fgcolor, uint16_t bgcolor){
// 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)){
getdisplay().fillRect(box_x, box_y, box_s, box_s, fgcolor); epd->fillRect(box_x, box_y, box_s, box_s, fgcolor);
} else { } else {
getdisplay().fillRect(box_x, box_y, box_s, box_s, bgcolor); epd->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;
} }
getdisplay().setFont(&Ubuntu_Bold32pt8b); epd->setFont(&Ubuntu_Bold32pt8b);
getdisplay().setTextColor(fgcolor); epd->setTextColor(fgcolor);
getdisplay().setCursor(140, 285); epd->setCursor(140, 285);
getdisplay().print("WiFi"); epd->print("WiFi");
getdisplay().nextPage(); // Full Refresh epd->nextPage(); // Full Refresh
} }
#endif #endif

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -130,64 +131,64 @@ private:
} }
// Title and corner value headings // Title and corner value headings
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("Anchor"); epd->print("Anchor");
getdisplay().setFont(&Ubuntu_Bold10pt8b); epd->setFont(&Ubuntu_Bold10pt8b);
getdisplay().setCursor(8, 200); epd->setCursor(8, 200);
getdisplay().print("Depth"); epd->print("Depth");
drawTextRalign(392, 38, "Chain"); drawTextRalign(392, 38, "Chain");
drawTextRalign(392, 200, "Wind"); drawTextRalign(392, 200, "Wind");
// Units // Units
getdisplay().setCursor(8, 272); epd->setCursor(8, 272);
getdisplay().print(sunit_dbs); epd->print(sunit_dbs);
drawTextRalign(392, 272, sunit_aws); drawTextRalign(392, 272, sunit_aws);
drawTextRalign(392, 100, lengthformat); // chain unit not implemented drawTextRalign(392, 100, lengthformat); // chain unit not implemented
// Corner values // Corner values
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(8, 70); epd->setCursor(8, 70);
getdisplay().print("Alarm: "); epd->print("Alarm: ");
getdisplay().print(alarm_enabled ? "On" : "Off"); epd->print(alarm_enabled ? "On" : "Off");
getdisplay().setCursor(8, 90); epd->setCursor(8, 90);
getdisplay().print("HDOP"); epd->print("HDOP");
getdisplay().setCursor(8, 106); epd->setCursor(8, 106);
if (bv_hdop->valid) { if (bv_hdop->valid) {
getdisplay().print(round(bv_hdop->value), 0); epd->print(round(bv_hdop->value), 0);
getdisplay().print(sunit_hdop); epd->print(sunit_hdop);
} else { } else {
getdisplay().print("n/a"); epd->print("n/a");
} }
// Values // Values
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
// Current chain used // Current chain used
getdisplay().setCursor(328, 85); epd->setCursor(328, 85);
getdisplay().print("27"); epd->print("27");
// Depth // Depth
getdisplay().setCursor(8, 250); epd->setCursor(8, 250);
getdisplay().print(sval_dbs); epd->print(sval_dbs);
// Wind // Wind
getdisplay().setCursor(328, 250); epd->setCursor(328, 250);
getdisplay().print(sval_aws); epd->print(sval_aws);
getdisplay().drawCircle(c.x, c.y, r, commonData->fgcolor); epd->drawCircle(c.x, c.y, r, commonData->fgcolor);
getdisplay().drawCircle(c.x, c.y, r + 1, commonData->fgcolor); epd->drawCircle(c.x, c.y, r + 1, commonData->fgcolor);
// zoom scale // zoom scale
getdisplay().drawLine(c.x + 10, c.y, c.x + r - 4, c.y, commonData->fgcolor); epd->drawLine(c.x + 10, c.y, c.x + r - 4, c.y, commonData->fgcolor);
// arrow left // arrow left
getdisplay().drawLine(c.x + 10, c.y, c.x + 16, c.y - 4, commonData->fgcolor); epd->drawLine(c.x + 10, c.y, c.x + 16, c.y - 4, commonData->fgcolor);
getdisplay().drawLine(c.x + 10, c.y, c.x + 16, c.y + 4, commonData->fgcolor); epd->drawLine(c.x + 10, c.y, c.x + 16, c.y + 4, commonData->fgcolor);
// arrow right // arrow right
getdisplay().drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y - 4, commonData->fgcolor); epd->drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y - 4, commonData->fgcolor);
getdisplay().drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y + 4, commonData->fgcolor); epd->drawLine(c.x + r - 4, c.y, c.x + r - 10, c.y + 4, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
drawTextCenter(c.x + r / 2, c.y + 8, String(scale) + "m"); drawTextCenter(c.x + r / 2, c.y + 8, String(scale) + "m");
// alarm range circle // alarm range circle
@ -196,28 +197,28 @@ private:
// r and r_range are pixel values // r and r_range are pixel values
uint16_t r_range = int(alarm_range * r / scale); uint16_t r_range = int(alarm_range * r / scale);
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Alarm range = %d", r_range); LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Alarm range = %d", r_range);
getdisplay().drawCircle(c.x, c.y, r_range, commonData->fgcolor); epd->drawCircle(c.x, c.y, r_range, commonData->fgcolor);
} }
// draw anchor symbol (as bitmap) // draw anchor symbol (as bitmap)
getdisplay().drawXBitmap(c.x - anchor_width / 2, c.y - anchor_height / 2, epd->drawXBitmap(c.x - anchor_width / 2, c.y - anchor_height / 2,
anchor_bits, anchor_width, anchor_height, commonData->fgcolor); anchor_bits, anchor_width, anchor_height, commonData->fgcolor);
} }
void displayModeConfig() { void displayModeConfig() {
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("Anchor configuration"); epd->print("Anchor configuration");
// TODO // TODO
// show lat/lon for anchor pos // show lat/lon for anchor pos
// show lat/lon for boat pos // show lat/lon for boat pos
// show distance anchor <-> boat // show distance anchor <-> boat
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
for (int i = 0 ; i < menu->getItemCount(); i++) { for (int i = 0 ; i < menu->getItemCount(); i++) {
ConfigMenuItem *itm = menu->getItemByIndex(i); ConfigMenuItem *itm = menu->getItemByIndex(i);
if (!itm) { if (!itm) {
@ -228,14 +229,14 @@ private:
drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false); drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false);
if (inverted and editmode > 0) { if (inverted and editmode > 0) {
// triangle as edit marker // triangle as edit marker
getdisplay().fillTriangle(r.x + r.w + 20, r.y, r.x + r.w + 30, r.y + r.h / 2, r.x + r.w + 20, r.y + r.h, commonData->fgcolor); epd->fillTriangle(r.x + r.w + 20, r.y, r.x + r.w + 30, r.y + r.h / 2, r.x + r.w + 20, r.y + r.h, commonData->fgcolor);
} }
getdisplay().setCursor(r.x + r.w + 40, r.y + r.h - 4); epd->setCursor(r.x + r.w + 40, r.y + r.h - 4);
if (itm->getType() == "int") { if (itm->getType() == "int") {
getdisplay().print(itm->getValue()); epd->print(itm->getValue());
getdisplay().print(itm->getUnit()); epd->print(itm->getUnit());
} else { } else {
getdisplay().print(itm->getValue() == 0 ? "No" : "Yes"); epd->print(itm->getValue() == 0 ? "No" : "Yes");
} }
} }
} }
@ -399,7 +400,7 @@ public:
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Mode=%c", mode); LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor; Mode=%c", mode);
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
if (mode == 'N') { if (mode == 'N') {
displayModeNormal(pageData); displayModeNormal(pageData);

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -105,76 +106,76 @@ class PageBME280 : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 55); epd->setCursor(20, 55);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 90); epd->setCursor(20, 90);
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
// Switch font if format for any values // Switch font if format for any values
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90); epd->setCursor(180, 90);
// Show bus data // Show bus data
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); epd->fillRect(0, 105, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 145); epd->setCursor(20, 145);
getdisplay().print(name2); // Page name epd->print(name2); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
// Switch font if format for any values // Switch font if format for any values
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180); epd->setCursor(180, 180);
// Show bus data // Show bus data
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); epd->fillRect(0, 195, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 235); epd->setCursor(20, 235);
getdisplay().print(name3); // Page name epd->print(name3); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 270); epd->setCursor(20, 270);
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
// Switch font if format for any values // Switch font if format for any values
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(140, 270); epd->setCursor(140, 270);
// Show bus data // Show bus data
getdisplay().print(svalue3); // Real value as formated string epd->print(svalue3); // Real value as formated string
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -158,134 +159,134 @@ class PageBattery : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
// Show average settings // Show average settings
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
switch (average) { switch (average) {
case 0: case 0:
getdisplay().setCursor(60, 90); epd->setCursor(60, 90);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
getdisplay().setCursor(60, 180); epd->setCursor(60, 180);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
getdisplay().setCursor(60, 270); epd->setCursor(60, 270);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
break; break;
case 1: case 1:
getdisplay().setCursor(60, 90); epd->setCursor(60, 90);
getdisplay().print("Avg: 10s"); epd->print("Avg: 10s");
getdisplay().setCursor(60, 180); epd->setCursor(60, 180);
getdisplay().print("Avg: 10s"); epd->print("Avg: 10s");
getdisplay().setCursor(60, 270); epd->setCursor(60, 270);
getdisplay().print("Avg: 10s"); epd->print("Avg: 10s");
break; break;
case 2: case 2:
getdisplay().setCursor(60, 90); epd->setCursor(60, 90);
getdisplay().print("Avg: 60s"); epd->print("Avg: 60s");
getdisplay().setCursor(60, 180); epd->setCursor(60, 180);
getdisplay().print("Avg: 60s"); epd->print("Avg: 60s");
getdisplay().setCursor(60, 270); epd->setCursor(60, 270);
getdisplay().print("Avg: 60s"); epd->print("Avg: 60s");
break; break;
case 3: case 3:
getdisplay().setCursor(60, 90); epd->setCursor(60, 90);
getdisplay().print("Avg: 300s"); epd->print("Avg: 300s");
getdisplay().setCursor(60, 180); epd->setCursor(60, 180);
getdisplay().print("Avg: 300s"); epd->print("Avg: 300s");
getdisplay().setCursor(60, 270); epd->setCursor(60, 270);
getdisplay().print("Avg: 300s"); epd->print("Avg: 300s");
break; break;
default: default:
getdisplay().setCursor(60, 90); epd->setCursor(60, 90);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
getdisplay().setCursor(60, 180); epd->setCursor(60, 180);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
getdisplay().setCursor(60, 270); epd->setCursor(60, 270);
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
break; break;
} }
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 55); epd->setCursor(20, 55);
getdisplay().print(name1); // Value name epd->print(name1); // Value name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 90); epd->setCursor(20, 90);
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
// Show value // Show value
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90); epd->setCursor(180, 90);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
getdisplay().print(value1,2); // Real value as formated string epd->print(value1,2); // Real value as formated string
} }
else{ else{
getdisplay().print("---"); // No sensor data (sensor is off) epd->print("---"); // No sensor data (sensor is off)
} }
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); epd->fillRect(0, 105, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 145); epd->setCursor(20, 145);
getdisplay().print(name2); // Value name epd->print(name2); // Value name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
// Show value // Show value
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180); epd->setCursor(180, 180);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
getdisplay().print(value2,1); // Real value as formated string epd->print(value2,1); // Real value as formated string
} }
else{ else{
getdisplay().print("---"); // No sensor data (sensor is off) epd->print("---"); // No sensor data (sensor is off)
} }
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); epd->fillRect(0, 195, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 235); epd->setCursor(20, 235);
getdisplay().print(name3); // Value name epd->print(name3); // Value name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 270); epd->setCursor(20, 270);
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
// Show value // Show value
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 270); epd->setCursor(180, 270);
// Show bus data // Show bus data
if(String(powsensor1) != "off"){ if(String(powsensor1) != "off"){
getdisplay().print(value3,1); // Real value as formated string epd->print(value3,1); // Real value as formated string
} }
else{ else{
getdisplay().print("---"); // No sensor data (sensor is off) epd->print("---"); // No sensor data (sensor is off)
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -184,107 +185,107 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print("Bat."); epd->print("Bat.");
// Show battery type // Show battery type
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(90, 65); epd->setCursor(90, 65);
getdisplay().print(batType); epd->print(batType);
// Show voltage type // Show voltage type
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 140); epd->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;
getdisplay().print(bvoltage); epd->print(bvoltage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show battery capacity // Show battery capacity
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 200); epd->setCursor(10, 200);
if(batCapacity <= 999) getdisplay().print(batCapacity, 0); if(batCapacity <= 999) epd->print(batCapacity, 0);
if(batCapacity > 999) getdisplay().print(float(batCapacity/1000.0), 1); if(batCapacity > 999) epd->print(float(batCapacity/1000.0), 1);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
if(batCapacity <= 999) getdisplay().print("Ah"); if(batCapacity <= 999) epd->print("Ah");
if(batCapacity > 999) getdisplay().print("kAh"); if(batCapacity > 999) epd->print("kAh");
// Show info // Show info
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 235); epd->setCursor(10, 235);
getdisplay().print("Installed"); epd->print("Installed");
getdisplay().setCursor(10, 255); epd->setCursor(10, 255);
getdisplay().print("Battery Type"); epd->print("Battery Type");
// Show battery with fill level // Show battery with fill level
batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor); batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor);
// Show average settings // Show average settings
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(150, 145); epd->setCursor(150, 145);
switch (average) { switch (average) {
case 0: case 0:
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
break; break;
case 1: case 1:
getdisplay().print("Avg: 10s"); epd->print("Avg: 10s");
break; break;
case 2: case 2:
getdisplay().print("Avg: 60s"); epd->print("Avg: 60s");
break; break;
case 3: case 3:
getdisplay().print("Avg: 300s"); epd->print("Avg: 300s");
break; break;
default: default:
getdisplay().print("Avg: 1s"); epd->print("Avg: 1s");
break; break;
} }
// Show fill level in percent // Show fill level in percent
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 200); epd->setCursor(150, 200);
getdisplay().print(batPercentage); epd->print(batPercentage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("%"); epd->print("%");
// Show time to full discharge // Show time to full discharge
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 260); epd->setCursor(150, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(batRange < 9.9) getdisplay().print(batRange, 1); if(batRange < 9.9) epd->print(batRange, 1);
else getdisplay().print(batRange, 0); else epd->print(batRange, 0);
} }
else getdisplay().print("--"); else epd->print("--");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("h"); epd->print("h");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(270, 60); epd->setCursor(270, 60);
if(powerSensor == "off") getdisplay().print("Internal"); if(powerSensor == "off") epd->print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
getdisplay().print("INA219"); epd->print("INA219");
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
getdisplay().print("INA226"); epd->print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")";
} }
getdisplay().print(i2cAddr); epd->print(i2cAddr);
getdisplay().setCursor(270, 80); epd->setCursor(270, 80);
getdisplay().print("Sensor Modul"); epd->print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 140); epd->setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -293,46 +294,46 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
getdisplay().print(value1,1); epd->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) getdisplay().print(value1, 2); if(value1 <= 9.9) epd->print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1);
if(value1 > 99.9) getdisplay().print(value1, 0); if(value1 > 99.9) epd->print(value1, 0);
} }
else{ else{
getdisplay().print("---"); // Missing bus data epd->print("---"); // Missing bus data
} }
} }
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show actual current in A // Show actual current in A
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 200); epd->setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) getdisplay().print(value2, 2); if(value2 <= 9.9) epd->print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
if(value2 > 99.9) getdisplay().print(value2, 0); if(value2 > 99.9) epd->print(value2, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("A"); epd->print("A");
// Show actual consumption in W // Show actual consumption in W
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 260); epd->setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) getdisplay().print(value3, 2); if(value3 <= 9.9) epd->print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
if(value3 > 99.9) getdisplay().print(value3, 0); if(value3 > 99.9) epd->print(value3, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); epd->print("W");
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -182,65 +183,65 @@ bool homevalid = false; // homelat and homelon are valid
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
time_t tv = mktime(&commonData->data.rtcTime) + timezone * 3600; time_t tv = mktime(&commonData->data.rtcTime) + timezone * 3600;
struct tm *local_tm = localtime(&tv); struct tm *local_tm = localtime(&tv);
// Show values GPS date // Show values GPS date
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
if (holdvalues == false) { if (holdvalues == false) {
if (source == 'G') { if (source == 'G') {
// GPS value // GPS value
getdisplay().print(svalue2); epd->print(svalue2);
} else if (commonData->data.rtcValid) { } else if (commonData->data.rtcValid) {
// RTC value // RTC value
if (tz == 'L') { if (tz == 'L') {
getdisplay().print(formatDate(dateformat, local_tm->tm_year + 1900, local_tm->tm_mon + 1, local_tm->tm_mday)); epd->print(formatDate(dateformat, local_tm->tm_year + 1900, local_tm->tm_mon + 1, local_tm->tm_mday));
} }
else { else {
getdisplay().print(formatDate(dateformat, commonData->data.rtcTime.tm_year + 1900, commonData->data.rtcTime.tm_mon + 1, commonData->data.rtcTime.tm_mday)); epd->print(formatDate(dateformat, commonData->data.rtcTime.tm_year + 1900, commonData->data.rtcTime.tm_mon + 1, commonData->data.rtcTime.tm_mday));
} }
} else { } else {
getdisplay().print("---"); epd->print("---");
} }
} else { } else {
getdisplay().print(svalue2old); epd->print(svalue2old);
} }
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 95); epd->setCursor(10, 95);
getdisplay().print("Date"); // Name epd->print("Date"); // Name
// Horizintal separator left // Horizintal separator left
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
// Show values GPS time // Show values GPS time
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 250); epd->setCursor(10, 250);
if (holdvalues == false) { if (holdvalues == false) {
if (source == 'G') { if (source == 'G') {
getdisplay().print(svalue1); // Value epd->print(svalue1); // Value
} }
else if (commonData->data.rtcValid) { else if (commonData->data.rtcValid) {
if (tz == 'L') { if (tz == 'L') {
getdisplay().print(formatTime('s', local_tm->tm_hour, local_tm->tm_min, local_tm->tm_sec)); epd->print(formatTime('s', local_tm->tm_hour, local_tm->tm_min, local_tm->tm_sec));
} }
else { else {
getdisplay().print(formatTime('s', commonData->data.rtcTime.tm_hour, commonData->data.rtcTime.tm_min, commonData->data.rtcTime.tm_sec)); epd->print(formatTime('s', commonData->data.rtcTime.tm_hour, commonData->data.rtcTime.tm_min, commonData->data.rtcTime.tm_sec));
} }
} else { } else {
getdisplay().print("---"); epd->print("---");
} }
} }
else { else {
getdisplay().print(svalue1old); epd->print(svalue1old);
} }
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 220); epd->setCursor(10, 220);
getdisplay().print("Time"); // Name epd->print("Time"); // Name
// Show values sunrise // Show values sunrise
String sunrise = "---"; String sunrise = "---";
@ -251,16 +252,16 @@ bool homevalid = false; // homelat and homelon are valid
sunrise = String("06:42"); sunrise = String("06:42");
} }
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 65); epd->setCursor(335, 65);
if(holdvalues == false) getdisplay().print(sunrise); // Value if(holdvalues == false) epd->print(sunrise); // Value
else getdisplay().print(svalue5old); else epd->print(svalue5old);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 95); epd->setCursor(335, 95);
getdisplay().print("SunR"); // Name epd->print("SunR"); // Name
// Horizintal separator right // Horizintal separator right
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
// Show values sunset // Show values sunset
String sunset = "---"; String sunset = "---";
@ -271,13 +272,13 @@ bool homevalid = false; // homelat and homelon are valid
sunset = String("21:03"); sunset = String("21:03");
} }
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 250); epd->setCursor(335, 250);
if(holdvalues == false) getdisplay().print(sunset); // Value if(holdvalues == false) epd->print(sunset); // Value
else getdisplay().print(svalue6old); else epd->print(svalue6old);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 220); epd->setCursor(335, 220);
getdisplay().print("SunS"); // Name epd->print("SunS"); // Name
//******************************************************************************************* //*******************************************************************************************
@ -285,8 +286,8 @@ bool homevalid = false; // homelat and homelon are valid
int rInstrument = 110; // Radius of clock int rInstrument = 110; // Radius of clock
float pi = 3.141592; float pi = 3.141592;
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
for(int i=0; i<360; i=i+1) for(int i=0; i<360; i=i+1)
{ {
@ -314,11 +315,11 @@ bool homevalid = false; // homelat and homelon are valid
// 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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().print(ii); epd->print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
@ -327,7 +328,7 @@ bool homevalid = false; // homelat and homelon are valid
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);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
sinx=sin(i/180.0*pi); sinx=sin(i/180.0*pi);
cosx=cos(i/180.0*pi); cosx=cos(i/180.0*pi);
} }
@ -339,31 +340,31 @@ bool homevalid = false; // homelat and homelon are valid
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
} }
// Print Unit in clock // Print Unit in clock
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(175, 110); epd->setCursor(175, 110);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(tz == 'L' ? "LOT" : "UTC"); epd->print(tz == 'L' ? "LOT" : "UTC");
} }
else{ else{
getdisplay().print(unit2old); // date unit epd->print(unit2old); // date unit
} }
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(185, 190); epd->setCursor(185, 190);
if (source == 'G') { if (source == 'G') {
getdisplay().print("GPS"); epd->print("GPS");
} else { } else {
getdisplay().print("RTC"); epd->print("RTC");
} }
// Clock values // Clock values
@ -406,7 +407,7 @@ bool homevalid = false; // homelat and homelon are valid
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.5); float yy2 = -(rInstrument * 0.5);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -416,7 +417,7 @@ bool homevalid = false; // homelat and homelon are valid
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.5); float iy1 = -(rInstrument * 0.5);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
@ -432,7 +433,7 @@ bool homevalid = false; // homelat and homelon are valid
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument - 15); float yy2 = -(rInstrument - 15);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -442,14 +443,14 @@ bool homevalid = false; // homelat and homelon are valid
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument - 15); float iy1 = -(rInstrument - 15);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -109,27 +110,27 @@ class PageCompass : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Horizontal line 2 pix top & bottom // Horizontal line 2 pix top & bottom
// Print data on top half // Print data on top half
getdisplay().fillRect(0, 130, 400, 2, commonData->fgcolor); epd->fillRect(0, 130, 400, 2, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(10, 70); epd->setCursor(10, 70);
getdisplay().print(DataName[WhichDataDisplay]); // Page name epd->print(DataName[WhichDataDisplay]); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 120); epd->setCursor(10, 120);
getdisplay().print(DataUnits[WhichDataDisplay]); epd->print(DataUnits[WhichDataDisplay]);
getdisplay().setCursor(190, 120); epd->setCursor(190, 120);
getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); epd->setFont(&DSEG7Classic_BoldItalic42pt7b);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(DataText[WhichDataDisplay]); // Real value as formated string epd->print(DataText[WhichDataDisplay]); // Real value as formated string
} }
else{ else{
getdisplay().print(OldDataText[WhichDataDisplay]); // Old value as formated string epd->print(OldDataText[WhichDataDisplay]); // Old value as formated string
} }
if(DataValid[WhichDataDisplay] == true){ if(DataValid[WhichDataDisplay] == true){
OldDataText[WhichDataDisplay] = DataText[WhichDataDisplay]; // Save the old value OldDataText[WhichDataDisplay] = DataText[WhichDataDisplay]; // Save the old value
@ -148,14 +149,14 @@ class PageCompass : public Page
char buffer[bsize+1]; char buffer[bsize+1];
buffer[0]=0; buffer[0]=0;
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(10, Compass_Y0-60); epd->setCursor(10, Compass_Y0-60);
getdisplay().print(DataName[WhichDataCompass]); // Page name epd->print(DataName[WhichDataCompass]); // Page name
// Draw compass base line and pointer // Draw compass base line and pointer
getdisplay().fillRect(0, Compass_Y0, 400, 3, commonData->fgcolor); epd->fillRect(0, Compass_Y0, 400, 3, commonData->fgcolor);
getdisplay().fillTriangle(Compass_X0,Compass_Y0-40,Compass_X0-10,Compass_Y0-80,Compass_X0+10,Compass_Y0-80,commonData->fgcolor); epd->fillTriangle(Compass_X0,Compass_Y0-40,Compass_X0-10,Compass_Y0-80,Compass_X0+10,Compass_Y0-80,commonData->fgcolor);
// Draw trendlines // Draw trendlines
for ( int i = 1; i < abs(TheTrend) / 2; i++){ for ( int i = 1; i < abs(TheTrend) / 2; i++){
int x1; int x1;
@ -164,7 +165,7 @@ class PageCompass : public Page
else else
x1 = Compass_X0 - 20 * ( i + 1 ); x1 = Compass_X0 - 20 * ( i + 1 );
getdisplay().fillRect(x1, Compass_Y0 -55, 10, 6, commonData->fgcolor); epd->fillRect(x1, Compass_Y0 -55, 10, 6, commonData->fgcolor);
} }
// Central line + satellite lines // Central line + satellite lines
double NextSector = round(TheAngle / ( M_PI / 9 )) * ( M_PI / 9 ); // Get the next 20degree value double NextSector = round(TheAngle / ( M_PI / 9 )) * ( M_PI / 9 ); // Get the next 20degree value
@ -174,28 +175,28 @@ class PageCompass : public Page
for ( int i = 0; i <=4; i++ ){ for ( int i = 0; i <=4; i++ ){
int x0; int x0;
x0 = Compass_X0 + Delta_X + 2 * i * 5 * Compass_LineDelta; x0 = Compass_X0 + Delta_X + 2 * i * 5 * Compass_LineDelta;
getdisplay().fillRect(x0-2, Compass_Y0 - 2 * Compass_LineLength, 5, 2 * Compass_LineLength, commonData->fgcolor); epd->fillRect(x0-2, Compass_Y0 - 2 * Compass_LineLength, 5, 2 * Compass_LineLength, commonData->fgcolor);
x0 = Compass_X0 + Delta_X + ( 2 * i + 1 ) * 5 * Compass_LineDelta; x0 = Compass_X0 + Delta_X + ( 2 * i + 1 ) * 5 * Compass_LineDelta;
getdisplay().fillRect(x0-1, Compass_Y0 - Compass_LineLength, 3, Compass_LineLength, commonData->fgcolor); epd->fillRect(x0-1, Compass_Y0 - Compass_LineLength, 3, Compass_LineLength, commonData->fgcolor);
x0 = Compass_X0 + Delta_X - 2 * i * 5 * Compass_LineDelta; x0 = Compass_X0 + Delta_X - 2 * i * 5 * Compass_LineDelta;
getdisplay().fillRect(x0-2, Compass_Y0 - 2 * Compass_LineLength, 5, 2 * Compass_LineLength, commonData->fgcolor); epd->fillRect(x0-2, Compass_Y0 - 2 * Compass_LineLength, 5, 2 * Compass_LineLength, commonData->fgcolor);
x0 = Compass_X0 + Delta_X - ( 2 * i + 1 ) * 5 * Compass_LineDelta; x0 = Compass_X0 + Delta_X - ( 2 * i + 1 ) * 5 * Compass_LineDelta;
getdisplay().fillRect(x0-1, Compass_Y0 - Compass_LineLength, 3, Compass_LineLength, commonData->fgcolor); epd->fillRect(x0-1, Compass_Y0 - Compass_LineLength, 3, Compass_LineLength, commonData->fgcolor);
} }
getdisplay().fillRect(0, Compass_Y0, 400, 3, commonData->fgcolor); epd->fillRect(0, Compass_Y0, 400, 3, commonData->fgcolor);
// Add the numbers to the compass band // Add the numbers to the compass band
int x0; int x0;
float AngleToDisplay = NextSector * 180.0 / M_PI; float AngleToDisplay = NextSector * 180.0 / M_PI;
x0 = Compass_X0 + Delta_X; x0 = Compass_X0 + Delta_X;
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
do { do {
getdisplay().setCursor(x0 - 40, Compass_Y0 + 40); epd->setCursor(x0 - 40, Compass_Y0 + 40);
snprintf(buffer,bsize,"%03.0f", AngleToDisplay); snprintf(buffer,bsize,"%03.0f", AngleToDisplay);
getdisplay().print(buffer); epd->print(buffer);
AngleToDisplay += 20; AngleToDisplay += 20;
if ( AngleToDisplay >= 360.0 ) if ( AngleToDisplay >= 360.0 )
AngleToDisplay -= 360.0; AngleToDisplay -= 360.0;
@ -208,7 +209,7 @@ class PageCompass : public Page
x0 = Compass_X0 + Delta_X + 4 * 5 * Compass_LineDelta; x0 = Compass_X0 + Delta_X + 4 * 5 * Compass_LineDelta;
do { do {
getdisplay().setCursor(x0 - 40, Compass_Y0 + 40); epd->setCursor(x0 - 40, Compass_Y0 + 40);
snprintf(buffer,bsize,"%03.0f", AngleToDisplay); snprintf(buffer,bsize,"%03.0f", AngleToDisplay);
// Quick and dirty way to prevent wrapping text in next line // Quick and dirty way to prevent wrapping text in next line
if ( ( x0 - 40 ) > 380 ) if ( ( x0 - 40 ) > 380 )
@ -218,7 +219,7 @@ class PageCompass : public Page
else if ( ( x0 - 40 ) > 325 ) else if ( ( x0 - 40 ) > 325 )
buffer[2] = 0; buffer[2] = 0;
getdisplay().print(buffer); epd->print(buffer);
AngleToDisplay -= 20; AngleToDisplay -= 20;
if ( AngleToDisplay < 0 ) if ( AngleToDisplay < 0 )
@ -230,8 +231,8 @@ class PageCompass : public Page
// x_test += 2; // x_test += 2;
// snprintf(buffer,bsize,"%03d", x_test); // snprintf(buffer,bsize,"%03d", x_test);
// getdisplay().setCursor(x_test, Compass_Y0 - 60); // epd->setCursor(x_test, Compass_Y0 - 60);
// getdisplay().print(buffer); // epd->print(buffer);
// if ( x_test > 390) // if ( x_test > 390)
// x_test = 320; // x_test = 320;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -91,37 +92,37 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 55); epd->setCursor(20, 55);
getdisplay().print("Depth"); // Page name epd->print("Depth"); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 90); epd->setCursor(20, 90);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->print(unit1old);
} }
// Set font // Set font
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90); epd->setCursor(180, 90);
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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
@ -131,35 +132,35 @@ public:
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); epd->fillRect(0, 105, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 145); epd->setCursor(20, 145);
getdisplay().print("Speed"); // Page name epd->print("Speed"); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); epd->print(unit2old);
} }
// Setfont // Setfont
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180); epd->setCursor(180, 180);
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue2old); // Old value as formated string epd->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
@ -169,35 +170,35 @@ public:
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); epd->fillRect(0, 195, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 220); epd->setCursor(20, 220);
getdisplay().print("Log"); // Page name epd->print("Log"); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 240); epd->setCursor(20, 240);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); epd->print(unit3old);
} }
// Set font // Set font
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(80, 270); epd->setCursor(80, 270);
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue3); // Real value as formated string epd->print(svalue3); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue3old); // Old value as formated string epd->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
@ -207,35 +208,35 @@ public:
// ############### Vertical Line ################ // ############### Vertical Line ################
// Vertical line 3 pix // Vertical line 3 pix
getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); epd->fillRect(200, 195, 3, 75, commonData->fgcolor);
// ############### Value 4 ################ // ############### Value 4 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(220, 220); epd->setCursor(220, 220);
getdisplay().print("Temp"); // Page name epd->print("Temp"); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(220, 240); epd->setCursor(220, 240);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit4); // Unit epd->print(unit4); // Unit
} }
else{ else{
getdisplay().print(unit4old); epd->print(unit4old);
} }
// Set font // Set font
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(280, 270); epd->setCursor(280, 270);
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue4); // Real value as formated string epd->print(svalue4); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue4old); // Old value as formated string epd->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

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -138,17 +139,17 @@ class PageFluid : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); epd->setPartialWindow(0, 0, epd->width(), epd->height());
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// descriptions // descriptions
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 60); epd->setCursor(20, 60);
getdisplay().print("Fluid"); epd->print("Fluid");
getdisplay().setCursor(300, 60); epd->setCursor(300, 60);
getdisplay().print(xdrDelete(name1).substring(0, 6)); epd->print(xdrDelete(name1).substring(0, 6));
// analog instrument // analog instrument
// scale from -120 to 120 // scale from -120 to 120
@ -158,11 +159,11 @@ class PageFluid : public Page
uint8_t r = 110; uint8_t r = 110;
// circular frame // circular frame
getdisplay().drawCircle(c.x, c.y, r+5, commonData->fgcolor); epd->drawCircle(c.x, c.y, r+5, commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, r+2, commonData->fgcolor); epd->fillCircle(c.x, c.y, r+2, commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, r-1, commonData->bgcolor); epd->fillCircle(c.x, c.y, r-1, commonData->bgcolor);
// center of pointer as dot // center of pointer as dot
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); epd->fillCircle(c.x, c.y, 8, commonData->fgcolor);
// value down centered // value down centered
char buffer[6]; char buffer[6];
@ -176,32 +177,32 @@ class PageFluid : public Page
// draw symbol (as bitmap) // draw symbol (as bitmap)
switch (fluidtype) { switch (fluidtype) {
case 0: case 0:
getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor);
break; break;
case 1: case 1:
getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor);
break; break;
case 2: // gray water no symbol yet case 2: // gray water no symbol yet
// getdisplay().drawXBitmap(c.x-8, c.y-50, gray_bits, gray_width, gray_height, commonData->fgcolor); // epd->drawXBitmap(c.x-8, c.y-50, gray_bits, gray_width, gray_height, commonData->fgcolor);
break; break;
case 3: case 3:
getdisplay().drawXBitmap(c.x-8, c.y-50, fish_bits, fish_width, fish_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, fish_bits, fish_width, fish_height, commonData->fgcolor);
break; break;
case 4: case 4:
getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor);
break; break;
case 5: case 5:
getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData->fgcolor);
break; break;
case 6: case 6:
getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData->fgcolor); epd->drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData->fgcolor);
break; break;
} }
Point p, pr; Point p, pr;
// scale texts // scale texts
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
p = {c.x, c.y - r + 30}; p = {c.x, c.y - r + 30};
drawTextCenter(p.x, p.y, "1/2"); drawTextCenter(p.x, p.y, "1/2");
pr = rotatePoint(c, p, -60); pr = rotatePoint(c, p, -60);
@ -210,7 +211,7 @@ class PageFluid : public Page
drawTextCenter(pr.x, pr.y, "3/4"); drawTextCenter(pr.x, pr.y, "3/4");
// empty and full // empty and full
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
p = rotatePoint(c, {c.x, c.y - r + 30}, -130); p = rotatePoint(c, {c.x, c.y - r + 30}, -130);
drawTextCenter(p.x, p.y, "E"); drawTextCenter(p.x, p.y, "E");
p = rotatePoint(c, {c.x, c.y - r + 30}, 130); p = rotatePoint(c, {c.x, c.y - r + 30}, 130);
@ -236,7 +237,7 @@ class PageFluid : public Page
continue; continue;
} }
p = rotatePoint(c, {c.x, c.y - r + 10}, angle); p = rotatePoint(c, {c.x, c.y - r + 10}, angle);
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); epd->fillCircle(p.x, p.y, 3, commonData->fgcolor);
} }
// pointer // pointer
@ -249,7 +250,7 @@ class PageFluid : public Page
}; };
fillPoly4(rotatePoints(c, pts, -120 + fluidlevel * 2.4), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, -120 + fluidlevel * 2.4), commonData->fgcolor);
// Pointer axis is white // Pointer axis is white
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); epd->fillCircle(c.x, c.y, 6, commonData->bgcolor);
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -96,47 +97,47 @@ class PageFourValues : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(20, 45); epd->setCursor(20, 45);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 65); epd->setCursor(20, 65);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(120, 55); epd->setCursor(120, 55);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(150, 58); epd->setCursor(150, 58);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(180, 65); epd->setCursor(180, 65);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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
@ -146,45 +147,45 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 80, 400, 3, commonData->fgcolor); epd->fillRect(0, 80, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(20, 113); epd->setCursor(20, 113);
getdisplay().print(name2); // Page name epd->print(name2); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 133); epd->setCursor(20, 133);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(120, 123); epd->setCursor(120, 123);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(150, 123); epd->setCursor(150, 123);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(180, 133); epd->setCursor(180, 133);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue2old); // Old value as formated string epd->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,45 +195,45 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 146, 400, 3, commonData->fgcolor); epd->fillRect(0, 146, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(20, 181); epd->setCursor(20, 181);
getdisplay().print(name3); // Page name epd->print(name3); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 201); epd->setCursor(20, 201);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(120, 191); epd->setCursor(120, 191);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(150, 191); epd->setCursor(150, 191);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(180, 201); epd->setCursor(180, 201);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue3); // Real value as formated string epd->print(svalue3); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue3old); // Old value as formated string epd->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
@ -242,45 +243,45 @@ class PageFourValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 214, 400, 3, commonData->fgcolor); epd->fillRect(0, 214, 400, 3, commonData->fgcolor);
// ############### Value 4 ################ // ############### Value 4 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(20, 249); epd->setCursor(20, 249);
getdisplay().print(name4); // Page name epd->print(name4); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 269); epd->setCursor(20, 269);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit4); // Unit epd->print(unit4); // Unit
} }
else{ else{
getdisplay().print(unit4old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(120, 259); epd->setCursor(120, 259);
} }
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(150, 259); epd->setCursor(150, 259);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(180, 269); epd->setCursor(180, 269);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue4); // Real value as formated string epd->print(svalue4); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue4old); // Old value as formated string epd->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

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -96,47 +97,47 @@ class PageFourValues2 : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 55); epd->setCursor(20, 55);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 90); epd->setCursor(20, 90);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(100, 90); epd->setCursor(100, 90);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(180, 77); epd->setCursor(180, 77);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90); epd->setCursor(180, 90);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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
@ -146,45 +147,45 @@ class PageFourValues2 : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); epd->fillRect(0, 105, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 145); epd->setCursor(20, 145);
getdisplay().print(name2); // Page name epd->print(name2); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(100, 180); epd->setCursor(100, 180);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(180, 158); epd->setCursor(180, 158);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180); epd->setCursor(180, 180);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue2old); // Old value as formated string epd->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,45 +195,45 @@ class PageFourValues2 : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); epd->fillRect(0, 195, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 220); epd->setCursor(20, 220);
getdisplay().print(name3); // Page name epd->print(name3); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 240); epd->setCursor(20, 240);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(50, 240); epd->setCursor(50, 240);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(100, 240); epd->setCursor(100, 240);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(80, 270); epd->setCursor(80, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue3); // Real value as formated string epd->print(svalue3); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue3old); // Old value as formated string epd->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
@ -242,45 +243,45 @@ class PageFourValues2 : public Page
// ############### Vertical Line ################ // ############### Vertical Line ################
// Vertical line 3 pix // Vertical line 3 pix
getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); epd->fillRect(200, 195, 3, 75, commonData->fgcolor);
// ############### Value 4 ################ // ############### Value 4 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(220, 220); epd->setCursor(220, 220);
getdisplay().print(name4); // Page name epd->print(name4); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(220, 240); epd->setCursor(220, 240);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit4); // Unit epd->print(unit4); // Unit
} }
else{ else{
getdisplay().print(unit4old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(250, 240); epd->setCursor(250, 240);
} }
else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(300, 240); epd->setCursor(300, 240);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(280, 270); epd->setCursor(280, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue4); // Real value as formated string epd->print(svalue4); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue4old); // Old value as formated string epd->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

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -83,77 +84,77 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print("Power"); epd->print("Power");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(12, 82); epd->setCursor(12, 82);
getdisplay().print("Generator"); epd->print("Generator");
// Show voltage type // Show voltage type
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 140); epd->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;
getdisplay().print(bvoltage); epd->print(bvoltage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show solar power // Show solar power
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 200); epd->setCursor(10, 200);
if(genPower <= 999) getdisplay().print(genPower, 0); if(genPower <= 999) epd->print(genPower, 0);
if(genPower > 999) getdisplay().print(float(genPower/1000.0), 1); if(genPower > 999) epd->print(float(genPower/1000.0), 1);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
if(genPower <= 999) getdisplay().print("W"); if(genPower <= 999) epd->print("W");
if(genPower > 999) getdisplay().print("kW"); if(genPower > 999) epd->print("kW");
// Show info // Show info
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 235); epd->setCursor(10, 235);
getdisplay().print("Installed"); epd->print("Installed");
getdisplay().setCursor(10, 255); epd->setCursor(10, 255);
getdisplay().print("Power Modul"); epd->print("Power Modul");
// Show generator // Show generator
generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor); generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor);
// Show load level in percent // Show load level in percent
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 200); epd->setCursor(150, 200);
getdisplay().print(genPercentage); epd->print(genPercentage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("%"); epd->print("%");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(150, 235); epd->setCursor(150, 235);
getdisplay().print("Load"); epd->print("Load");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(270, 60); epd->setCursor(270, 60);
if(powerSensor == "off") getdisplay().print("Internal"); if(powerSensor == "off") epd->print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
getdisplay().print("INA219"); epd->print("INA219");
i2cAddr = " (0x" + String(INA219_I2C_ADDR3, HEX) + ")"; i2cAddr = " (0x" + String(INA219_I2C_ADDR3, HEX) + ")";
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
getdisplay().print("INA226"); epd->print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")";
} }
getdisplay().print(i2cAddr); epd->print(i2cAddr);
getdisplay().setCursor(270, 80); epd->setCursor(270, 80);
getdisplay().print("Sensor Modul"); epd->print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 140); epd->setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -162,46 +163,46 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
getdisplay().print(value1,1); epd->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) getdisplay().print(value1, 2); if(value1 <= 9.9) epd->print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1);
if(value1 > 99.9) getdisplay().print(value1, 0); if(value1 > 99.9) epd->print(value1, 0);
} }
else{ else{
getdisplay().print("---"); // Missing bus data epd->print("---"); // Missing bus data
} }
} }
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show actual current in A // Show actual current in A
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 200); epd->setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) getdisplay().print(value2, 2); if(value2 <= 9.9) epd->print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
if(value2 > 99.9) getdisplay().print(value2, 0); if(value2 > 99.9) epd->print(value2, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("A"); epd->print("A");
// Show actual consumption in W // Show actual consumption in W
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 260); epd->setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) getdisplay().print(value3, 2); if(value3 <= 9.9) epd->print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
if(value3 > 99.9) getdisplay().print(value3, 0); if(value3 > 99.9) epd->print(value3, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); epd->print("W");
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -68,7 +69,7 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
//******************************************************************************************* //*******************************************************************************************
@ -76,9 +77,9 @@ public:
int rInstrument = 110; // Radius of KeelPosition int rInstrument = 110; // Radius of KeelPosition
float pi = 3.141592; float pi = 3.141592;
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle epd->fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle
for(int i=90; i<=270; i=i+10) for(int i=90; i<=270; i=i+10)
{ {
@ -105,17 +106,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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().print(ii); epd->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);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
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);
@ -126,10 +127,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
@ -163,7 +164,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.6); float yy2 = -(rInstrument * 0.6);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -173,36 +174,36 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.6); float iy1 = -(rInstrument * 0.6);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
// Draw counterweight // Draw counterweight
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); epd->fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 140, startwidth + 22, commonData->bgcolor); epd->fillCircle(200, 140, startwidth + 22, commonData->bgcolor);
getdisplay().fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle epd->fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle
getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle epd->fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle
getdisplay().fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line epd->fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line
// Print label // Print label
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(100, 70); epd->setCursor(100, 70);
getdisplay().print("Keel Position"); // Label epd->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
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(175, 110); epd->setCursor(175, 110);
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
// Print Unit of keel position // Print Unit of keel position
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(145, 110); epd->setCursor(145, 110);
getdisplay().print("No sensor data"); // Info missing sensor epd->print("No sensor data"); // Info missing sensor
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -60,44 +61,44 @@ class PageOneValue : public Page
//*********************************************************** //***********************************************************
/// Set display in partial refresh mode /// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
// Show name // Show name
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold32pt8b); epd->setFont(&Ubuntu_Bold32pt8b);
getdisplay().setCursor(20, 100); epd->setCursor(20, 100);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(270, 100); epd->setCursor(270, 100);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold32pt8b); epd->setFont(&Ubuntu_Bold32pt8b);
getdisplay().setCursor(20, 200); epd->setCursor(20, 200);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b); epd->setFont(&DSEG7Classic_BoldItalic60pt7b);
getdisplay().setCursor(20, 240); epd->setCursor(20, 240);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -116,52 +117,52 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show roll limit // Show roll limit
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print(rolllimit); // Value epd->print(rolllimit); // Value
//getdisplay().print(svalue1); // Value //epd->print(svalue1); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 95); epd->setCursor(10, 95);
getdisplay().print("Limit"); // Name epd->print("Limit"); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 115); epd->setCursor(10, 115);
getdisplay().print("DEG"); epd->print("DEG");
// Horizintal separator left // Horizintal separator left
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
// Show roll value // Show roll value
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 270); epd->setCursor(10, 270);
if(holdvalues == false) getdisplay().print(svalue1); // Value if(holdvalues == false) epd->print(svalue1); // Value
else getdisplay().print(svalue1old); else epd->print(svalue1old);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 220); epd->setCursor(10, 220);
getdisplay().print(name1); // Name epd->print(name1); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 190); epd->setCursor(10, 190);
getdisplay().print("Deg"); epd->print("Deg");
// Horizintal separator right // Horizintal separator right
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
// Show pitch value // Show pitch value
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 270); epd->setCursor(295, 270);
if(holdvalues == false) getdisplay().print(svalue2); // Value if(holdvalues == false) epd->print(svalue2); // Value
else getdisplay().print(svalue2old); else epd->print(svalue2old);
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 220); epd->setCursor(335, 220);
getdisplay().print(name2); // Name epd->print(name2); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 190); epd->setCursor(335, 190);
getdisplay().print("Deg"); epd->print("Deg");
//******************************************************************************************* //*******************************************************************************************
@ -169,8 +170,8 @@ public:
int rInstrument = 100; // Radius of instrument int rInstrument = 100; // Radius of instrument
float pi = 3.141592; float pi = 3.141592;
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
for(int i=0; i<360; i=i+10) for(int i=0; i<360; i=i+10)
{ {
@ -194,17 +195,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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 20 == 0){ if(i % 20 == 0){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().print(ii); epd->print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*M_PI); float x1c = 200 + rInstrument*sin(i/180.0*M_PI);
float y1c = 150 - rInstrument*cos(i/180.0*M_PI); float y1c = 150 - rInstrument*cos(i/180.0*M_PI);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
float sinx=sin(i/180.0*M_PI); float sinx=sin(i/180.0*M_PI);
float cosx=cos(i/180.0*M_PI); float cosx=cos(i/180.0*M_PI);
@ -215,10 +216,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
@ -239,7 +240,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.7); float yy2 = -(rInstrument * 0.7);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -249,28 +250,28 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.7); float iy1 = -(rInstrument * 0.7);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
// Draw counterweight // Draw counterweight
getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); epd->fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 150, startwidth + 22, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 22, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle epd->fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // 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);
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (right triangle) epd->fillTriangle(x0, y0, x1, y1, x2, y2, commonData->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);
getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle) epd->fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle)
getdisplay().fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line epd->fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line
// Draw roll pointer // Draw roll pointer
startwidth = 4; // Start width of pointer startwidth = 4; // Start width of pointer
@ -283,7 +284,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument - 15); float yy2 = -(rInstrument - 15);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -293,15 +294,15 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument - 15); float iy1 = -(rInstrument - 15);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
else{ else{
// Print sensor info // Print sensor info
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(145, 200); epd->setCursor(145, 200);
getdisplay().print("No sensor data"); // Info missing sensor epd->print("No sensor data"); // Info missing sensor
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -74,7 +75,7 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
//******************************************************************************************* //*******************************************************************************************
@ -82,9 +83,9 @@ public:
int rInstrument = 110; // Radius of RudderPosition int rInstrument = 110; // Radius of RudderPosition
float pi = 3.141592; float pi = 3.141592;
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle epd->fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle
for(int i=90; i<=270; i=i+10) for(int i=90; i<=270; i=i+10)
{ {
@ -112,17 +113,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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().print(ii); epd->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);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
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);
@ -133,10 +134,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
@ -144,28 +145,28 @@ public:
} }
// Print label // Print label
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(80, 70); epd->setCursor(80, 70);
getdisplay().print("Rudder Position"); // Label epd->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){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(175, 110); epd->setCursor(175, 110);
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(175, 110); epd->setCursor(175, 110);
getdisplay().print(unit1old); // Unit epd->print(unit1old); // Unit
} }
} }
else{ else{
// Print Unit of keel position // Print Unit of keel position
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(145, 110); epd->setCursor(145, 110);
getdisplay().print("No sensor data"); // Info missing sensor epd->print("No sensor data"); // Info missing sensor
} }
// Calculate rudder position // Calculate rudder position
@ -188,7 +189,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument * 0.5); float yy2 = -(rInstrument * 0.5);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -198,14 +199,14 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument * 0.5); float iy1 = -(rInstrument * 0.5);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -77,13 +78,13 @@ class PageSixValues : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
for (int i = 0; i < ( HowManyValues / 2 ); i++){ for (int i = 0; i < ( HowManyValues / 2 ); i++){
if (i < (HowManyValues / 2) - 1) { // Don't draw horizontal line after last line of values -> standard design if (i < (HowManyValues / 2) - 1) { // Don't draw horizontal line after last line of values -> standard design
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, SixValues_y1+(i+1)*SixValues_DeltaY, 400, 3, commonData->fgcolor); epd->fillRect(0, SixValues_y1+(i+1)*SixValues_DeltaY, 400, 3, commonData->fgcolor);
} }
for (int j = 0; j < 2; j++){ for (int j = 0; j < 2; j++){
int ValueIndex = i * 2 + j; int ValueIndex = i * 2 + j;
@ -92,53 +93,53 @@ class PageSixValues : public Page
LOG_DEBUG(GwLog::LOG,"Drawing at PageSixValue: %d %s %f %s", ValueIndex, DataName[ValueIndex], DataValue[ValueIndex], DataFormat[ValueIndex] ); LOG_DEBUG(GwLog::LOG,"Drawing at PageSixValue: %d %s %f %s", ValueIndex, DataName[ValueIndex], DataValue[ValueIndex], DataFormat[ValueIndex] );
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(x0, y0+25); epd->setCursor(x0, y0+25);
getdisplay().print(DataName[ValueIndex]); // Page name epd->print(DataName[ValueIndex]); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(x0, y0+72); epd->setCursor(x0, y0+72);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(DataUnits[ValueIndex]); // Unit epd->print(DataUnits[ValueIndex]); // Unit
} }
else{ else{
getdisplay().print(OldDataUnits[ValueIndex]); epd->print(OldDataUnits[ValueIndex]);
} }
// Switch font if format for any values // Switch font if format for any values
if(DataFormat[ValueIndex] == "formatLatitude" || DataFormat[ValueIndex] == "formatLongitude"){ if(DataFormat[ValueIndex] == "formatLatitude" || DataFormat[ValueIndex] == "formatLongitude"){
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(x0+10, y0+60); epd->setCursor(x0+10, y0+60);
} }
else if(DataFormat[ValueIndex] == "formatTime" || DataFormat[ValueIndex] == "formatDate"){ else if(DataFormat[ValueIndex] == "formatTime" || DataFormat[ValueIndex] == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(x0+20,y0+55); epd->setCursor(x0+20,y0+55);
} }
// pressure in hPa // pressure in hPa
else if(DataFormat[ValueIndex] == "formatXdr:P:P"){ else if(DataFormat[ValueIndex] == "formatXdr:P:P"){
getdisplay().setFont(&DSEG7Classic_BoldItalic26pt7b); epd->setFont(&DSEG7Classic_BoldItalic26pt7b);
getdisplay().setCursor(x0+5, y0+70); epd->setCursor(x0+5, y0+70);
} }
// RPM // RPM
else if(DataFormat[ValueIndex] == "formatXdr:T:R"){ else if(DataFormat[ValueIndex] == "formatXdr:T:R"){
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
getdisplay().setCursor(x0+25, y0+70); epd->setCursor(x0+25, y0+70);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic26pt7b); epd->setFont(&DSEG7Classic_BoldItalic26pt7b);
if ( DataText[ValueIndex][0] == '-' ) if ( DataText[ValueIndex][0] == '-' )
getdisplay().setCursor(x0+25, y0+70); epd->setCursor(x0+25, y0+70);
else else
getdisplay().setCursor(x0+65, y0+70); epd->setCursor(x0+65, y0+70);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(DataText[ValueIndex]); // Real value as formated string epd->print(DataText[ValueIndex]); // Real value as formated string
} }
else{ else{
getdisplay().print(OldDataText[ValueIndex]); // Old value as formated string epd->print(OldDataText[ValueIndex]); // Old value as formated string
} }
if(DataValid[ValueIndex] == true){ if(DataValid[ValueIndex] == true){
OldDataText[ValueIndex] = DataText[ValueIndex]; // Save the old value OldDataText[ValueIndex] = DataText[ValueIndex]; // Save the old value
@ -146,7 +147,7 @@ class PageSixValues : public Page
} }
} }
// Vertical line 3 pix // Vertical line 3 pix
getdisplay().fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor); epd->fillRect(SixValues_x1+SixValues_DeltaX-8, SixValues_y1+i*SixValues_DeltaY, 3, SixValues_DeltaY, commonData->fgcolor);
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -46,85 +47,85 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
// current position // current position
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
GwApi::BoatValue *bv_lat = pageData.values[0]; GwApi::BoatValue *bv_lat = pageData.values[0];
String sv_lat = formatValue(bv_lat, *commonData).svalue; String sv_lat = formatValue(bv_lat, *commonData).svalue;
//getdisplay().setCursor(300, 40); //epd->setCursor(300, 40);
//getdisplay().print(sv_lat); //epd->print(sv_lat);
GwApi::BoatValue *bv_lon = pageData.values[1]; GwApi::BoatValue *bv_lon = pageData.values[1];
String sv_lon = formatValue(bv_lon, *commonData).svalue; String sv_lon = formatValue(bv_lon, *commonData).svalue;
//getdisplay().setCursor(300, 60); //epd->setCursor(300, 60);
//getdisplay().print(sv_lon); //epd->print(sv_lon);
GwApi::BoatValue *bv_hdop = pageData.values[2]; GwApi::BoatValue *bv_hdop = pageData.values[2];
String sv_hdop = formatValue(bv_hdop, *commonData).svalue; String sv_hdop = formatValue(bv_hdop, *commonData).svalue;
//getdisplay().setCursor(300, 80); //epd->setCursor(300, 80);
//getdisplay().print(sv_hdop); //epd->print(sv_hdop);
// sky view // sky view
Point c = {130, 148}; Point c = {130, 148};
uint16_t r = 125; uint16_t r = 125;
uint16_t r1 = r / 2; uint16_t r1 = r / 2;
getdisplay().fillCircle(c.x, c.y, r, commonData->bgcolor); epd->fillCircle(c.x, c.y, r, commonData->bgcolor);
getdisplay().drawCircle(c.x, c.y, r + 1, commonData->fgcolor); epd->drawCircle(c.x, c.y, r + 1, commonData->fgcolor);
getdisplay().drawCircle(c.x, c.y, r + 2, commonData->fgcolor); epd->drawCircle(c.x, c.y, r + 2, commonData->fgcolor);
getdisplay().drawCircle(c.x, c.y, r1, commonData->fgcolor); epd->drawCircle(c.x, c.y, r1, commonData->fgcolor);
// separation lines // separation lines
getdisplay().drawLine(c.x - r, c.y, c.x + r, c.y, commonData->fgcolor); epd->drawLine(c.x - r, c.y, c.x + r, c.y, commonData->fgcolor);
getdisplay().drawLine(c.x, c.y - r, c.x, c.y + r, commonData->fgcolor); epd->drawLine(c.x, c.y - r, c.x, c.y + r, commonData->fgcolor);
Point p = {c.x, c.y - r}; Point p = {c.x, c.y - r};
Point p1, p2; Point p1, p2;
p1 = rotatePoint(c, p, 45); p1 = rotatePoint(c, p, 45);
p2 = rotatePoint(c, p, 45 + 180); p2 = rotatePoint(c, p, 45 + 180);
getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor); epd->drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor);
p1 = rotatePoint(c, p, -45); p1 = rotatePoint(c, p, -45);
p2 = rotatePoint(c, p, -45 + 180); p2 = rotatePoint(c, p, -45 + 180);
getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor); epd->drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor);
// directions // directions
int16_t x1, y1; int16_t x1, y1;
uint16_t w, h; uint16_t w, h;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().getTextBounds("N", 0, 150, &x1, &y1, &w, &h); epd->getTextBounds("N", 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(c.x - w / 2, c.y - r + h + 2); epd->setCursor(c.x - w / 2, c.y - r + h + 2);
getdisplay().print("N"); epd->print("N");
getdisplay().getTextBounds("S", 0, 150, &x1, &y1, &w, &h); epd->getTextBounds("S", 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(c.x - w / 2, c.y + r - 2); epd->setCursor(c.x - w / 2, c.y + r - 2);
getdisplay().print("S"); epd->print("S");
getdisplay().getTextBounds("E", 0, 150, &x1, &y1, &w, &h); epd->getTextBounds("E", 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(c.x + r - w - 2, c.y + h / 2); epd->setCursor(c.x + r - w - 2, c.y + h / 2);
getdisplay().print("E"); epd->print("E");
getdisplay().getTextBounds("W", 0, 150, &x1, &y1, &w, &h); epd->getTextBounds("W", 0, 150, &x1, &y1, &w, &h);
getdisplay().setCursor(c.x - r + 2 , c.y + h / 2); epd->setCursor(c.x - r + 2 , c.y + h / 2);
getdisplay().print("W"); epd->print("W");
// satellites // satellites
// Signal / Noise bars // Signal / Noise bars
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(325, 34); epd->setCursor(325, 34);
getdisplay().print("SNR"); epd->print("SNR");
getdisplay().drawRect(270, 20, 125, 257, commonData->fgcolor); epd->drawRect(270, 20, 125, 257, commonData->fgcolor);
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
uint16_t y = 29 + (i + 1) * 20; uint16_t y = 29 + (i + 1) * 20;
getdisplay().setCursor(276, y); epd->setCursor(276, y);
char buffer[3]; char buffer[3];
snprintf(buffer, 3, "%02d", i+1); snprintf(buffer, 3, "%02d", i+1);
getdisplay().print(String(buffer)); epd->print(String(buffer));
getdisplay().drawRect(305, y-12, 85, 14, commonData->fgcolor); epd->drawRect(305, y-12, 85, 14, commonData->fgcolor);
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -82,74 +83,74 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print("Solar"); epd->print("Solar");
// Show voltage type // Show voltage type
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 140); epd->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;
getdisplay().print(bvoltage); epd->print(bvoltage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show solar power // Show solar power
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 200); epd->setCursor(10, 200);
if(solPower <= 999) getdisplay().print(solPower, 0); if(solPower <= 999) epd->print(solPower, 0);
if(solPower > 999) getdisplay().print(float(solPower/1000.0), 1); if(solPower > 999) epd->print(float(solPower/1000.0), 1);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
if(solPower <= 999) getdisplay().print("W"); if(solPower <= 999) epd->print("W");
if(solPower > 999) getdisplay().print("kW"); if(solPower > 999) epd->print("kW");
// Show info // Show info
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 235); epd->setCursor(10, 235);
getdisplay().print("Installed"); epd->print("Installed");
getdisplay().setCursor(10, 255); epd->setCursor(10, 255);
getdisplay().print("Solar Modul"); epd->print("Solar Modul");
// Show solar panel // Show solar panel
solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor); solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor);
// Show load level in percent // Show load level in percent
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 200); epd->setCursor(150, 200);
getdisplay().print(solPercentage); epd->print(solPercentage);
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("%"); epd->print("%");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(150, 235); epd->setCursor(150, 235);
getdisplay().print("Load"); epd->print("Load");
// Show sensor type info // Show sensor type info
String i2cAddr = ""; String i2cAddr = "";
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(270, 60); epd->setCursor(270, 60);
if(powerSensor == "off") getdisplay().print("Internal"); if(powerSensor == "off") epd->print("Internal");
if(powerSensor == "INA219"){ if(powerSensor == "INA219"){
getdisplay().print("INA219"); epd->print("INA219");
i2cAddr = " (0x" + String(INA219_I2C_ADDR2, HEX) + ")"; i2cAddr = " (0x" + String(INA219_I2C_ADDR2, HEX) + ")";
} }
if(powerSensor == "INA226"){ if(powerSensor == "INA226"){
getdisplay().print("INA226"); epd->print("INA226");
i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")"; i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")";
} }
getdisplay().print(i2cAddr); epd->print(i2cAddr);
getdisplay().setCursor(270, 80); epd->setCursor(270, 80);
getdisplay().print("Sensor Modul"); epd->print("Sensor Modul");
// Reading bus data or using simulation data // Reading bus data or using simulation data
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 140); epd->setCursor(260, 140);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -158,46 +159,46 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
getdisplay().print(value1,1); epd->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) getdisplay().print(value1, 2); if(value1 <= 9.9) epd->print(value1, 2);
if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1);
if(value1 > 99.9) getdisplay().print(value1, 0); if(value1 > 99.9) epd->print(value1, 0);
} }
else{ else{
getdisplay().print("---"); // Missing bus data epd->print("---"); // Missing bus data
} }
} }
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("V"); epd->print("V");
// Show actual current in A // Show actual current in A
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 200); epd->setCursor(260, 200);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value2 <= 9.9) getdisplay().print(value2, 2); if(value2 <= 9.9) epd->print(value2, 2);
if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
if(value2 > 99.9) getdisplay().print(value2, 0); if(value2 > 99.9) epd->print(value2, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("A"); epd->print("A");
// Show actual consumption in W // Show actual consumption in W
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(260, 260); epd->setCursor(260, 260);
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
if(value3 <= 9.9) getdisplay().print(value3, 2); if(value3 <= 9.9) epd->print(value3, 2);
if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
if(value3 > 99.9) getdisplay().print(value3, 0); if(value3 > 99.9) epd->print(value3, 0);
} }
else getdisplay().print("---"); else epd->print("---");
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().print("W"); epd->print("W");
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -116,101 +117,101 @@ private:
uint16_t y0 = 155; uint16_t y0 = 155;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("System information"); epd->print("System information");
getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor); epd->drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
char ssid[13]; char ssid[13];
snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid); snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid);
displayBarcode(String(ssid), 320, 200, 2); displayBarcode(String(ssid), 320, 200, 2);
getdisplay().setCursor(8, 70); epd->setCursor(8, 70);
getdisplay().print(String("MCUDEVICE-") + String(ssid)); epd->print(String("MCUDEVICE-") + String(ssid));
getdisplay().setCursor(8, 95); epd->setCursor(8, 95);
getdisplay().print("Firmware version: "); epd->print("Firmware version: ");
getdisplay().setCursor(150, 95); epd->setCursor(150, 95);
getdisplay().print(VERSINFO); epd->print(VERSINFO);
getdisplay().setCursor(8, 113); epd->setCursor(8, 113);
getdisplay().print("Board version: "); epd->print("Board version: ");
getdisplay().setCursor(150, 113); epd->setCursor(150, 113);
getdisplay().print(BOARDINFO); epd->print(BOARDINFO);
getdisplay().print(String(" HW ") + String(PCBINFO)); epd->print(String(" HW ") + String(PCBINFO));
getdisplay().setCursor(8, 131); epd->setCursor(8, 131);
getdisplay().print("Display version: "); epd->print("Display version: ");
getdisplay().setCursor(150, 131); epd->setCursor(150, 131);
getdisplay().print(DISPLAYINFO); epd->print(DISPLAYINFO);
getdisplay().print("; GxEPD2 v"); epd->print("; GxEPD2 v");
getdisplay().print(GXEPD2INFO); epd->print(GXEPD2INFO);
getdisplay().setCursor(8, 265); epd->setCursor(8, 265);
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
getdisplay().print("Press STBY to enter deep sleep mode"); epd->print("Press STBY to enter deep sleep mode");
#endif #endif
#ifdef BOARD_OBP40S3 #ifdef BOARD_OBP40S3
getdisplay().print("Press wheel to enter deep sleep mode"); epd->print("Press wheel to enter deep sleep mode");
#endif #endif
// Flash memory size // Flash memory size
uint32_t flash_size = ESP.getFlashChipSize(); uint32_t flash_size = ESP.getFlashChipSize();
getdisplay().setCursor(8, y0); epd->setCursor(8, y0);
getdisplay().print("FLASH:"); epd->print("FLASH:");
getdisplay().setCursor(90, y0); epd->setCursor(90, y0);
getdisplay().print(String(flash_size / 1024) + String(" kB")); epd->print(String(flash_size / 1024) + String(" kB"));
// PSRAM memory size // PSRAM memory size
uint32_t psram_size = ESP.getPsramSize(); uint32_t psram_size = ESP.getPsramSize();
getdisplay().setCursor(8, y0 + 16); epd->setCursor(8, y0 + 16);
getdisplay().print("PSRAM:"); epd->print("PSRAM:");
getdisplay().setCursor(90, y0 + 16); epd->setCursor(90, y0 + 16);
getdisplay().print(String(psram_size / 1024) + String(" kB")); epd->print(String(psram_size / 1024) + String(" kB"));
// FRAM available / status // FRAM available / status
getdisplay().setCursor(8, y0 + 32); epd->setCursor(8, y0 + 32);
getdisplay().print("FRAM:"); epd->print("FRAM:");
getdisplay().setCursor(90, y0 + 32); epd->setCursor(90, y0 + 32);
getdisplay().print(hasFRAM ? "available" : "not found"); epd->print(hasFRAM ? "available" : "not found");
#ifdef BOARD_OBP40S3 #ifdef BOARD_OBP40S3
// SD-Card // SD-Card
getdisplay().setCursor(8, y0 + 48); epd->setCursor(8, y0 + 48);
getdisplay().print("SD-Card:"); epd->print("SD-Card:");
getdisplay().setCursor(90, y0 + 48); epd->setCursor(90, y0 + 48);
if (sdcard) { if (sdcard) {
uint64_t cardsize = SD.cardSize() / (1024 * 1024); uint64_t cardsize = SD.cardSize() / (1024 * 1024);
getdisplay().print(String(cardsize) + String(" MB")); epd->print(String(cardsize) + String(" MB"));
} else { } else {
getdisplay().print("off"); epd->print("off");
} }
#endif #endif
// CPU speed config / active // CPU speed config / active
getdisplay().setCursor(202, y0); epd->setCursor(202, y0);
getdisplay().print("CPU speed:"); epd->print("CPU speed:");
getdisplay().setCursor(300, y0); epd->setCursor(300, y0);
getdisplay().print(cpuspeed); epd->print(cpuspeed);
getdisplay().print(" / "); epd->print(" / ");
int cpu_freq = esp_clk_cpu_freq() / 1000000; int cpu_freq = esp_clk_cpu_freq() / 1000000;
getdisplay().print(String(cpu_freq)); epd->print(String(cpu_freq));
// total RAM free // total RAM free
int Heap_free = esp_get_free_heap_size(); int Heap_free = esp_get_free_heap_size();
getdisplay().setCursor(202, y0 + 16); epd->setCursor(202, y0 + 16);
getdisplay().print("Total free:"); epd->print("Total free:");
getdisplay().setCursor(300, y0 + 16); epd->setCursor(300, y0 + 16);
getdisplay().print(String(Heap_free)); epd->print(String(Heap_free));
// RAM free for task // RAM free for task
int RAM_free = uxTaskGetStackHighWaterMark(NULL); int RAM_free = uxTaskGetStackHighWaterMark(NULL);
getdisplay().setCursor(202, y0 + 32); epd->setCursor(202, y0 + 32);
getdisplay().print("Task free:"); epd->print("Task free:");
getdisplay().setCursor(300, y0 + 32); epd->setCursor(300, y0 + 32);
getdisplay().print(String(RAM_free)); epd->print(String(RAM_free));
} }
void displayModeConfig() { void displayModeConfig() {
@ -220,24 +221,24 @@ private:
uint16_t y0 = 80; uint16_t y0 = 80;
uint16_t dy = 20; uint16_t dy = 20;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("System configuration"); epd->print("System configuration");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
/*getdisplay().setCursor(x0, y0); /*epd->setCursor(x0, y0);
getdisplay().print("CPU speed: 80 | 160 | 240"); epd->print("CPU speed: 80 | 160 | 240");
getdisplay().setCursor(x0, y0 + 1 * dy); epd->setCursor(x0, y0 + 1 * dy);
getdisplay().print("Power mode: Max | 5V | Min"); epd->print("Power mode: Max | 5V | Min");
getdisplay().setCursor(x0, y0 + 2 * dy); epd->setCursor(x0, y0 + 2 * dy);
getdisplay().print("Accesspoint: On | Off"); epd->print("Accesspoint: On | Off");
// TODO Change NVRAM-preferences settings here // TODO Change NVRAM-preferences settings here
getdisplay().setCursor(x0, y0 + 4 * dy); epd->setCursor(x0, y0 + 4 * dy);
getdisplay().print("Simulation: On | Off"); */ epd->print("Simulation: On | Off"); */
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
for (int i = 0 ; i < menu->getItemCount(); i++) { for (int i = 0 ; i < menu->getItemCount(); i++) {
ConfigMenuItem *itm = menu->getItemByIndex(i); ConfigMenuItem *itm = menu->getItemByIndex(i);
if (!itm) { if (!itm) {
@ -248,14 +249,14 @@ private:
drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false); drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false);
if (inverted and editmode > 0) { if (inverted and editmode > 0) {
// triangle as edit marker // triangle as edit marker
getdisplay().fillTriangle(r.x + r.w + 20, r.y, r.x + r.w + 30, r.y + r.h / 2, r.x + r.w + 20, r.y + r.h, commonData->fgcolor); epd->fillTriangle(r.x + r.w + 20, r.y, r.x + r.w + 30, r.y + r.h / 2, r.x + r.w + 20, r.y + r.h, commonData->fgcolor);
} }
getdisplay().setCursor(r.x + r.w + 40, r.y + r.h - 4); epd->setCursor(r.x + r.w + 40, r.y + r.h - 4);
if (itm->getType() == "int") { if (itm->getType() == "int") {
getdisplay().print(itm->getValue()); epd->print(itm->getValue());
getdisplay().print(itm->getUnit()); epd->print(itm->getUnit());
} else { } else {
getdisplay().print(itm->getValue() == 0 ? "No" : "Yes"); epd->print(itm->getValue() == 0 ? "No" : "Yes");
} }
} }
} }
@ -267,84 +268,84 @@ private:
const uint16_t x0 = 8; const uint16_t x0 = 8;
const uint16_t y0 = 72; const uint16_t y0 = 72;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(x0, 48); epd->setCursor(x0, 48);
getdisplay().print("System settings"); epd->print("System settings");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
// left column // left column
getdisplay().setCursor(x0, y0); epd->setCursor(x0, y0);
getdisplay().print("Simulation:"); epd->print("Simulation:");
getdisplay().setCursor(120, y0); epd->setCursor(120, y0);
getdisplay().print(simulation ? "on" : "off"); epd->print(simulation ? "on" : "off");
getdisplay().setCursor(x0, y0 + 16); epd->setCursor(x0, y0 + 16);
getdisplay().print("Environment:"); epd->print("Environment:");
getdisplay().setCursor(120, y0 + 16); epd->setCursor(120, y0 + 16);
getdisplay().print(env_module); epd->print(env_module);
getdisplay().setCursor(x0, y0 + 32); epd->setCursor(x0, y0 + 32);
getdisplay().print("Buzzer:"); epd->print("Buzzer:");
getdisplay().setCursor(120, y0 + 32); epd->setCursor(120, y0 + 32);
getdisplay().print(buzzer_mode); epd->print(buzzer_mode);
getdisplay().setCursor(x0, y0 + 64); epd->setCursor(x0, y0 + 64);
getdisplay().print("GPS:"); epd->print("GPS:");
getdisplay().setCursor(120, y0 + 64); epd->setCursor(120, y0 + 64);
getdisplay().print(gps_module); epd->print(gps_module);
getdisplay().setCursor(x0, y0 + 80); epd->setCursor(x0, y0 + 80);
getdisplay().print("RTC:"); epd->print("RTC:");
getdisplay().setCursor(120, y0 + 80); epd->setCursor(120, y0 + 80);
getdisplay().print(rtc_module); epd->print(rtc_module);
getdisplay().setCursor(x0, y0 + 96); epd->setCursor(x0, y0 + 96);
getdisplay().print("Wifi:"); epd->print("Wifi:");
getdisplay().setCursor(120, y0 + 96); epd->setCursor(120, y0 + 96);
getdisplay().print(commonData->status.wifiApOn ? "on" : "off"); epd->print(commonData->status.wifiApOn ? "on" : "off");
// Home location // Home location
getdisplay().setCursor(x0, y0 + 128); epd->setCursor(x0, y0 + 128);
getdisplay().print("Home Lat.:"); epd->print("Home Lat.:");
drawTextRalign(230, y0 + 128, formatLatitude(homelat)); drawTextRalign(230, y0 + 128, formatLatitude(homelat));
getdisplay().setCursor(x0, y0 + 144); epd->setCursor(x0, y0 + 144);
getdisplay().print("Home Lon.:"); epd->print("Home Lon.:");
drawTextRalign(230, y0 + 144, formatLongitude(homelon)); drawTextRalign(230, y0 + 144, formatLongitude(homelon));
// right column // right column
getdisplay().setCursor(202, y0); epd->setCursor(202, y0);
getdisplay().print("Batt. sensor:"); epd->print("Batt. sensor:");
getdisplay().setCursor(320, y0); epd->setCursor(320, y0);
getdisplay().print(batt_sensor); epd->print(batt_sensor);
// Solar sensor // Solar sensor
getdisplay().setCursor(202, y0 + 16); epd->setCursor(202, y0 + 16);
getdisplay().print("Solar sensor:"); epd->print("Solar sensor:");
getdisplay().setCursor(320, y0 + 16); epd->setCursor(320, y0 + 16);
getdisplay().print(solar_sensor); epd->print(solar_sensor);
// Generator sensor // Generator sensor
getdisplay().setCursor(202, y0 + 32); epd->setCursor(202, y0 + 32);
getdisplay().print("Gen. sensor:"); epd->print("Gen. sensor:");
getdisplay().setCursor(320, y0 + 32); epd->setCursor(320, y0 + 32);
getdisplay().print(gen_sensor); epd->print(gen_sensor);
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
// Backlight infos // Backlight infos
getdisplay().setCursor(202, y0 + 64); epd->setCursor(202, y0 + 64);
getdisplay().print("Backlight:"); epd->print("Backlight:");
getdisplay().setCursor(320, y0 + 64); epd->setCursor(320, y0 + 64);
getdisplay().printf("%d%%", commonData->backlight.brightness); epd->printf("%d%%", commonData->backlight.brightness);
// TODO test function with OBP60 device // TODO test function with OBP60 device
getdisplay().setCursor(202, y0 + 80); epd->setCursor(202, y0 + 80);
getdisplay().print("Bl color:"); epd->print("Bl color:");
getdisplay().setCursor(320, y0 + 80); epd->setCursor(320, y0 + 80);
getdisplay().print(commonData->backlight.color.toName()); epd->print(commonData->backlight.color.toName());
getdisplay().setCursor(202, y0 + 96); epd->setCursor(202, y0 + 96);
getdisplay().print("Bl mode:"); epd->print("Bl mode:");
getdisplay().setCursor(320, y0 + 96); epd->setCursor(320, y0 + 96);
getdisplay().print(commonData->backlight.mode); epd->print(commonData->backlight.mode);
// TODO Buzzer mode and power // TODO Buzzer mode and power
#endif #endif
@ -357,28 +358,28 @@ private:
uint16_t x0 = 20; uint16_t x0 = 20;
uint16_t y0 = 72; uint16_t y0 = 72;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("SD Card info"); epd->print("SD Card info");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(x0, y0); epd->setCursor(x0, y0);
getdisplay().print("Work in progress..."); epd->print("Work in progress...");
} }
void displayModeDevicelist() { void displayModeDevicelist() {
// NMEA2000 device list // NMEA2000 device list
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 48); epd->setCursor(8, 48);
getdisplay().print("NMEA2000 device list"); epd->print("NMEA2000 device list");
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(20, 80); epd->setCursor(20, 80);
getdisplay().print("RxD: "); epd->print("RxD: ");
getdisplay().print(String(commonData->status.n2kRx)); epd->print(String(commonData->status.n2kRx));
getdisplay().setCursor(20, 100); epd->setCursor(20, 100);
getdisplay().print("TxD: "); epd->print("TxD: ");
getdisplay().print(String(commonData->status.n2kTx)); epd->print(String(commonData->status.n2kTx));
} }
void storeConfig() { void storeConfig() {
@ -421,8 +422,8 @@ public:
// Accesspoint: On | Off // Accesspoint: On | Off
// TODO Change NVRAM-preferences settings here // TODO Change NVRAM-preferences settings here
// getdisplay().setCursor(x0, y0 + 4 * dy); // epd->setCursor(x0, y0 + 4 * dy);
// getdisplay().print("Simulation: On | Off"); // epd->print("Simulation: On | Off");
// Initialize config menu // Initialize config menu
menu = new ConfigMenu("Options", 40, 80); menu = new ConfigMenu("Options", 40, 80);
@ -507,7 +508,7 @@ public:
for (uint8_t j = 0; j < qrcode.size; j++) { for (uint8_t j = 0; j < qrcode.size; j++) {
for (uint8_t i = 0; i < qrcode.size; i++) { for (uint8_t i = 0; i < qrcode.size; i++) {
if (qrcode_getModule(&qrcode, i, j)) { if (qrcode_getModule(&qrcode, i, j)) {
getdisplay().fillRect(x, y, s, s, commonData->fgcolor); epd->fillRect(x, y, s, s, commonData->fgcolor);
} }
x += s; x += s;
} }
@ -530,7 +531,7 @@ public:
LOG_DEBUG(GwLog::LOG,"Drawing at PageSystem, Mode=%c", mode); LOG_DEBUG(GwLog::LOG,"Drawing at PageSystem, Mode=%c", mode);
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); epd->setPartialWindow(0, 0, epd->width(), epd->height());
// call current system page // call current system page
switch (mode) { switch (mode) {
@ -552,7 +553,7 @@ public:
} }
// Update display // Update display
getdisplay().nextPage(); // Partial update (fast) epd->nextPage(); // Partial update (fast)
return PAGE_OK; return PAGE_OK;
}; };
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -84,46 +85,46 @@ class PageThreeValues : public Page
//*********************************************************** //***********************************************************
/// Set display in partial refresh mode /// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 55); epd->setCursor(20, 55);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 90); epd->setCursor(20, 90);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(50, 90); epd->setCursor(50, 90);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(170, 68); epd->setCursor(170, 68);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 90); epd->setCursor(180, 90);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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,45 +134,45 @@ class PageThreeValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); epd->fillRect(0, 105, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 145); epd->setCursor(20, 145);
getdisplay().print(name2); // Page name epd->print(name2); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 180); epd->setCursor(20, 180);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(50, 180); epd->setCursor(50, 180);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(170, 158); epd->setCursor(170, 158);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 180); epd->setCursor(180, 180);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue2old); // Old value as formated string epd->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
@ -181,45 +182,45 @@ class PageThreeValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); epd->fillRect(0, 195, 400, 3, commonData->fgcolor);
// ############### Value 3 ################ // ############### Value 3 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 235); epd->setCursor(20, 235);
getdisplay().print(name3); // Page name epd->print(name3); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 270); epd->setCursor(20, 270);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(50, 270); epd->setCursor(50, 270);
} }
else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(170, 248); epd->setCursor(170, 248);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
getdisplay().setCursor(180, 270); epd->setCursor(180, 270);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue3); // Real value as formated string epd->print(svalue3); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue3old); // Old value as formated string epd->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

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -72,46 +73,46 @@ class PageTwoValues : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
// ############### Value 1 ################ // ############### Value 1 ################
// Show name // Show name
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 80); epd->setCursor(20, 80);
getdisplay().print(name1); // Page name epd->print(name1); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 130); epd->setCursor(20, 130);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(50, 130); epd->setCursor(50, 130);
} }
else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(170, 105); epd->setCursor(170, 105);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); epd->setFont(&DSEG7Classic_BoldItalic42pt7b);
getdisplay().setCursor(180, 130); epd->setCursor(180, 130);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Real value as formated string epd->print(svalue1); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue1old); // Old value as formated string epd->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
@ -121,45 +122,45 @@ class PageTwoValues : public Page
// ############### Horizontal Line ################ // ############### Horizontal Line ################
// Horizontal line 3 pix // Horizontal line 3 pix
getdisplay().fillRect(0, 145, 400, 3, commonData->fgcolor); epd->fillRect(0, 145, 400, 3, commonData->fgcolor);
// ############### Value 2 ################ // ############### Value 2 ################
// Show name // Show name
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 190); epd->setCursor(20, 190);
getdisplay().print(name2); // Page name epd->print(name2); // Page name
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(20, 240); epd->setCursor(20, 240);
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); epd->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"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(50, 240); epd->setCursor(50, 240);
} }
else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(170, 215); epd->setCursor(170, 215);
} }
else{ else{
getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); epd->setFont(&DSEG7Classic_BoldItalic42pt7b);
getdisplay().setCursor(180, 240); epd->setCursor(180, 240);
} }
// Show bus data // Show bus data
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Real value as formated string epd->print(svalue2); // Real value as formated string
} }
else{ else{
getdisplay().print(svalue2old); // Old value as formated string epd->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

View File

@ -75,38 +75,38 @@ public:
} }
void printAvg(int avg, uint16_t x, uint16_t y, bool prefix) { void printAvg(int avg, uint16_t x, uint16_t y, bool prefix) {
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(x, y); epd->setCursor(x, y);
if (prefix) { if (prefix) {
getdisplay().print("Avg: "); epd->print("Avg: ");
} }
switch (average) { switch (average) {
case 0: case 0:
getdisplay().print("1s"); epd->print("1s");
break; break;
case 1: case 1:
getdisplay().print("10s"); epd->print("10s");
break; break;
case 2: case 2:
getdisplay().print("60s"); epd->print("60s");
break; break;
case 3: case 3:
getdisplay().print("300s"); epd->print("300s");
break; break;
default: default:
getdisplay().print("1s"); epd->print("1s");
break; break;
} }
} }
void printVoltageSymbol(uint16_t x, uint16_t y, uint16_t color) { void printVoltageSymbol(uint16_t x, uint16_t y, uint16_t color) {
getdisplay().setFont(&Ubuntu_Bold16pt8b); epd->setFont(&Ubuntu_Bold16pt8b);
getdisplay().setCursor(x, y); epd->setCursor(x, y);
getdisplay().print("V"); epd->print("V");
getdisplay().fillRect(x, y + 6, 22, 3, color); epd->fillRect(x, y + 6, 22, 3, color);
getdisplay().fillRect(x, y + 11, 6, 3, color); epd->fillRect(x, y + 11, 6, 3, color);
getdisplay().fillRect(x + 8, y + 11, 6, 3, color); epd->fillRect(x + 8, y + 11, 6, 3, color);
getdisplay().fillRect(x + 16, y + 11, 6, 3, color); epd->fillRect(x + 16, y + 11, 6, 3, color);
} }
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){
@ -202,50 +202,50 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
if (mode == 'D') { if (mode == 'D') {
// Display mode digital // Display mode digital
// Show name // Show name
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold32pt8b); epd->setFont(&Ubuntu_Bold32pt8b);
getdisplay().setCursor(20, 100); epd->setCursor(20, 100);
getdisplay().print(name1); // Value name epd->print(name1); // Value name
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR #if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
// Show charge status // Show charge status
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(185, 100); epd->setCursor(185, 100);
if(commonData->data.BatteryChargeStatus == true){ if(commonData->data.BatteryChargeStatus == true){
getdisplay().print("Charge"); epd->print("Charge");
} }
else{ else{
getdisplay().print("Discharge"); epd->print("Discharge");
} }
#endif #endif
// Show unit // Show unit
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(270, 100); epd->setCursor(270, 100);
getdisplay().print("V"); epd->print("V");
// Show battery type // Show battery type
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(295, 100); epd->setCursor(295, 100);
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
getdisplay().print(batType); epd->print(batType);
#endif #endif
#if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR #if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR
getdisplay().print("LiPo"); epd->print("LiPo");
#endif #endif
// Show average settings // Show average settings
printAvg(average, 320, 84, true); printAvg(average, 320, 84, true);
// Reading bus data or using simulation data // Reading bus data or using simulation data
getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b); epd->setFont(&DSEG7Classic_BoldItalic60pt7b);
getdisplay().setCursor(20, 240); epd->setCursor(20, 240);
if(simulation == true){ if(simulation == true){
if(batVoltage == "12V"){ if(batVoltage == "12V"){
value1 = 12.0; value1 = 12.0;
@ -254,30 +254,30 @@ public:
value1 = 24.0; value1 = 24.0;
} }
value1 += float(random(0, 5)) / 10; // Simulation data value1 += float(random(0, 5)) / 10; // Simulation data
getdisplay().print(value1,1); epd->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){
getdisplay().print(value1,2); epd->print(value1,2);
} }
if(value1 >= 10 && value1 < 100){ if(value1 >= 10 && value1 < 100){
getdisplay().print(value1,1); epd->print(value1,1);
} }
if(value1 >= 100){ if(value1 >= 100){
getdisplay().print(value1,0); epd->print(value1,0);
} }
} }
else{ else{
getdisplay().print("---"); // Missing bus data epd->print("---"); // Missing bus data
} }
} }
// Show trend indicator // Show trend indicator
if(trend == true){ if(trend == true){
getdisplay().fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator epd->fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator
if(int(raw * 10) > int(valueTrend * 10)){ if(int(raw * 10) > int(valueTrend * 10)){
displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator
} }
@ -298,9 +298,9 @@ public:
std::vector<Point> pts; std::vector<Point> pts;
// Instrument // Instrument
getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor); epd->drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor);
getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor); epd->drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor);
getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor); epd->drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor);
// Scale // Scale
// angle to voltage scale mapping // angle to voltage scale mapping
@ -313,7 +313,7 @@ public:
{c.x - r + 12, c.y + 1}, {c.x - r + 12, c.y + 1},
{c.x - r, c.y + 1} {c.x - r, c.y + 1}
}; };
getdisplay().setFont(&Ubuntu_Bold10pt8b); epd->setFont(&Ubuntu_Bold10pt8b);
for (int angle = 3; angle < 90; angle += 3) { for (int angle = 3; angle < 90; angle += 3) {
if (angle % 15 == 0) { if (angle % 15 == 0) {
fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor);
@ -323,7 +323,7 @@ public:
else { else {
p1 = rotatePoint(c, {c.x - r, c.y}, angle); p1 = rotatePoint(c, {c.x - r, c.y}, angle);
p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle); p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle);
getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor); epd->drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor);
} }
} }
@ -363,31 +363,31 @@ public:
fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor);
// base // base
getdisplay().fillCircle(c.x, c.y, 7, commonData->fgcolor); epd->fillCircle(c.x, c.y, 7, commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, 4, commonData->bgcolor); epd->fillCircle(c.x, c.y, 4, commonData->bgcolor);
// Symbol // Symbol
printVoltageSymbol(40, 60, commonData->fgcolor); printVoltageSymbol(40, 60, commonData->fgcolor);
// Additional information at right side // Additional information at right side
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(300, 60); epd->setCursor(300, 60);
getdisplay().print("Source:"); epd->print("Source:");
getdisplay().setCursor(300, 80); epd->setCursor(300, 80);
getdisplay().print(name1); epd->print(name1);
getdisplay().setCursor(300, 110); epd->setCursor(300, 110);
getdisplay().print("Type:"); epd->print("Type:");
getdisplay().setCursor(300, 130); epd->setCursor(300, 130);
getdisplay().print(batType); epd->print(batType);
getdisplay().setCursor(300, 160); epd->setCursor(300, 160);
getdisplay().print("Avg:"); epd->print("Avg:");
printAvg(average, 300, 180, false); printAvg(average, 300, 180, false);
// FRAM indicator // FRAM indicator
if (hasFRAM) { if (hasFRAM) {
getdisplay().drawXBitmap(300, 240, fram_bits, icon_width, icon_height, commonData->fgcolor); epd->drawXBitmap(300, 240, fram_bits, icon_width, icon_height, commonData->fgcolor);
} }
} }

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -61,19 +62,19 @@ public:
// Set display in partial refresh mode // Set display in partial refresh mode
if (mode == 'W') { if (mode == 'W') {
getdisplay().setFullWindow(); epd->setFullWindow();
} else { } else {
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
} }
if (mode == 'L') { if (mode == 'L') {
getdisplay().drawXBitmap(0, 0, OBP_400x300_bits, OBP_400x300_width, OBP_400x300_height, commonData->fgcolor); epd->drawXBitmap(0, 0, OBP_400x300_bits, OBP_400x300_width, OBP_400x300_height, commonData->fgcolor);
} else if (mode == 'M') { } else if (mode == 'M') {
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
getdisplay().drawXBitmap(0, 0, OBP60_400x300_bits, OBP60_400x300_width, OBP60_400x300_height, commonData->fgcolor); epd->drawXBitmap(0, 0, OBP60_400x300_bits, OBP60_400x300_width, OBP60_400x300_height, commonData->fgcolor);
#endif #endif
#ifdef BOARD_OBP40S3 #ifdef BOARD_OBP40S3
getdisplay().drawXBitmap(0, 0, OBP40_400x300_bits, OBP40_400x300_width, OBP40_400x300_height, commonData->fgcolor); epd->drawXBitmap(0, 0, OBP40_400x300_bits, OBP40_400x300_width, OBP40_400x300_height, commonData->fgcolor);
#endif #endif
} }

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -361,51 +362,51 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
if (mode == 'X') { if (mode == 'X') {
// Original example code with scaling circle // Original example code with scaling circle
// Show values AWS/TWS // Show values AWS/TWS
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 50); epd->setCursor(20, 50);
getdisplay().print(name1); // Value name epd->print(name1); // Value name
getdisplay().print(": "); epd->print(": ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue1); // Value epd->print(svalue1); // Value
getdisplay().print(" "); epd->print(" ");
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(svalue1old); // Value old epd->print(svalue1old); // Value old
getdisplay().print(" "); epd->print(" ");
getdisplay().print(unit1old); // Unit old epd->print(unit1old); // Unit old
} }
// Show values AWD/TWD // Show values AWD/TWD
getdisplay().setFont(&Ubuntu_Bold20pt8b); epd->setFont(&Ubuntu_Bold20pt8b);
getdisplay().setCursor(20, 260); epd->setCursor(20, 260);
getdisplay().print(name2); // Value name epd->print(name2); // Value name
getdisplay().print(": "); epd->print(": ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(svalue2); // Value epd->print(svalue2); // Value
getdisplay().print(" "); epd->print(" ");
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(svalue2old); // Value old epd->print(svalue2old); // Value old
getdisplay().print(" "); epd->print(" ");
getdisplay().print(unit2old); // Unit old epd->print(unit2old); // Unit old
} }
Point c = {200, 145}; Point c = {200, 145};
// Draw instrument // Draw instrument
getdisplay().fillCircle(c.x, c.y, lp + 5, commonData->fgcolor); epd->fillCircle(c.x, c.y, lp + 5, commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, lp + 1, commonData->bgcolor); epd->fillCircle(c.x, c.y, lp + 1, commonData->bgcolor);
// Wind pointer // Wind pointer
if (bvalue2->valid or simulation) { if (bvalue2->valid or simulation) {
@ -420,7 +421,7 @@ public:
}; };
fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData->fgcolor);
} else { } else {
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
drawTextCenter(c.x, c.y, "no data"); drawTextCenter(c.x, c.y, "no data");
} }
@ -438,7 +439,7 @@ public:
}; };
int angle; int angle;
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
// starbord // starbord
// text with line // text with line
@ -453,7 +454,7 @@ public:
for (int i = 30; i < 138; i += 6) { for (int i = 30; i < 138; i += 6) {
if (i % 15 != 0) { if (i % 15 != 0) {
p = rotatePoint(c, {c.x, c.y - r + 5}, i); p = rotatePoint(c, {c.x, c.y - r + 5}, i);
getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor); epd->fillCircle(p.x, p.y, 2, commonData->fgcolor);
} }
} }
@ -470,17 +471,17 @@ public:
for (int i = 228; i < 330; i += 6) { for (int i = 228; i < 330; i += 6) {
if (i % 15 != 0) { if (i % 15 != 0) {
p = rotatePoint(c, {c.x, c.y - r + 5}, i); p = rotatePoint(c, {c.x, c.y - r + 5}, i);
getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor); epd->fillCircle(p.x, p.y, 2, commonData->fgcolor);
} }
} }
// data source // data source
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 50); epd->setCursor(8, 50);
if (source == 'A') { if (source == 'A') {
getdisplay().print("APP"); epd->print("APP");
} else { } else {
getdisplay().print("TRUE"); epd->print("TRUE");
} }
// Wind pointer (angle) // Wind pointer (angle)
@ -500,7 +501,7 @@ public:
alpha *= -1; alpha *= -1;
} }
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); epd->fillCircle(c.x, c.y, 8, commonData->fgcolor);
pts = { pts = {
{c.x - 1, c.y - (r - 20)}, {c.x - 1, c.y - (r - 20)},
{c.x + 1, c.y - (r - 20)}, {c.x + 1, c.y - (r - 20)},
@ -508,39 +509,39 @@ public:
{c.x - 6, c.y + 15} {c.x - 6, c.y + 15}
}; };
fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); epd->fillCircle(c.x, c.y, 6, commonData->bgcolor);
} else { } else {
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
drawTextCenter(c.x, c.y, "no data"); drawTextCenter(c.x, c.y, "no data");
} }
// Wind speed as decimal number // Wind speed as decimal number
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 250); epd->setCursor(150, 250);
if (holdvalues == false) { if (holdvalues == false) {
getdisplay().print(svalue1); epd->print(svalue1);
} else { } else {
getdisplay().print(svalue1old); epd->print(svalue1old);
} }
// unit // unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(220, 265); epd->setCursor(220, 265);
getdisplay().print("kts"); epd->print("kts");
} }
else { else {
// Normal mode // Normal mode
// data source // data source
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(8, 50); epd->setCursor(8, 50);
if (source == 'A') { if (source == 'A') {
getdisplay().print("APP"); epd->print("APP");
} else { } else {
getdisplay().print("TRUE"); epd->print("TRUE");
} }
// draw ship front symbol (as bitmap) // draw ship front symbol (as bitmap)
getdisplay().drawXBitmap(140, 30, front_bits, front_width, front_height, commonData->fgcolor); epd->drawXBitmap(140, 30, front_bits, front_width, front_height, commonData->fgcolor);
Point c = {200, 155}; Point c = {200, 155};
uint16_t r = 150; uint16_t r = 150;
@ -565,7 +566,7 @@ public:
for (int i = 30; i < 150; i += 10) { for (int i = 30; i < 150; i += 10) {
if (i % 30 != 0) { if (i % 30 != 0) {
p = rotatePoint(c, {c.x, c.y - r + 5}, i); p = rotatePoint(c, {c.x, c.y - r + 5}, i);
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); epd->fillCircle(p.x, p.y, 3, commonData->fgcolor);
} }
} }
@ -582,27 +583,27 @@ public:
for (int i = 210; i < 340; i += 10) { for (int i = 210; i < 340; i += 10) {
if (i % 30 != 0) { if (i % 30 != 0) {
p = rotatePoint(c, {c.x, c.y - r + 5}, i); p = rotatePoint(c, {c.x, c.y - r + 5}, i);
getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); epd->fillCircle(p.x, p.y, 3, commonData->fgcolor);
} }
} }
// Wind speed as decimal number // Wind speed as decimal number
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(150, 250); epd->setCursor(150, 250);
if (holdvalues == false) { if (holdvalues == false) {
getdisplay().print(svalue1); epd->print(svalue1);
} else { } else {
getdisplay().print(svalue1old); epd->print(svalue1old);
} }
// unit // unit
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(220, 265); epd->setCursor(220, 265);
getdisplay().print("kts"); epd->print("kts");
// Wind pointer (angle) // Wind pointer (angle)
if (bvalue2->valid or simulation) { if (bvalue2->valid or simulation) {
float alpha = RadToDeg(value2); float alpha = RadToDeg(value2);
getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); epd->fillCircle(c.x, c.y, 8, commonData->fgcolor);
pts = { pts = {
{c.x - 1, c.y - (r - 20)}, {c.x - 1, c.y - (r - 20)},
{c.x + 1, c.y - (r - 20)}, {c.x + 1, c.y - (r - 20)},
@ -610,9 +611,9 @@ public:
{c.x - 6, c.y + 15} {c.x - 6, c.y + 15}
}; };
fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor); fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor);
getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); epd->fillCircle(c.x, c.y, 6, commonData->bgcolor);
} else { } else {
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
drawTextCenter(c.x, c.y, "no data"); drawTextCenter(c.x, c.y, "no data");
} }

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "BoatDataCalibration.h" #include "BoatDataCalibration.h"
@ -181,8 +182,8 @@ public:
String backlightMode = config->getString(config->backlight); String backlightMode = config->getString(config->backlight);
if (!isInitialized) { if (!isInitialized) {
width = getdisplay().width(); width = epd->width();
height = getdisplay().height(); height = epd->height();
xCenter = width / 2; xCenter = width / 2;
cHeight = height - yOffset - 22; cHeight = height - yOffset - 22;
bufSize = pageData.boatHstry.twdHstry->getCapacity(); bufSize = pageData.boatHstry.twdHstry->getCapacity();
@ -277,32 +278,32 @@ public:
//*********************************************************************** //***********************************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, width, height); // Set partial update epd->setPartialWindow(0, 0, width, height); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// chart lines // chart lines
getdisplay().fillRect(0, yOffset, width, 2, commonData->fgcolor); epd->fillRect(0, yOffset, width, 2, commonData->fgcolor);
getdisplay().fillRect(xCenter, yOffset, 1, cHeight, commonData->fgcolor); epd->fillRect(xCenter, yOffset, 1, cHeight, commonData->fgcolor);
// chart labels // chart labels
char sWndLbl[4]; // char buffer for Wind angle label char sWndLbl[4]; // char buffer for Wind angle label
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(xCenter - 88, yOffset - 3); epd->setCursor(xCenter - 88, yOffset - 3);
getdisplay().print("TWD"); // Wind data name epd->print("TWD"); // Wind data name
snprintf(sWndLbl, 4, "%03d", (wndCenter < 0) ? (wndCenter + 360) : wndCenter); snprintf(sWndLbl, 4, "%03d", (wndCenter < 0) ? (wndCenter + 360) : wndCenter);
drawTextCenter(xCenter, yOffset - 11, sWndLbl); drawTextCenter(xCenter, yOffset - 11, sWndLbl);
getdisplay().drawCircle(xCenter + 25, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol epd->drawCircle(xCenter + 25, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol
getdisplay().drawCircle(xCenter + 25, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol epd->drawCircle(xCenter + 25, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol
getdisplay().setCursor(1, yOffset - 3); epd->setCursor(1, yOffset - 3);
snprintf(sWndLbl, 4, "%03d", (wndLeft < 0) ? (wndLeft + 360) : wndLeft); snprintf(sWndLbl, 4, "%03d", (wndLeft < 0) ? (wndLeft + 360) : wndLeft);
getdisplay().print(sWndLbl); // Wind left value epd->print(sWndLbl); // Wind left value
getdisplay().drawCircle(46, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol epd->drawCircle(46, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol
getdisplay().drawCircle(46, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol epd->drawCircle(46, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol
getdisplay().setCursor(width - 50, yOffset - 3); epd->setCursor(width - 50, yOffset - 3);
snprintf(sWndLbl, 4, "%03d", (wndRight < 0) ? (wndRight + 360) : wndRight); snprintf(sWndLbl, 4, "%03d", (wndRight < 0) ? (wndRight + 360) : wndRight);
getdisplay().print(sWndLbl); // Wind right value epd->print(sWndLbl); // Wind right value
getdisplay().drawCircle(width - 5, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol epd->drawCircle(width - 5, yOffset - 17, 2, commonData->fgcolor); // <degree> symbol
getdisplay().drawCircle(width - 5, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol epd->drawCircle(width - 5, yOffset - 17, 3, commonData->fgcolor); // <degree> symbol
if (pageData.boatHstry.twdHstry->getMax() == pageData.boatHstry.twdHstry->getMinVal()) { if (pageData.boatHstry.twdHstry->getMax() == pageData.boatHstry.twdHstry->getMinVal()) {
// only <INT16_MIN> values in buffer -> no valid wind data available // only <INT16_MIN> values in buffer -> no valid wind data available
@ -347,15 +348,15 @@ public:
if (((chrtPrevVal180 >= -180) && (chrtPrevVal180 < -90) && (chrtVal180 > 90)) || ((chrtPrevVal180 <= 179) && (chrtPrevVal180 > 90) && chrtVal180 <= -90)) { if (((chrtPrevVal180 >= -180) && (chrtPrevVal180 < -90) && (chrtVal180 > 90)) || ((chrtPrevVal180 <= 179) && (chrtPrevVal180 > 90) && chrtVal180 <= -90)) {
// If current value crosses chart borders compared to previous value, split line // If current value crosses chart borders compared to previous value, split line
int xSplit = (((chrtPrevVal180 > 0 ? wndRight : wndLeft) - wndLeft + 360) % 360) * chrtScl; int xSplit = (((chrtPrevVal180 > 0 ? wndRight : wndLeft) - wndLeft + 360) % 360) * chrtScl;
getdisplay().drawLine(prevX, prevY, xSplit, y, commonData->fgcolor); epd->drawLine(prevX, prevY, xSplit, y, commonData->fgcolor);
getdisplay().drawLine(prevX, prevY - 1, ((xSplit != prevX) ? xSplit : xSplit - 1), ((xSplit != prevX) ? y - 1 : y), commonData->fgcolor); epd->drawLine(prevX, prevY - 1, ((xSplit != prevX) ? xSplit : xSplit - 1), ((xSplit != prevX) ? y - 1 : y), commonData->fgcolor);
prevX = (((chrtVal180 > 0 ? wndRight : wndLeft) - wndLeft + 360) % 360) * chrtScl; prevX = (((chrtVal180 > 0 ? wndRight : wndLeft) - wndLeft + 360) % 360) * chrtScl;
} }
} }
// Draw line with 2 pixels width + make sure vertical line are drawn correctly // Draw line with 2 pixels width + make sure vertical line are drawn correctly
getdisplay().drawLine(prevX, prevY, x, y, commonData->fgcolor); epd->drawLine(prevX, prevY, x, y, commonData->fgcolor);
getdisplay().drawLine(prevX, prevY - 1, ((x != prevX) ? x : x - 1), ((x != prevX) ? y - 1 : y), commonData->fgcolor); epd->drawLine(prevX, prevY - 1, ((x != prevX) ? x : x - 1), ((x != prevX) ? y - 1 : y), commonData->fgcolor);
chrtPrevVal = chrtVal; chrtPrevVal = chrtVal;
prevX = x; prevX = x;
prevY = y; prevY = y;
@ -383,8 +384,8 @@ public:
} else { } else {
// No valid data available // No valid data available
LOG_DEBUG(GwLog::LOG, "PageWindPlot: No valid data available"); LOG_DEBUG(GwLog::LOG, "PageWindPlot: No valid data available");
getdisplay().setFont(&Ubuntu_Bold10pt8b); epd->setFont(&Ubuntu_Bold10pt8b);
getdisplay().fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message
drawTextCenter(xCenter, height / 2 - 10, "No data"); drawTextCenter(xCenter, height / 2 - 10, "No data");
} }
@ -409,39 +410,39 @@ public:
} }
lastZone = currentZone; lastZone = currentZone;
getdisplay().fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value epd->fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
getdisplay().setCursor(xPosTws, yPosTws); epd->setCursor(xPosTws, yPosTws);
if (!BDataValid[1]) { if (!BDataValid[1]) {
getdisplay().print("--.-"); epd->print("--.-");
} else { } else {
double dbl = BDataValue[1] * 3.6 / 1.852; double dbl = BDataValue[1] * 3.6 / 1.852;
if (dbl < 10.0) { if (dbl < 10.0) {
getdisplay().printf("!%3.1f", dbl); // Value, round to 1 decimal epd->printf("!%3.1f", dbl); // Value, round to 1 decimal
} else { } else {
getdisplay().printf("%4.1f", dbl); // Value, round to 1 decimal epd->printf("%4.1f", dbl); // Value, round to 1 decimal
} }
} }
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(xPosTws + 82, yPosTws - 14); epd->setCursor(xPosTws + 82, yPosTws - 14);
// getdisplay().print("TWS"); // Name // epd->print("TWS"); // Name
getdisplay().print(BDataName[1]); // Name epd->print(BDataName[1]); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
// getdisplay().setCursor(xPosTws + 78, yPosTws + 1); // epd->setCursor(xPosTws + 78, yPosTws + 1);
getdisplay().setCursor(xPosTws + 82, yPosTws + 1); epd->setCursor(xPosTws + 82, yPosTws + 1);
// getdisplay().printf(" kn"); // Unit // epd->printf(" kn"); // Unit
getdisplay().print(BDataUnit[1]); // Unit epd->print(BDataUnit[1]); // Unit
} }
// chart Y axis labels; print at last to overwrite potential chart lines in label area // chart Y axis labels; print at last to overwrite potential chart lines in label area
int yPos; int yPos;
int chrtLbl; int chrtLbl;
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
for (int i = 1; i <= 3; i++) { for (int i = 1; i <= 3; i++) {
yPos = yOffset + (i * 60); yPos = yOffset + (i * 60);
getdisplay().fillRect(0, yPos, width, 1, commonData->fgcolor); epd->fillRect(0, yPos, width, 1, commonData->fgcolor);
getdisplay().fillRect(0, yPos - 8, 24, 16, commonData->bgcolor); // Clear small area to remove potential chart lines epd->fillRect(0, yPos - 8, 24, 16, commonData->bgcolor); // Clear small area to remove potential chart lines
getdisplay().setCursor(1, yPos + 4); epd->setCursor(1, yPos + 4);
if (count >= intvBufSize) { if (count >= intvBufSize) {
// Calculate minute value for label // Calculate minute value for label
chrtLbl = ((i - 1 + (prevY < yOffset + 30)) * dataIntv) * -1; // change label if last data point is more than 30 lines (= seconds) from chart line chrtLbl = ((i - 1 + (prevY < yOffset + 30)) * dataIntv) * -1; // change label if last data point is more than 30 lines (= seconds) from chart line
@ -449,7 +450,7 @@ public:
int j = 3 - i; int j = 3 - i;
chrtLbl = (int((((numWndVals / dataIntv) - 50) * dataIntv / 60) + 1) - (j * dataIntv)) * -1; // 50 lines left below last chart line chrtLbl = (int((((numWndVals / dataIntv) - 50) * dataIntv / 60) + 1) - (j * dataIntv)) * -1; // 50 lines left below last chart line
} }
getdisplay().printf("%3d", chrtLbl); // Wind value label epd->printf("%3d", chrtLbl); // Wind value label
} }
return PAGE_UPDATE; return PAGE_UPDATE;
@ -476,4 +477,4 @@ PageDescription registerPageWindPlot(
true // Show display header on/off true // Show display header on/off
); );
#endif #endif

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -147,87 +148,87 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show values AWA // Show values AWA
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print(svalue1); // Value epd->print(svalue1); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 95); epd->setCursor(10, 95);
getdisplay().print(name1); // Name epd->print(name1); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 115); epd->setCursor(10, 115);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit1); // Unit epd->print(unit1); // Unit
} }
else{ else{
getdisplay().print(unit1old); // Unit epd->print(unit1old); // Unit
} }
// Horizintal separator left // Horizintal separator left
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
// Show values AWS // Show values AWS
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 270); epd->setCursor(10, 270);
getdisplay().print(svalue2); // Value epd->print(svalue2); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 220); epd->setCursor(10, 220);
getdisplay().print(name2); // Name epd->print(name2); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 190); epd->setCursor(10, 190);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); // Unit epd->print(unit2old); // Unit
} }
// Show values TWD // Show values TWD
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 65); epd->setCursor(295, 65);
if(valid3 == true){ if(valid3 == true){
getdisplay().print(abs(value3 * 180 / PI), 0); // Value epd->print(abs(value3 * 180 / PI), 0); // Value
} }
else{ else{
getdisplay().print("---"); // Value epd->print("---"); // Value
} }
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 95); epd->setCursor(335, 95);
getdisplay().print(name3); // Name epd->print(name3); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 115); epd->setCursor(335, 115);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); // Unit epd->print(unit3old); // Unit
} }
// Horizintal separator right // Horizintal separator right
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
// Show values TWS // Show values TWS
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 270); epd->setCursor(295, 270);
getdisplay().print(svalue4); // Value epd->print(svalue4); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 220); epd->setCursor(335, 220);
getdisplay().print(name4); // Name epd->print(name4); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 190); epd->setCursor(335, 190);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit4); // Unit epd->print(unit4); // Unit
} }
else{ else{
getdisplay().print(unit4old); // Unit epd->print(unit4old); // Unit
} }
//******************************************************************************************* //*******************************************************************************************
@ -236,10 +237,10 @@ public:
int rInstrument = 110; // Radius of grafic instrument int rInstrument = 110; // Radius of grafic instrument
float pi = 3.141592; float pi = 3.141592;
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle epd->fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle epd->fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle
for(int i=0; i<360; i=i+10) for(int i=0; i<360; i=i+10)
{ {
@ -267,17 +268,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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().print(ii); epd->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);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
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);
@ -288,10 +289,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
@ -308,7 +309,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument-15); float yy2 = -(rInstrument-15);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -318,43 +319,43 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument-15); float iy1 = -(rInstrument-15);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
//******************************************************************************************* //*******************************************************************************************
// Show values DBT // Show values DBT
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
getdisplay().setCursor(160, 200); epd->setCursor(160, 200);
getdisplay().print(svalue5); // Value epd->print(svalue5); // Value
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(190, 215); epd->setCursor(190, 215);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit5); // Unit epd->print(unit5); // Unit
} }
else{ else{
getdisplay().print(unit5old); // Unit epd->print(unit5old); // Unit
} }
// Show values STW // Show values STW
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
getdisplay().setCursor(160, 130); epd->setCursor(160, 130);
getdisplay().print(svalue6); // Value epd->print(svalue6); // Value
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(190, 90); epd->setCursor(190, 90);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit6); // Unit epd->print(unit6); // Unit
} }
else{ else{
getdisplay().print(unit6old); // Unit epd->print(unit6old); // Unit
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -147,88 +148,88 @@ public:
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// Show value 2 at position of value 1 (top left) // Show value 2 at position of value 1 (top left)
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 65); epd->setCursor(10, 65);
getdisplay().print(svalue2); // Value epd->print(svalue2); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 95); epd->setCursor(10, 95);
getdisplay().print(name2); // Name epd->print(name2); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 115); epd->setCursor(10, 115);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit2); // Unit epd->print(unit2); // Unit
} }
else{ else{
getdisplay().print(unit2old); // Unit epd->print(unit2old); // Unit
} }
// Horizintal separator left // Horizintal separator left
getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
// Show value 3 at bottom left // Show value 3 at bottom left
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(10, 270); epd->setCursor(10, 270);
getdisplay().print(svalue3); // Value epd->print(svalue3); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(10, 220); epd->setCursor(10, 220);
getdisplay().print(name3); // Name epd->print(name3); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(10, 190); epd->setCursor(10, 190);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit3); // Unit epd->print(unit3); // Unit
} }
else{ else{
getdisplay().print(unit3old); // Unit epd->print(unit3old); // Unit
} }
// Show value 4 at top right // Show value 4 at top right
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 65); epd->setCursor(295, 65);
if(valid3 == true){ if(valid3 == true){
// getdisplay().print(abs(value3 * 180 / M_PI), 0); // Value // epd->print(abs(value3 * 180 / M_PI), 0); // Value
getdisplay().print(svalue4); // Value epd->print(svalue4); // Value
} }
else{ else{
getdisplay().print("---"); // Value epd->print("---"); // Value
} }
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 95); epd->setCursor(335, 95);
getdisplay().print(name4); // Name epd->print(name4); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 115); epd->setCursor(335, 115);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit4); // Unit epd->print(unit4); // Unit
} }
else{ else{
getdisplay().print(unit4old); // Unit epd->print(unit4old); // Unit
} }
// Horizintal separator right // Horizintal separator right
getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
// Show value 5 at bottom right // Show value 5 at bottom right
getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
getdisplay().setCursor(295, 270); epd->setCursor(295, 270);
getdisplay().print(svalue5); // Value epd->print(svalue5); // Value
getdisplay().setFont(&Ubuntu_Bold12pt8b); epd->setFont(&Ubuntu_Bold12pt8b);
getdisplay().setCursor(335, 220); epd->setCursor(335, 220);
getdisplay().print(name5); // Name epd->print(name5); // Name
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(335, 190); epd->setCursor(335, 190);
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit5); // Unit epd->print(unit5); // Unit
} }
else{ else{
getdisplay().print(unit5old); // Unit epd->print(unit5old); // Unit
} }
@ -237,10 +238,10 @@ public:
// Draw wind rose // Draw wind rose
int rInstrument = 110; // Radius of grafic instrument int rInstrument = 110; // Radius of grafic instrument
getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle
getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle epd->fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle
getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle epd->fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle
for(int i=0; i<360; i=i+10) for(int i=0; i<360; i=i+10)
{ {
@ -267,17 +268,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
getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string
getdisplay().setCursor(x-w/2, y+h/2); epd->setCursor(x-w/2, y+h/2);
if(i % 30 == 0){ if(i % 30 == 0){
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().print(ii); epd->print(ii);
} }
// Draw sub scale with dots // Draw sub scale with dots
float x1c = 200 + rInstrument*sin(i/180.0*M_PI); float x1c = 200 + rInstrument*sin(i/180.0*M_PI);
float y1c = 150 - rInstrument*cos(i/180.0*M_PI); float y1c = 150 - rInstrument*cos(i/180.0*M_PI);
getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor);
float sinx=sin(i/180.0*M_PI); float sinx=sin(i/180.0*M_PI);
float cosx=cos(i/180.0*M_PI); float cosx=cos(i/180.0*M_PI);
@ -288,10 +289,10 @@ public:
float xx2 = +dx; float xx2 = +dx;
float yy1 = -(rInstrument-10); float yy1 = -(rInstrument-10);
float yy2 = -(rInstrument+10); float yy2 = -(rInstrument+10);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor);
getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor);
} }
@ -308,7 +309,7 @@ public:
float xx2 = startwidth; float xx2 = startwidth;
float yy1 = -startwidth; float yy1 = -startwidth;
float yy2 = -(rInstrument-15); float yy2 = -(rInstrument-15);
getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor);
// Inverted pointer // Inverted pointer
@ -318,36 +319,36 @@ public:
float ix2 = -endwidth; float ix2 = -endwidth;
float iy1 = -(rInstrument-15); float iy1 = -(rInstrument-15);
float iy2 = -endwidth; float iy2 = -endwidth;
getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), epd->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),commonData->fgcolor); 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor);
} }
// Center circle // Center circle
getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor);
getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor);
//******************************************************************************************* //*******************************************************************************************
// Show value6, so that it does not collide with the wind pointer // Show value6, so that it does not collide with the wind pointer
getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
if (cos(value1) > 0){ if (cos(value1) > 0){
getdisplay().setCursor(160, 200); epd->setCursor(160, 200);
getdisplay().print(svalue6); // Value epd->print(svalue6); // Value
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(190, 215); epd->setCursor(190, 215);
} else{ } else{
getdisplay().setCursor(160, 130); epd->setCursor(160, 130);
getdisplay().print(svalue6); // Value epd->print(svalue6); // Value
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(190, 90); epd->setCursor(190, 90);
} }
getdisplay().print(" "); epd->print(" ");
if(holdvalues == false){ if(holdvalues == false){
getdisplay().print(unit6); // Unit epd->print(unit6); // Unit
} }
else{ else{
getdisplay().print(unit6old); // Unit epd->print(unit6old); // Unit
} }
return PAGE_UPDATE; return PAGE_UPDATE;

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h" #include "Pagedata.h"
@ -45,14 +46,14 @@ class PageXTETrack : public Page
if (fill == true) { if (fill == true) {
// no primitive for quadrangular object // no primitive for quadrangular object
// we create it from 2 triangles // we create it from 2 triangles
getdisplay().fillTriangle(x0, y0, x1, y1, x3, y3, color); epd->fillTriangle(x0, y0, x1, y1, x3, y3, color);
getdisplay().fillTriangle(x1, y1, x2, y2, x3, y3, color); epd->fillTriangle(x1, y1, x2, y2, x3, y3, color);
} else { } else {
// draw outline // draw outline
getdisplay().drawLine(x0, y0, x1, y1, color); epd->drawLine(x0, y0, x1, y1, color);
getdisplay().drawLine(x1, y1, x2, y2, color); epd->drawLine(x1, y1, x2, y2, color);
getdisplay().drawLine(x2, y2, x3, y3, color); epd->drawLine(x2, y2, x3, y3, color);
getdisplay().drawLine(x3, y3, x0, y0, color); epd->drawLine(x3, y3, x0, y0, color);
} }
} }
@ -89,57 +90,57 @@ class PageXTETrack : public Page
//*********************************************************** //***********************************************************
// Set display in partial refresh mode // Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
getdisplay().setTextColor(commonData->fgcolor); epd->setTextColor(commonData->fgcolor);
// descriptions // descriptions
getdisplay().setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(50, 188); epd->setCursor(50, 188);
getdisplay().print("Cross-track error"); epd->print("Cross-track error");
getdisplay().setCursor(270, 188); epd->setCursor(270, 188);
getdisplay().print("Track"); epd->print("Track");
getdisplay().setCursor(45, 275); epd->setCursor(45, 275);
getdisplay().print("Distance to waypoint"); epd->print("Distance to waypoint");
getdisplay().setCursor(260, 275); epd->setCursor(260, 275);
getdisplay().print("Bearing"); epd->print("Bearing");
// values // values
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); epd->setFont(&DSEG7Classic_BoldItalic30pt7b);
int16_t x, y; int16_t x, y;
uint16_t w, h; uint16_t w, h;
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
String sval_xte = formatValue(bv_xte, *commonData).svalue; String sval_xte = formatValue(bv_xte, *commonData).svalue;
getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h); epd->getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(160-w, 170); epd->setCursor(160-w, 170);
getdisplay().print(sval_xte); epd->print(sval_xte);
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
String sval_cog = formatValue(bv_cog, *commonData).svalue; String sval_cog = formatValue(bv_cog, *commonData).svalue;
getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h); epd->getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(360-w, 170); epd->setCursor(360-w, 170);
getdisplay().print(sval_cog); epd->print(sval_cog);
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
String sval_dtw = formatValue(bv_dtw, *commonData).svalue; String sval_dtw = formatValue(bv_dtw, *commonData).svalue;
getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h); epd->getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(160-w, 257); epd->setCursor(160-w, 257);
getdisplay().print(sval_dtw); epd->print(sval_dtw);
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
String sval_btw = formatValue(bv_btw, *commonData).svalue; String sval_btw = formatValue(bv_btw, *commonData).svalue;
getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h); epd->getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(360-w, 257); epd->setCursor(360-w, 257);
getdisplay().print(sval_btw); epd->print(sval_btw);
bool valid = bv_cog->valid && bv_btw->valid; bool valid = bv_cog->valid && bv_btw->valid;
// XTETrack view // XTETrack view
// draw ship symbol (as bitmap) // draw ship symbol (as bitmap)
getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData->fgcolor); epd->drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData->fgcolor);
// draw next waypoint name // draw next waypoint name
String sval_wpname = "no data"; String sval_wpname = "no data";
@ -148,13 +149,13 @@ class PageXTETrack : public Page
sval_wpname = "Tonne 122"; sval_wpname = "Tonne 122";
} }
getdisplay().setFont(&Ubuntu_Bold10pt8b); epd->setFont(&Ubuntu_Bold10pt8b);
getdisplay().getTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h); epd->getTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h);
// TODO if text don't fix use smaller font size. // TODO if text don't fix use smaller font size.
// if smallest size does not fit use 2 lines // if smallest size does not fit use 2 lines
// last resort: clip with ellipsis // last resort: clip with ellipsis
getdisplay().setCursor(200 - w / 2, 60); epd->setCursor(200 - w / 2, 60);
getdisplay().print(sval_wpname); epd->print(sval_wpname);
// draw course segments // draw course segments