From b8a31f2280729849ab0eb2f4d8815b52c8d82f93 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Tue, 5 Aug 2025 08:52:45 +0200 Subject: [PATCH] Finalize switch to epd pointer instead if getdisplay() --- lib/obp60task/OBP60Extensions.cpp | 132 ++++++------ lib/obp60task/OBP60Extensions.h | 12 +- lib/obp60task/OBP60QRWiFi.h | 14 +- lib/obp60task/PageAnchor.cpp | 95 ++++----- lib/obp60task/PageBME280.cpp | 63 +++--- lib/obp60task/PageBattery.cpp | 131 ++++++------ lib/obp60task/PageBattery2.cpp | 155 +++++++------- lib/obp60task/PageClock.cpp | 123 +++++------ lib/obp60task/PageCompass.cpp | 63 +++--- lib/obp60task/PageDST810.cpp | 99 ++++----- lib/obp60task/PageFluid.cpp | 45 ++-- lib/obp60task/PageFourValues.cpp | 131 ++++++------ lib/obp60task/PageFourValues2.cpp | 131 ++++++------ lib/obp60task/PageGenerator.cpp | 133 ++++++------ lib/obp60task/PageKeelPosition.cpp | 55 ++--- lib/obp60task/PageOneValue.cpp | 35 ++-- lib/obp60task/PageRollPitch.cpp | 113 +++++----- lib/obp60task/PageRudderPosition.cpp | 55 ++--- lib/obp60task/PageSixValues.cpp | 49 ++--- lib/obp60task/PageSkyView.cpp | 73 +++---- lib/obp60task/PageSolar.cpp | 127 +++++------ lib/obp60task/PageSystem.cpp | 303 ++++++++++++++------------- lib/obp60task/PageThreeValues.cpp | 99 ++++----- lib/obp60task/PageTwoValues.cpp | 67 +++--- lib/obp60task/PageVoltage.cpp | 116 +++++----- lib/obp60task/PageWhite.cpp | 11 +- lib/obp60task/PageWind.cpp | 119 +++++------ lib/obp60task/PageWindPlot.cpp | 93 ++++---- lib/obp60task/PageWindRose.cpp | 161 +++++++------- lib/obp60task/PageWindRoseFlex.cpp | 155 +++++++------- lib/obp60task/PageXTETrack.cpp | 71 +++---- 31 files changed, 1516 insertions(+), 1513 deletions(-) diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index e33097b..a34aca9 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -33,34 +33,20 @@ #ifdef DISPLAY_GDEW042T2 // Set display type and SPI pins for display GxEPD2_BW 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 & getdisplay(){return display;} // DEPRECATED -gxepd2display *epd = &display; #endif - #ifdef DISPLAY_GDEY042T81 // Set display type and SPI pins for display GxEPD2_BW 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 & getdisplay(){return display;} // DEPRECATED -gxepd2display *epd = &display; #endif - #ifdef DISPLAY_GYE042A87 // Set display type and SPI pins for display GxEPD2_BW 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 & getdisplay(){return display;} // DEPRECATED -gxepd2display *epd = &display; #endif - #ifdef DISPLAY_SE0420NQ04 // Set display type and SPI pins for display GxEPD2_BW 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 & getdisplay(){return display;} // DEPRECATED -gxepd2display *epd = &display; #endif +gxepd2display *epd = &display; // Horter I2C moduls 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 buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms // Shutdown EInk display - getdisplay().setFullWindow(); // Set full Refresh - getdisplay().fillScreen(common.bgcolor); // Clear screen - getdisplay().setTextColor(common.fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(85, 150); - getdisplay().print("Sleep Mode"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(65, 175); - getdisplay().print("To wake up press key and wait 5s"); - getdisplay().nextPage(); // Update display contents - getdisplay().powerOff(); // Display power off + epd->setFullWindow(); // Set full Refresh + epd->fillScreen(common.bgcolor); // Clear screen + epd->setTextColor(common.fgcolor); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(85, 150); + epd->print("Sleep Mode"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(65, 175); + epd->print("To wake up press key and wait 5s"); + epd->nextPage(); // Update display contents + epd->powerOff(); // Display power off setPortPin(OBP_POWER_50, false); // Power off ePaper display // Stop system 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 setFlashLED(false); // Flash LED Off // Shutdown EInk display - getdisplay().setFullWindow(); // Set full Refresh - //getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().fillScreen(common.bgcolor); // Clear screen - getdisplay().setTextColor(common.fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(85, 150); - getdisplay().print("Sleep Mode"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(65, 175); - getdisplay().print("To wake up press wheel and wait 5s"); - getdisplay().nextPage(); // Partial update - getdisplay().powerOff(); // Display power off + epd->setFullWindow(); // Set full Refresh + //epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update + epd->fillScreen(common.bgcolor); // Clear screen + epd->setTextColor(common.fgcolor); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(85, 150); + epd->print("Sleep Mode"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(65, 175); + epd->print("To wake up press wheel and wait 5s"); + epd->nextPage(); // Partial update + epd->powerOff(); // Display power off setPortPin(OBP_POWER_EPD, false); // Power off ePaper display setPortPin(OBP_POWER_SD, false); // Power off SD card // Stop system @@ -353,17 +339,17 @@ String xdrDelete(String input){ } void fillPoly4(const std::vector& p4, uint16_t color) { - getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[1].x, p4[1].y, p4[2].x, p4[2].y, color); - getdisplay().fillTriangle(p4[0].x, p4[0].y, p4[2].x, p4[2].y, p4[3].x, p4[3].y, color); + epd->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[2].x, p4[2].y, p4[3].x, p4[3].y, color); } void drawPoly(const std::vector& points, uint16_t color) { size_t polysize = points.size(); 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 - 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 @@ -413,46 +399,46 @@ std::vector wordwrap(String &line, uint16_t maxwidth) { void drawTextCenter(int16_t cx, int16_t cy, String text) { int16_t x1, y1; uint16_t w, h; - getdisplay().getTextBounds(text, 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(cx - w / 2, cy + h / 2); - getdisplay().print(text); + epd->getTextBounds(text, 0, 150, &x1, &y1, &w, &h); + epd->setCursor(cx - w / 2, cy + h / 2); + epd->print(text); } // Draw right aligned text void drawTextRalign(int16_t x, int16_t y, String text) { int16_t x1, y1; uint16_t w, h; - getdisplay().getTextBounds(text, 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(x - w, y); - getdisplay().print(text); + epd->getTextBounds(text, 0, 150, &x1, &y1, &w, &h); + epd->setCursor(x - w, y); + epd->print(text); } // Draw text inside box, normal or inverted void drawTextBoxed(Rect box, String text, uint16_t fg, uint16_t bg, bool inverted, bool border) { if (inverted) { - getdisplay().fillRect(box.x, box.y, box.w, box.h, fg); - getdisplay().setTextColor(bg); + epd->fillRect(box.x, box.y, box.w, box.h, fg); + epd->setTextColor(bg); } else { if (border) { - getdisplay().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->fillRect(box.x + 1, box.y + 1, box.w - 2, box.h - 2, bg); + 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 - getdisplay().setCursor(box.x + border_offset, box.y + box.h - border_offset); - getdisplay().print(text); - getdisplay().setTextColor(fg); + epd->setCursor(box.x + border_offset, box.y + box.h - border_offset); + epd->print(text); + epd->setTextColor(fg); } // 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){ - 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) 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 @@ -482,57 +468,57 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da } // Show status info - getdisplay().setTextColor(commonData.fgcolor); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(0, 15); + epd->setTextColor(commonData.fgcolor); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(0, 15); if (commonData.status.wifiApOn) { 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; } else { - getdisplay().print(" AP "); + epd->print(" AP "); } } // 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 (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; } else { - getdisplay().print("TCP "); + epd->print("TCP "); } } if(commonData.status.n2kRx != n2kRxOld || commonData.status.n2kTx != n2kTxOld){ 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; } else { - getdisplay().print("N2K "); + epd->print("N2K "); } } if(commonData.status.serRx != serRxOld || commonData.status.serTx != serTxOld){ 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; } else { - getdisplay().print("183 "); + epd->print("183 "); } } if(commonData.status.usbRx != usbRxOld || commonData.status.usbTx != usbTxOld){ 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; } else { - getdisplay().print("USB "); + epd->print("USB "); } } 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 (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; } else { - getdisplay().print("GPS"); + epd->print("GPS"); } } // Save old telegram counter diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index 14fa027..7bbc7e0 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -50,28 +50,18 @@ extern const GFXfont Atari16px; // Global functions #ifdef DISPLAY_GDEW042T2 -GxEPD2_BW & getdisplay(); // DEPRECATED typedef GxEPD2_BW gxepd2display; -extern gxepd2display *epd; #endif - #ifdef DISPLAY_GDEY042T81 -GxEPD2_BW & getdisplay(); // DEPRECATED typedef GxEPD2_BW gxepd2display; -extern gxepd2display *epd; #endif - #ifdef DISPLAY_GYE042A87 -GxEPD2_BW & getdisplay(); // DEPRECATED typedef GxEPD2_BW gxepd2display; -extern gxepd2display *epd; #endif - #ifdef DISPLAY_SE0420NQ04 -GxEPD2_BW & getdisplay(); // DEPRECATED typedef GxEPD2_BW gxepd2display; -extern gxepd2display *epd; #endif +extern gxepd2display *epd; // Page display return values #define PAGE_OK 0 // all ok, do nothing diff --git a/lib/obp60task/OBP60QRWiFi.h b/lib/obp60task/OBP60QRWiFi.h index d3f5248..5fa8dbd 100644 --- a/lib/obp60task/OBP60QRWiFi.h +++ b/lib/obp60task/OBP60QRWiFi.h @@ -26,20 +26,20 @@ void qrWiFi(String ssid, String passwd, uint16_t fgcolor, uint16_t bgcolor){ // Each horizontal module for (uint8_t x = 0; x < qrcode.size; x++) { if(qrcode_getModule(&qrcode, x, y)){ - getdisplay().fillRect(box_x, box_y, box_s, box_s, fgcolor); + epd->fillRect(box_x, box_y, box_s, box_s, fgcolor); } 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_y = box_y + box_s; box_x = init_x; } - getdisplay().setFont(&Ubuntu_Bold32pt8b); - getdisplay().setTextColor(fgcolor); - getdisplay().setCursor(140, 285); - getdisplay().print("WiFi"); - getdisplay().nextPage(); // Full Refresh + epd->setFont(&Ubuntu_Bold32pt8b); + epd->setTextColor(fgcolor); + epd->setCursor(140, 285); + epd->print("WiFi"); + epd->nextPage(); // Full Refresh } #endif diff --git a/lib/obp60task/PageAnchor.cpp b/lib/obp60task/PageAnchor.cpp index 476ed20..3500272 100644 --- a/lib/obp60task/PageAnchor.cpp +++ b/lib/obp60task/PageAnchor.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -130,64 +131,64 @@ private: } // Title and corner value headings - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("Anchor"); + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + epd->print("Anchor"); - getdisplay().setFont(&Ubuntu_Bold10pt8b); - getdisplay().setCursor(8, 200); - getdisplay().print("Depth"); + epd->setFont(&Ubuntu_Bold10pt8b); + epd->setCursor(8, 200); + epd->print("Depth"); drawTextRalign(392, 38, "Chain"); drawTextRalign(392, 200, "Wind"); // Units - getdisplay().setCursor(8, 272); - getdisplay().print(sunit_dbs); + epd->setCursor(8, 272); + epd->print(sunit_dbs); drawTextRalign(392, 272, sunit_aws); drawTextRalign(392, 100, lengthformat); // chain unit not implemented // Corner values - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(8, 70); - getdisplay().print("Alarm: "); - getdisplay().print(alarm_enabled ? "On" : "Off"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(8, 70); + epd->print("Alarm: "); + epd->print(alarm_enabled ? "On" : "Off"); - getdisplay().setCursor(8, 90); - getdisplay().print("HDOP"); - getdisplay().setCursor(8, 106); + epd->setCursor(8, 90); + epd->print("HDOP"); + epd->setCursor(8, 106); if (bv_hdop->valid) { - getdisplay().print(round(bv_hdop->value), 0); - getdisplay().print(sunit_hdop); + epd->print(round(bv_hdop->value), 0); + epd->print(sunit_hdop); } else { - getdisplay().print("n/a"); + epd->print("n/a"); } // Values - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); // Current chain used - getdisplay().setCursor(328, 85); - getdisplay().print("27"); + epd->setCursor(328, 85); + epd->print("27"); // Depth - getdisplay().setCursor(8, 250); - getdisplay().print(sval_dbs); + epd->setCursor(8, 250); + epd->print(sval_dbs); // Wind - getdisplay().setCursor(328, 250); - getdisplay().print(sval_aws); + epd->setCursor(328, 250); + epd->print(sval_aws); - getdisplay().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, commonData->fgcolor); + epd->drawCircle(c.x, c.y, r + 1, commonData->fgcolor); // 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 - getdisplay().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); + epd->drawLine(c.x + 10, c.y, c.x + 16, c.y + 4, commonData->fgcolor); // arrow right - getdisplay().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); - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->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); + epd->setFont(&Ubuntu_Bold8pt8b); drawTextCenter(c.x + r / 2, c.y + 8, String(scale) + "m"); // alarm range circle @@ -196,28 +197,28 @@ private: // r and r_range are pixel values uint16_t r_range = int(alarm_range * r / scale); 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) - 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); } void displayModeConfig() { - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("Anchor configuration"); + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + epd->print("Anchor configuration"); // TODO // show lat/lon for anchor pos // show lat/lon for boat pos // show distance anchor <-> boat - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); for (int i = 0 ; i < menu->getItemCount(); i++) { ConfigMenuItem *itm = menu->getItemByIndex(i); if (!itm) { @@ -228,14 +229,14 @@ private: drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false); if (inverted and editmode > 0) { // 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") { - getdisplay().print(itm->getValue()); - getdisplay().print(itm->getUnit()); + epd->print(itm->getValue()); + epd->print(itm->getUnit()); } 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); // 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') { displayModeNormal(pageData); diff --git a/lib/obp60task/PageBME280.cpp b/lib/obp60task/PageBME280.cpp index 540d5c5..22336ea 100644 --- a/lib/obp60task/PageBME280.cpp +++ b/lib/obp60task/PageBME280.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -105,76 +106,76 @@ class PageBME280 : public Page //*********************************************************** // 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 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 55); - getdisplay().print(name1); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 55); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 90); - getdisplay().print(unit1); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 90); + epd->print(unit1); // Unit // Switch font if format for any values - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 90); // Show bus data - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); + epd->fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 145); - getdisplay().print(name2); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 145); + epd->print(name2); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 180); - getdisplay().print(unit2); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 180); + epd->print(unit2); // Unit // Switch font if format for any values - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 180); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 180); // Show bus data - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); + epd->fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 235); - getdisplay().print(name3); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 235); + epd->print(name3); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 270); - getdisplay().print(unit3); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 270); + epd->print(unit3); // Unit // Switch font if format for any values - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(140, 270); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(140, 270); // Show bus data - getdisplay().print(svalue3); // Real value as formated string + epd->print(svalue3); // Real value as formated string return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageBattery.cpp b/lib/obp60task/PageBattery.cpp index 463b848..743f873 100644 --- a/lib/obp60task/PageBattery.cpp +++ b/lib/obp60task/PageBattery.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -158,134 +159,134 @@ class PageBattery : public Page //*********************************************************** // 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 - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold8pt8b); switch (average) { case 0: - getdisplay().setCursor(60, 90); - getdisplay().print("Avg: 1s"); - getdisplay().setCursor(60, 180); - getdisplay().print("Avg: 1s"); - getdisplay().setCursor(60, 270); - getdisplay().print("Avg: 1s"); + epd->setCursor(60, 90); + epd->print("Avg: 1s"); + epd->setCursor(60, 180); + epd->print("Avg: 1s"); + epd->setCursor(60, 270); + epd->print("Avg: 1s"); break; case 1: - getdisplay().setCursor(60, 90); - getdisplay().print("Avg: 10s"); - getdisplay().setCursor(60, 180); - getdisplay().print("Avg: 10s"); - getdisplay().setCursor(60, 270); - getdisplay().print("Avg: 10s"); + epd->setCursor(60, 90); + epd->print("Avg: 10s"); + epd->setCursor(60, 180); + epd->print("Avg: 10s"); + epd->setCursor(60, 270); + epd->print("Avg: 10s"); break; case 2: - getdisplay().setCursor(60, 90); - getdisplay().print("Avg: 60s"); - getdisplay().setCursor(60, 180); - getdisplay().print("Avg: 60s"); - getdisplay().setCursor(60, 270); - getdisplay().print("Avg: 60s"); + epd->setCursor(60, 90); + epd->print("Avg: 60s"); + epd->setCursor(60, 180); + epd->print("Avg: 60s"); + epd->setCursor(60, 270); + epd->print("Avg: 60s"); break; case 3: - getdisplay().setCursor(60, 90); - getdisplay().print("Avg: 300s"); - getdisplay().setCursor(60, 180); - getdisplay().print("Avg: 300s"); - getdisplay().setCursor(60, 270); - getdisplay().print("Avg: 300s"); + epd->setCursor(60, 90); + epd->print("Avg: 300s"); + epd->setCursor(60, 180); + epd->print("Avg: 300s"); + epd->setCursor(60, 270); + epd->print("Avg: 300s"); break; default: - getdisplay().setCursor(60, 90); - getdisplay().print("Avg: 1s"); - getdisplay().setCursor(60, 180); - getdisplay().print("Avg: 1s"); - getdisplay().setCursor(60, 270); - getdisplay().print("Avg: 1s"); + epd->setCursor(60, 90); + epd->print("Avg: 1s"); + epd->setCursor(60, 180); + epd->print("Avg: 1s"); + epd->setCursor(60, 270); + epd->print("Avg: 1s"); break; } // ############### Value 1 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 55); - getdisplay().print(name1); // Value name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 55); + epd->print(name1); // Value name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 90); - getdisplay().print(unit1); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 90); + epd->print(unit1); // Unit // Show value - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 90); // Show bus data if(String(powsensor1) != "off"){ - getdisplay().print(value1,2); // Real value as formated string + epd->print(value1,2); // Real value as formated string } else{ - getdisplay().print("---"); // No sensor data (sensor is off) + epd->print("---"); // No sensor data (sensor is off) } // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); + epd->fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 145); - getdisplay().print(name2); // Value name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 145); + epd->print(name2); // Value name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 180); - getdisplay().print(unit2); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 180); + epd->print(unit2); // Unit // Show value - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 180); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 180); // Show bus data if(String(powsensor1) != "off"){ - getdisplay().print(value2,1); // Real value as formated string + epd->print(value2,1); // Real value as formated string } else{ - getdisplay().print("---"); // No sensor data (sensor is off) + epd->print("---"); // No sensor data (sensor is off) } // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); + epd->fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 235); - getdisplay().print(name3); // Value name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 235); + epd->print(name3); // Value name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 270); - getdisplay().print(unit3); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 270); + epd->print(unit3); // Unit // Show value - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 270); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 270); // Show bus data if(String(powsensor1) != "off"){ - getdisplay().print(value3,1); // Real value as formated string + epd->print(value3,1); // Real value as formated string } else{ - getdisplay().print("---"); // No sensor data (sensor is off) + epd->print("---"); // No sensor data (sensor is off) } return PAGE_UPDATE; diff --git a/lib/obp60task/PageBattery2.cpp b/lib/obp60task/PageBattery2.cpp index b0b712b..d4683b9 100644 --- a/lib/obp60task/PageBattery2.cpp +++ b/lib/obp60task/PageBattery2.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -184,107 +185,107 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(10, 65); - getdisplay().print("Bat."); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(10, 65); + epd->print("Bat."); // Show battery type - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(90, 65); - getdisplay().print(batType); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(90, 65); + epd->print(batType); // Show voltage type - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 140); int bvoltage = 0; if(String(batVoltage) == "12V") bvoltage = 12; else bvoltage = 24; - getdisplay().print(bvoltage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->print(bvoltage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show battery capacity - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 200); - if(batCapacity <= 999) getdisplay().print(batCapacity, 0); - if(batCapacity > 999) getdisplay().print(float(batCapacity/1000.0), 1); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - if(batCapacity <= 999) getdisplay().print("Ah"); - if(batCapacity > 999) getdisplay().print("kAh"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 200); + if(batCapacity <= 999) epd->print(batCapacity, 0); + if(batCapacity > 999) epd->print(float(batCapacity/1000.0), 1); + epd->setFont(&Ubuntu_Bold16pt8b); + if(batCapacity <= 999) epd->print("Ah"); + if(batCapacity > 999) epd->print("kAh"); // Show info - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 235); - getdisplay().print("Installed"); - getdisplay().setCursor(10, 255); - getdisplay().print("Battery Type"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 235); + epd->print("Installed"); + epd->setCursor(10, 255); + epd->print("Battery Type"); // Show battery with fill level batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor); // Show average settings - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(150, 145); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(150, 145); switch (average) { case 0: - getdisplay().print("Avg: 1s"); + epd->print("Avg: 1s"); break; case 1: - getdisplay().print("Avg: 10s"); + epd->print("Avg: 10s"); break; case 2: - getdisplay().print("Avg: 60s"); + epd->print("Avg: 60s"); break; case 3: - getdisplay().print("Avg: 300s"); + epd->print("Avg: 300s"); break; default: - getdisplay().print("Avg: 1s"); + epd->print("Avg: 1s"); break; } // Show fill level in percent - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 200); - getdisplay().print(batPercentage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("%"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 200); + epd->print(batPercentage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("%"); // Show time to full discharge - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 260); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 260); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(batRange < 9.9) getdisplay().print(batRange, 1); - else getdisplay().print(batRange, 0); + if(batRange < 9.9) epd->print(batRange, 1); + else epd->print(batRange, 0); } - else getdisplay().print("--"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("h"); + else epd->print("--"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("h"); // Show sensor type info String i2cAddr = ""; - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(270, 60); - if(powerSensor == "off") getdisplay().print("Internal"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(270, 60); + if(powerSensor == "off") epd->print("Internal"); if(powerSensor == "INA219"){ - getdisplay().print("INA219"); + epd->print("INA219"); } if(powerSensor == "INA226"){ - getdisplay().print("INA226"); + epd->print("INA226"); i2cAddr = " (0x" + String(INA226_I2C_ADDR1, HEX) + ")"; } - getdisplay().print(i2cAddr); - getdisplay().setCursor(270, 80); - getdisplay().print("Sensor Modul"); + epd->print(i2cAddr); + epd->setCursor(270, 80); + epd->print("Sensor Modul"); // Reading bus data or using simulation data - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 140); if(simulation == true){ if(batVoltage == "12V"){ value1 = 12.0; @@ -293,46 +294,46 @@ public: value1 = 24.0; } value1 += float(random(0, 5)) / 10; // Simulation data - getdisplay().print(value1,1); + epd->print(value1,1); } else{ // Check for valid real data, display also if hold values activated if(valid1 == true || holdvalues == true){ // Resolution switching - if(value1 <= 9.9) getdisplay().print(value1, 2); - if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); - if(value1 > 99.9) getdisplay().print(value1, 0); + if(value1 <= 9.9) epd->print(value1, 2); + if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1); + if(value1 > 99.9) epd->print(value1, 0); } else{ - getdisplay().print("---"); // Missing bus data + epd->print("---"); // Missing bus data } } - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show actual current in A - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 200); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 200); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value2 <= 9.9) getdisplay().print(value2, 2); - if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); - if(value2 > 99.9) getdisplay().print(value2, 0); + if(value2 <= 9.9) epd->print(value2, 2); + if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1); + if(value2 > 99.9) epd->print(value2, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("A"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("A"); // Show actual consumption in W - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 260); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 260); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value3 <= 9.9) getdisplay().print(value3, 2); - if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); - if(value3 > 99.9) getdisplay().print(value3, 0); + if(value3 <= 9.9) epd->print(value3, 2); + if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1); + if(value3 > 99.9) epd->print(value3, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("W"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("W"); return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageClock.cpp b/lib/obp60task/PageClock.cpp index 27d0e76..5733317 100644 --- a/lib/obp60task/PageClock.cpp +++ b/lib/obp60task/PageClock.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -182,65 +183,65 @@ bool homevalid = false; // homelat and homelon are valid //*********************************************************** // 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; struct tm *local_tm = localtime(&tv); // Show values GPS date - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 65); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 65); if (holdvalues == false) { if (source == 'G') { // GPS value - getdisplay().print(svalue2); + epd->print(svalue2); } else if (commonData->data.rtcValid) { // RTC value 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 { - 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 { - getdisplay().print("---"); + epd->print("---"); } } else { - getdisplay().print(svalue2old); + epd->print(svalue2old); } - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 95); - getdisplay().print("Date"); // Name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 95); + epd->print("Date"); // Name // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); + epd->fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values GPS time - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 250); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 250); if (holdvalues == false) { if (source == 'G') { - getdisplay().print(svalue1); // Value + epd->print(svalue1); // Value } else if (commonData->data.rtcValid) { 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 { - 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 { - getdisplay().print("---"); + epd->print("---"); } } else { - getdisplay().print(svalue1old); + epd->print(svalue1old); } - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 220); - getdisplay().print("Time"); // Name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 220); + epd->print("Time"); // Name // Show values sunrise String sunrise = "---"; @@ -251,16 +252,16 @@ bool homevalid = false; // homelat and homelon are valid sunrise = String("06:42"); } - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 65); - if(holdvalues == false) getdisplay().print(sunrise); // Value - else getdisplay().print(svalue5old); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 95); - getdisplay().print("SunR"); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 65); + if(holdvalues == false) epd->print(sunrise); // Value + else epd->print(svalue5old); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 95); + epd->print("SunR"); // Name // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); + epd->fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values sunset String sunset = "---"; @@ -271,13 +272,13 @@ bool homevalid = false; // homelat and homelon are valid sunset = String("21:03"); } - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 250); - if(holdvalues == false) getdisplay().print(sunset); // Value - else getdisplay().print(svalue6old); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 220); - getdisplay().print("SunS"); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 250); + if(holdvalues == false) epd->print(sunset); // Value + else epd->print(svalue6old); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 220); + epd->print("SunS"); // Name //******************************************************************************************* @@ -285,8 +286,8 @@ bool homevalid = false; // homelat and homelon are valid int rInstrument = 110; // Radius of clock float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle 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 int16_t x1, y1; // 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 - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 30 == 0){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->print(ii); } // Draw sub scale with dots @@ -327,7 +328,7 @@ bool homevalid = false; // homelat and homelon are valid if(i % 6 == 0){ float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); + epd->fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); sinx=sin(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 yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } // Print Unit in clock - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(175, 110); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(175, 110); if(holdvalues == false){ - getdisplay().print(tz == 'L' ? "LOT" : "UTC"); + epd->print(tz == 'L' ? "LOT" : "UTC"); } else{ - getdisplay().print(unit2old); // date unit + epd->print(unit2old); // date unit } - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(185, 190); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(185, 190); if (source == 'G') { - getdisplay().print("GPS"); + epd->print("GPS"); } else { - getdisplay().print("RTC"); + epd->print("RTC"); } // Clock values @@ -406,7 +407,7 @@ bool homevalid = false; // homelat and homelon are valid float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -416,7 +417,7 @@ bool homevalid = false; // homelat and homelon are valid float ix2 = -endwidth; float iy1 = -(rInstrument * 0.5); 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*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 yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -442,14 +443,14 @@ bool homevalid = false; // homelat and homelon are valid float ix2 = -endwidth; float iy1 = -(rInstrument - 15); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); + epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor); return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageCompass.cpp b/lib/obp60task/PageCompass.cpp index db98c87..68c0030 100644 --- a/lib/obp60task/PageCompass.cpp +++ b/lib/obp60task/PageCompass.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -109,27 +110,27 @@ class PageCompass : public Page //*********************************************************** // Set display in partial refresh mode - getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData->fgcolor); + epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update + epd->setTextColor(commonData->fgcolor); // Horizontal line 2 pix top & bottom // Print data on top half - getdisplay().fillRect(0, 130, 400, 2, commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(10, 70); - getdisplay().print(DataName[WhichDataDisplay]); // Page name + epd->fillRect(0, 130, 400, 2, commonData->fgcolor); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(10, 70); + epd->print(DataName[WhichDataDisplay]); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 120); - getdisplay().print(DataUnits[WhichDataDisplay]); - getdisplay().setCursor(190, 120); - getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 120); + epd->print(DataUnits[WhichDataDisplay]); + epd->setCursor(190, 120); + epd->setFont(&DSEG7Classic_BoldItalic42pt7b); if(holdvalues == false){ - getdisplay().print(DataText[WhichDataDisplay]); // Real value as formated string + epd->print(DataText[WhichDataDisplay]); // Real value as formated string } else{ - getdisplay().print(OldDataText[WhichDataDisplay]); // Old value as formated string + epd->print(OldDataText[WhichDataDisplay]); // Old value as formated string } if(DataValid[WhichDataDisplay] == true){ OldDataText[WhichDataDisplay] = DataText[WhichDataDisplay]; // Save the old value @@ -148,14 +149,14 @@ class PageCompass : public Page char buffer[bsize+1]; buffer[0]=0; - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(10, Compass_Y0-60); - getdisplay().print(DataName[WhichDataCompass]); // Page name + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(10, Compass_Y0-60); + epd->print(DataName[WhichDataCompass]); // Page name // Draw compass base line and pointer - getdisplay().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->fillRect(0, Compass_Y0, 400, 3, 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 for ( int i = 1; i < abs(TheTrend) / 2; i++){ int x1; @@ -164,7 +165,7 @@ class PageCompass : public Page else 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 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++ ){ int x0; 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; - 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; - 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; - 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 int x0; float AngleToDisplay = NextSector * 180.0 / M_PI; x0 = Compass_X0 + Delta_X; - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); do { - getdisplay().setCursor(x0 - 40, Compass_Y0 + 40); + epd->setCursor(x0 - 40, Compass_Y0 + 40); snprintf(buffer,bsize,"%03.0f", AngleToDisplay); - getdisplay().print(buffer); + epd->print(buffer); AngleToDisplay += 20; if ( AngleToDisplay >= 360.0 ) AngleToDisplay -= 360.0; @@ -208,7 +209,7 @@ class PageCompass : public Page x0 = Compass_X0 + Delta_X + 4 * 5 * Compass_LineDelta; do { - getdisplay().setCursor(x0 - 40, Compass_Y0 + 40); + epd->setCursor(x0 - 40, Compass_Y0 + 40); snprintf(buffer,bsize,"%03.0f", AngleToDisplay); // Quick and dirty way to prevent wrapping text in next line if ( ( x0 - 40 ) > 380 ) @@ -218,7 +219,7 @@ class PageCompass : public Page else if ( ( x0 - 40 ) > 325 ) buffer[2] = 0; - getdisplay().print(buffer); + epd->print(buffer); AngleToDisplay -= 20; if ( AngleToDisplay < 0 ) @@ -230,8 +231,8 @@ class PageCompass : public Page // x_test += 2; // snprintf(buffer,bsize,"%03d", x_test); - // getdisplay().setCursor(x_test, Compass_Y0 - 60); - // getdisplay().print(buffer); + // epd->setCursor(x_test, Compass_Y0 - 60); + // epd->print(buffer); // if ( x_test > 390) // x_test = 320; diff --git a/lib/obp60task/PageDST810.cpp b/lib/obp60task/PageDST810.cpp index 2ac7494..bb832b3 100644 --- a/lib/obp60task/PageDST810.cpp +++ b/lib/obp60task/PageDST810.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -91,37 +92,37 @@ public: //*********************************************************** // 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 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 55); - getdisplay().print("Depth"); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 55); + epd->print("Depth"); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 90); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 90); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Set font - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 90); // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -131,35 +132,35 @@ public: // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); + epd->fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 145); - getdisplay().print("Speed"); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 145); + epd->print("Speed"); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 180); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 180); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); + epd->print(unit2old); } // Setfont - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 180); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 180); // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + epd->print(svalue2old); // Old value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -169,35 +170,35 @@ public: // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); + epd->fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 220); - getdisplay().print("Log"); // Page name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 220); + epd->print("Log"); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 240); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); + epd->print(unit3old); } // Set font - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(80, 270); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(80, 270); // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + epd->print(svalue3); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + epd->print(svalue3old); // Old value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value @@ -207,35 +208,35 @@ public: // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); + epd->fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(220, 220); - getdisplay().print("Temp"); // Page name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(220, 220); + epd->print("Temp"); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(220, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(220, 240); if(holdvalues == false){ - getdisplay().print(unit4); // Unit + epd->print(unit4); // Unit } else{ - getdisplay().print(unit4old); + epd->print(unit4old); } // Set font - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(280, 270); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(280, 270); // Show bus data if(holdvalues == false){ - getdisplay().print(svalue4); // Real value as formated string + epd->print(svalue4); // Real value as formated string } else{ - getdisplay().print(svalue4old); // Old value as formated string + epd->print(svalue4old); // Old value as formated string } if(valid4 == true){ svalue4old = svalue4; // Save the old value diff --git a/lib/obp60task/PageFluid.cpp b/lib/obp60task/PageFluid.cpp index f844d87..ca5944f 100644 --- a/lib/obp60task/PageFluid.cpp +++ b/lib/obp60task/PageFluid.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -138,17 +139,17 @@ class PageFluid : public Page //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 60); - getdisplay().print("Fluid"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 60); + epd->print("Fluid"); - getdisplay().setCursor(300, 60); - getdisplay().print(xdrDelete(name1).substring(0, 6)); + epd->setCursor(300, 60); + epd->print(xdrDelete(name1).substring(0, 6)); // analog instrument // scale from -120 to 120 @@ -158,11 +159,11 @@ class PageFluid : public Page uint8_t r = 110; // circular frame - getdisplay().drawCircle(c.x, c.y, r+5, commonData->fgcolor); - getdisplay().fillCircle(c.x, c.y, r+2, commonData->fgcolor); - getdisplay().fillCircle(c.x, c.y, r-1, commonData->bgcolor); + epd->drawCircle(c.x, c.y, r+5, commonData->fgcolor); + epd->fillCircle(c.x, c.y, r+2, commonData->fgcolor); + epd->fillCircle(c.x, c.y, r-1, commonData->bgcolor); // 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 char buffer[6]; @@ -176,32 +177,32 @@ class PageFluid : public Page // draw symbol (as bitmap) switch (fluidtype) { case 0: - getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor); + epd->drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor); break; case 1: - getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); + epd->drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); break; 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; 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; 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; 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; 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; } Point p, pr; // scale texts - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); p = {c.x, c.y - r + 30}; drawTextCenter(p.x, p.y, "1/2"); pr = rotatePoint(c, p, -60); @@ -210,7 +211,7 @@ class PageFluid : public Page drawTextCenter(pr.x, pr.y, "3/4"); // empty and full - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); p = rotatePoint(c, {c.x, c.y - r + 30}, -130); drawTextCenter(p.x, p.y, "E"); p = rotatePoint(c, {c.x, c.y - r + 30}, 130); @@ -236,7 +237,7 @@ class PageFluid : public Page continue; } 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 @@ -249,7 +250,7 @@ class PageFluid : public Page }; fillPoly4(rotatePoints(c, pts, -120 + fluidlevel * 2.4), commonData->fgcolor); // 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; diff --git a/lib/obp60task/PageFourValues.cpp b/lib/obp60task/PageFourValues.cpp index b7526c0..01c1475 100644 --- a/lib/obp60task/PageFourValues.cpp +++ b/lib/obp60task/PageFourValues.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -96,47 +97,47 @@ class PageFourValues : public Page //*********************************************************** // 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 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(20, 45); - getdisplay().print(name1); // Page name + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(20, 45); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 65); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 65); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Switch font if format for any values if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(120, 55); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(120, 55); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(150, 58); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(150, 58); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(180, 65); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(180, 65); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -146,45 +147,45 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 80, 400, 3, commonData->fgcolor); + epd->fillRect(0, 80, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(20, 113); - getdisplay().print(name2); // Page name + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(20, 113); + epd->print(name2); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 133); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 133); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); + epd->print(unit2old); } // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(120, 123); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(120, 123); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(150, 123); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(150, 123); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(180, 133); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(180, 133); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + epd->print(svalue2old); // Old value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -194,45 +195,45 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 146, 400, 3, commonData->fgcolor); + epd->fillRect(0, 146, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(20, 181); - getdisplay().print(name3); // Page name + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(20, 181); + epd->print(name3); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 201); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 201); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); + epd->print(unit3old); } // Switch font if format for any values if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(120, 191); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(120, 191); } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(150, 191); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(150, 191); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(180, 201); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(180, 201); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + epd->print(svalue3); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + epd->print(svalue3old); // Old value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value @@ -242,45 +243,45 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 214, 400, 3, commonData->fgcolor); + epd->fillRect(0, 214, 400, 3, commonData->fgcolor); // ############### Value 4 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(20, 249); - getdisplay().print(name4); // Page name + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(20, 249); + epd->print(name4); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 269); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 269); if(holdvalues == false){ - getdisplay().print(unit4); // Unit + epd->print(unit4); // Unit } else{ - getdisplay().print(unit4old); + epd->print(unit4old); } // Switch font if format for any values if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(120, 259); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(120, 259); } else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(150, 259); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(150, 259); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(180, 269); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(180, 269); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue4); // Real value as formated string + epd->print(svalue4); // Real value as formated string } else{ - getdisplay().print(svalue4old); // Old value as formated string + epd->print(svalue4old); // Old value as formated string } if(valid4 == true){ svalue4old = svalue4; // Save the old value diff --git a/lib/obp60task/PageFourValues2.cpp b/lib/obp60task/PageFourValues2.cpp index e608409..8d361e7 100644 --- a/lib/obp60task/PageFourValues2.cpp +++ b/lib/obp60task/PageFourValues2.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -96,47 +97,47 @@ class PageFourValues2 : public Page //*********************************************************** // 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 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 55); - getdisplay().print(name1); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 55); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 90); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 90); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Switch font if format for any values if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(100, 90); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(100, 90); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(180, 77); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(180, 77); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 90); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -146,45 +147,45 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); + epd->fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 145); - getdisplay().print(name2); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 145); + epd->print(name2); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 180); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 180); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); + epd->print(unit2old); } // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(100, 180); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(100, 180); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(180, 158); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(180, 158); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 180); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 180); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + epd->print(svalue2old); // Old value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -194,45 +195,45 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); + epd->fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 220); - getdisplay().print(name3); // Page name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 220); + epd->print(name3); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 240); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); + epd->print(unit3old); } // Switch font if format for any values if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(50, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(50, 240); } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(100, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(100, 240); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(80, 270); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(80, 270); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + epd->print(svalue3); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + epd->print(svalue3old); // Old value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value @@ -242,45 +243,45 @@ class PageFourValues2 : public Page // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); + epd->fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(220, 220); - getdisplay().print(name4); // Page name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(220, 220); + epd->print(name4); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(220, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(220, 240); if(holdvalues == false){ - getdisplay().print(unit4); // Unit + epd->print(unit4); // Unit } else{ - getdisplay().print(unit4old); + epd->print(unit4old); } // Switch font if format for any values if(bvalue4->getFormat() == "formatLatitude" || bvalue4->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(250, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(250, 240); } else if(bvalue4->getFormat() == "formatTime" || bvalue4->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(300, 240); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(300, 240); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(280, 270); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(280, 270); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue4); // Real value as formated string + epd->print(svalue4); // Real value as formated string } else{ - getdisplay().print(svalue4old); // Old value as formated string + epd->print(svalue4old); // Old value as formated string } if(valid4 == true){ svalue4old = svalue4; // Save the old value diff --git a/lib/obp60task/PageGenerator.cpp b/lib/obp60task/PageGenerator.cpp index 201b647..ead7a8f 100644 --- a/lib/obp60task/PageGenerator.cpp +++ b/lib/obp60task/PageGenerator.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -83,77 +84,77 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(10, 65); - getdisplay().print("Power"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(12, 82); - getdisplay().print("Generator"); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(10, 65); + epd->print("Power"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(12, 82); + epd->print("Generator"); // Show voltage type - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 140); int bvoltage = 0; if(String(batVoltage) == "12V") bvoltage = 12; else bvoltage = 24; - getdisplay().print(bvoltage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->print(bvoltage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show solar power - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 200); - if(genPower <= 999) getdisplay().print(genPower, 0); - if(genPower > 999) getdisplay().print(float(genPower/1000.0), 1); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - if(genPower <= 999) getdisplay().print("W"); - if(genPower > 999) getdisplay().print("kW"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 200); + if(genPower <= 999) epd->print(genPower, 0); + if(genPower > 999) epd->print(float(genPower/1000.0), 1); + epd->setFont(&Ubuntu_Bold16pt8b); + if(genPower <= 999) epd->print("W"); + if(genPower > 999) epd->print("kW"); // Show info - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 235); - getdisplay().print("Installed"); - getdisplay().setCursor(10, 255); - getdisplay().print("Power Modul"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 235); + epd->print("Installed"); + epd->setCursor(10, 255); + epd->print("Power Modul"); // Show generator generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor); // Show load level in percent - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 200); - getdisplay().print(genPercentage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("%"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(150, 235); - getdisplay().print("Load"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 200); + epd->print(genPercentage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("%"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(150, 235); + epd->print("Load"); // Show sensor type info String i2cAddr = ""; - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(270, 60); - if(powerSensor == "off") getdisplay().print("Internal"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(270, 60); + if(powerSensor == "off") epd->print("Internal"); if(powerSensor == "INA219"){ - getdisplay().print("INA219"); + epd->print("INA219"); i2cAddr = " (0x" + String(INA219_I2C_ADDR3, HEX) + ")"; } if(powerSensor == "INA226"){ - getdisplay().print("INA226"); + epd->print("INA226"); i2cAddr = " (0x" + String(INA226_I2C_ADDR3, HEX) + ")"; } - getdisplay().print(i2cAddr); - getdisplay().setCursor(270, 80); - getdisplay().print("Sensor Modul"); + epd->print(i2cAddr); + epd->setCursor(270, 80); + epd->print("Sensor Modul"); // Reading bus data or using simulation data - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 140); if(simulation == true){ if(batVoltage == "12V"){ value1 = 12.0; @@ -162,46 +163,46 @@ public: value1 = 24.0; } value1 += float(random(0, 5)) / 10; // Simulation data - getdisplay().print(value1,1); + epd->print(value1,1); } else{ // Check for valid real data, display also if hold values activated if(valid1 == true || holdvalues == true){ // Resolution switching - if(value1 <= 9.9) getdisplay().print(value1, 2); - if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); - if(value1 > 99.9) getdisplay().print(value1, 0); + if(value1 <= 9.9) epd->print(value1, 2); + if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1); + if(value1 > 99.9) epd->print(value1, 0); } else{ - getdisplay().print("---"); // Missing bus data + epd->print("---"); // Missing bus data } } - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show actual current in A - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 200); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 200); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value2 <= 9.9) getdisplay().print(value2, 2); - if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); - if(value2 > 99.9) getdisplay().print(value2, 0); + if(value2 <= 9.9) epd->print(value2, 2); + if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1); + if(value2 > 99.9) epd->print(value2, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("A"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("A"); // Show actual consumption in W - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 260); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 260); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value3 <= 9.9) getdisplay().print(value3, 2); - if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); - if(value3 > 99.9) getdisplay().print(value3, 0); + if(value3 <= 9.9) epd->print(value3, 2); + if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1); + if(value3 > 99.9) epd->print(value3, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("W"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("W"); return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageKeelPosition.cpp b/lib/obp60task/PageKeelPosition.cpp index dd86611..6381ab7 100644 --- a/lib/obp60task/PageKeelPosition.cpp +++ b/lib/obp60task/PageKeelPosition.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -68,7 +69,7 @@ public: //*********************************************************** // 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 float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -105,17 +106,17 @@ public: // Print text centered on position x, y int16_t x1, y1; // Return values of getTextBounds uint16_t w, h; // Return values of getTextBounds - getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 30 == 0){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->print(ii); } // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - 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 cosx=cos(i/180.0*pi); @@ -126,10 +127,10 @@ public: float xx2 = +dx; float yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } @@ -163,7 +164,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -173,36 +174,36 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument * 0.6); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); + epd->fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 140, startwidth + 22, commonData->bgcolor); - getdisplay().fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle - getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle - getdisplay().fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line + epd->fillCircle(200, 140, startwidth + 22, commonData->bgcolor); + epd->fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle + epd->fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle + epd->fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line // Print label - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(100, 70); - getdisplay().print("Keel Position"); // Label + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(100, 70); + epd->print("Keel Position"); // Label if((rotsensor == "AS5600" && rotfunction == "Keel" && (valid1 == true || holdvalues == true)) || simulation == true){ // Print Unit of keel position - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(175, 110); - getdisplay().print(unit1); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(175, 110); + epd->print(unit1); // Unit } else{ // Print Unit of keel position - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(145, 110); - getdisplay().print("No sensor data"); // Info missing sensor + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(145, 110); + epd->print("No sensor data"); // Info missing sensor } return PAGE_UPDATE; diff --git a/lib/obp60task/PageOneValue.cpp b/lib/obp60task/PageOneValue.cpp index 6f33597..b7823db 100644 --- a/lib/obp60task/PageOneValue.cpp +++ b/lib/obp60task/PageOneValue.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -60,44 +61,44 @@ class PageOneValue : public Page //*********************************************************** /// 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 - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold32pt8b); - getdisplay().setCursor(20, 100); - getdisplay().print(name1); // Page name + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold32pt8b); + epd->setCursor(20, 100); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(270, 100); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(270, 100); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Switch font if format for any values if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 180); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 180); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold32pt8b); - getdisplay().setCursor(20, 200); + epd->setFont(&Ubuntu_Bold32pt8b); + epd->setCursor(20, 200); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b); - getdisplay().setCursor(20, 240); + epd->setFont(&DSEG7Classic_BoldItalic60pt7b); + epd->setCursor(20, 240); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 3cc9277..19b5c5b 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -116,52 +117,52 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 65); - getdisplay().print(rolllimit); // Value - //getdisplay().print(svalue1); // Value + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 65); + epd->print(rolllimit); // Value + //epd->print(svalue1); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 95); - getdisplay().print("Limit"); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 115); - getdisplay().print("DEG"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 95); + epd->print("Limit"); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 115); + epd->print("DEG"); // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); + epd->fillRect(0, 149, 60, 3, commonData->fgcolor); // Show roll value - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 270); - if(holdvalues == false) getdisplay().print(svalue1); // Value - else getdisplay().print(svalue1old); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 220); - getdisplay().print(name1); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 190); - getdisplay().print("Deg"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 270); + if(holdvalues == false) epd->print(svalue1); // Value + else epd->print(svalue1old); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 220); + epd->print(name1); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 190); + epd->print("Deg"); // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); + epd->fillRect(340, 149, 80, 3, commonData->fgcolor); // Show pitch value - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(295, 270); - if(holdvalues == false) getdisplay().print(svalue2); // Value - else getdisplay().print(svalue2old); - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 220); - getdisplay().print(name2); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 190); - getdisplay().print("Deg"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(295, 270); + if(holdvalues == false) epd->print(svalue2); // Value + else epd->print(svalue2old); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 220); + epd->print(name2); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 190); + epd->print("Deg"); //******************************************************************************************* @@ -169,8 +170,8 @@ public: int rInstrument = 100; // Radius of instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle for(int i=0; i<360; i=i+10) { @@ -194,17 +195,17 @@ public: // Print text centered on position x, y int16_t x1, y1; // Return values of getTextBounds uint16_t w, h; // Return values of getTextBounds - getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 20 == 0){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->print(ii); } // Draw sub scale with dots float x1c = 200 + rInstrument*sin(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 cosx=cos(i/180.0*M_PI); @@ -215,10 +216,10 @@ public: float xx2 = +dx; float yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } @@ -239,7 +240,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -249,28 +250,28 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument * 0.7); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); + epd->fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 22, commonData->bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle + epd->fillCircle(200, 150, startwidth + 22, commonData->bgcolor); + epd->fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle int x0 = 200; int y0 = 150; int x1 = x0 + 50*cos(value1); int y1 = y0 + 50*sin(value1); int x2 = x0 + 50*cos(value1 - pi/2); int y2 = y0 + 50*sin(value1 - pi/2); - getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, 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); 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) - getdisplay().fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line + epd->fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle) + epd->fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line // Draw roll pointer startwidth = 4; // Start width of pointer @@ -283,7 +284,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -293,15 +294,15 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument - 15); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } else{ // Print sensor info - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(145, 200); - getdisplay().print("No sensor data"); // Info missing sensor + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(145, 200); + epd->print("No sensor data"); // Info missing sensor } return PAGE_UPDATE; diff --git a/lib/obp60task/PageRudderPosition.cpp b/lib/obp60task/PageRudderPosition.cpp index 22b5f91..3952a04 100644 --- a/lib/obp60task/PageRudderPosition.cpp +++ b/lib/obp60task/PageRudderPosition.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -74,7 +75,7 @@ public: //*********************************************************** // 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 float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -112,17 +113,17 @@ public: // Print text centered on position x, y int16_t x1, y1; // Return values of getTextBounds uint16_t w, h; // Return values of getTextBounds - getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 30 == 0){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->print(ii); } // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - 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 cosx=cos(i/180.0*pi); @@ -133,10 +134,10 @@ public: float xx2 = +dx; float yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } @@ -144,28 +145,28 @@ public: } // Print label - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(80, 70); - getdisplay().print("Rudder Position"); // Label + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(80, 70); + epd->print("Rudder Position"); // Label // Print Unit in RudderPosition if(valid1 == true || simulation == true){ if(holdvalues == false){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(175, 110); - getdisplay().print(unit1); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(175, 110); + epd->print(unit1); // Unit } else{ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(175, 110); - getdisplay().print(unit1old); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(175, 110); + epd->print(unit1old); // Unit } } else{ // Print Unit of keel position - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(145, 110); - getdisplay().print("No sensor data"); // Info missing sensor + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(145, 110); + epd->print("No sensor data"); // Info missing sensor } // Calculate rudder position @@ -188,7 +189,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -198,14 +199,14 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument * 0.5); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); + epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor); return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageSixValues.cpp b/lib/obp60task/PageSixValues.cpp index af735f2..61ef364 100644 --- a/lib/obp60task/PageSixValues.cpp +++ b/lib/obp60task/PageSixValues.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -77,13 +78,13 @@ class PageSixValues : public Page //*********************************************************** // Set display in partial refresh mode - getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData->fgcolor); + epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update + epd->setTextColor(commonData->fgcolor); 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 // 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++){ 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] ); // Show name - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(x0, y0+25); - getdisplay().print(DataName[ValueIndex]); // Page name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(x0, y0+25); + epd->print(DataName[ValueIndex]); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(x0, y0+72); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(x0, y0+72); if(holdvalues == false){ - getdisplay().print(DataUnits[ValueIndex]); // Unit + epd->print(DataUnits[ValueIndex]); // Unit } else{ - getdisplay().print(OldDataUnits[ValueIndex]); + epd->print(OldDataUnits[ValueIndex]); } // Switch font if format for any values if(DataFormat[ValueIndex] == "formatLatitude" || DataFormat[ValueIndex] == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(x0+10, y0+60); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(x0+10, y0+60); } else if(DataFormat[ValueIndex] == "formatTime" || DataFormat[ValueIndex] == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(x0+20,y0+55); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(x0+20,y0+55); } // pressure in hPa else if(DataFormat[ValueIndex] == "formatXdr:P:P"){ - getdisplay().setFont(&DSEG7Classic_BoldItalic26pt7b); - getdisplay().setCursor(x0+5, y0+70); + epd->setFont(&DSEG7Classic_BoldItalic26pt7b); + epd->setCursor(x0+5, y0+70); } // RPM else if(DataFormat[ValueIndex] == "formatXdr:T:R"){ - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); - getdisplay().setCursor(x0+25, y0+70); + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setCursor(x0+25, y0+70); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic26pt7b); + epd->setFont(&DSEG7Classic_BoldItalic26pt7b); if ( DataText[ValueIndex][0] == '-' ) - getdisplay().setCursor(x0+25, y0+70); + epd->setCursor(x0+25, y0+70); else - getdisplay().setCursor(x0+65, y0+70); + epd->setCursor(x0+65, y0+70); } // Show bus data if(holdvalues == false){ - getdisplay().print(DataText[ValueIndex]); // Real value as formated string + epd->print(DataText[ValueIndex]); // Real value as formated string } else{ - getdisplay().print(OldDataText[ValueIndex]); // Old value as formated string + epd->print(OldDataText[ValueIndex]); // Old value as formated string } if(DataValid[ValueIndex] == true){ OldDataText[ValueIndex] = DataText[ValueIndex]; // Save the old value @@ -146,7 +147,7 @@ class PageSixValues : public Page } } // 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; diff --git a/lib/obp60task/PageSkyView.cpp b/lib/obp60task/PageSkyView.cpp index 90c53c8..092b303 100644 --- a/lib/obp60task/PageSkyView.cpp +++ b/lib/obp60task/PageSkyView.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -46,85 +47,85 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); GwApi::BoatValue *bv_lat = pageData.values[0]; String sv_lat = formatValue(bv_lat, *commonData).svalue; - //getdisplay().setCursor(300, 40); - //getdisplay().print(sv_lat); + //epd->setCursor(300, 40); + //epd->print(sv_lat); GwApi::BoatValue *bv_lon = pageData.values[1]; String sv_lon = formatValue(bv_lon, *commonData).svalue; - //getdisplay().setCursor(300, 60); - //getdisplay().print(sv_lon); + //epd->setCursor(300, 60); + //epd->print(sv_lon); GwApi::BoatValue *bv_hdop = pageData.values[2]; String sv_hdop = formatValue(bv_hdop, *commonData).svalue; - //getdisplay().setCursor(300, 80); - //getdisplay().print(sv_hdop); + //epd->setCursor(300, 80); + //epd->print(sv_hdop); // sky view Point c = {130, 148}; uint16_t r = 125; uint16_t r1 = r / 2; - getdisplay().fillCircle(c.x, c.y, r, commonData->bgcolor); - getdisplay().drawCircle(c.x, c.y, r + 1, commonData->fgcolor); - getdisplay().drawCircle(c.x, c.y, r + 2, commonData->fgcolor); - getdisplay().drawCircle(c.x, c.y, r1, commonData->fgcolor); + epd->fillCircle(c.x, c.y, r, commonData->bgcolor); + epd->drawCircle(c.x, c.y, r + 1, commonData->fgcolor); + epd->drawCircle(c.x, c.y, r + 2, commonData->fgcolor); + epd->drawCircle(c.x, c.y, r1, commonData->fgcolor); // separation lines - getdisplay().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 - r, c.y, c.x + r, c.y, commonData->fgcolor); + epd->drawLine(c.x, c.y - r, c.x, c.y + r, commonData->fgcolor); Point p = {c.x, c.y - r}; Point p1, p2; p1 = rotatePoint(c, p, 45); 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); 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 int16_t x1, y1; uint16_t w, h; - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); - getdisplay().getTextBounds("N", 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(c.x - w / 2, c.y - r + h + 2); - getdisplay().print("N"); + epd->getTextBounds("N", 0, 150, &x1, &y1, &w, &h); + epd->setCursor(c.x - w / 2, c.y - r + h + 2); + epd->print("N"); - getdisplay().getTextBounds("S", 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(c.x - w / 2, c.y + r - 2); - getdisplay().print("S"); + epd->getTextBounds("S", 0, 150, &x1, &y1, &w, &h); + epd->setCursor(c.x - w / 2, c.y + r - 2); + epd->print("S"); - getdisplay().getTextBounds("E", 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(c.x + r - w - 2, c.y + h / 2); - getdisplay().print("E"); + epd->getTextBounds("E", 0, 150, &x1, &y1, &w, &h); + epd->setCursor(c.x + r - w - 2, c.y + h / 2); + epd->print("E"); - getdisplay().getTextBounds("W", 0, 150, &x1, &y1, &w, &h); - getdisplay().setCursor(c.x - r + 2 , c.y + h / 2); - getdisplay().print("W"); + epd->getTextBounds("W", 0, 150, &x1, &y1, &w, &h); + epd->setCursor(c.x - r + 2 , c.y + h / 2); + epd->print("W"); // satellites // Signal / Noise bars - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(325, 34); - getdisplay().print("SNR"); - getdisplay().drawRect(270, 20, 125, 257, commonData->fgcolor); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(325, 34); + epd->print("SNR"); + epd->drawRect(270, 20, 125, 257, commonData->fgcolor); for (int i = 0; i < 12; i++) { uint16_t y = 29 + (i + 1) * 20; - getdisplay().setCursor(276, y); + epd->setCursor(276, y); char buffer[3]; snprintf(buffer, 3, "%02d", i+1); - getdisplay().print(String(buffer)); - getdisplay().drawRect(305, y-12, 85, 14, commonData->fgcolor); + epd->print(String(buffer)); + epd->drawRect(305, y-12, 85, 14, commonData->fgcolor); } return PAGE_UPDATE; diff --git a/lib/obp60task/PageSolar.cpp b/lib/obp60task/PageSolar.cpp index 2a19bb9..d440069 100644 --- a/lib/obp60task/PageSolar.cpp +++ b/lib/obp60task/PageSolar.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -82,74 +83,74 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(10, 65); - getdisplay().print("Solar"); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(10, 65); + epd->print("Solar"); // Show voltage type - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 140); int bvoltage = 0; if(String(batVoltage) == "12V") bvoltage = 12; else bvoltage = 24; - getdisplay().print(bvoltage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->print(bvoltage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show solar power - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 200); - if(solPower <= 999) getdisplay().print(solPower, 0); - if(solPower > 999) getdisplay().print(float(solPower/1000.0), 1); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - if(solPower <= 999) getdisplay().print("W"); - if(solPower > 999) getdisplay().print("kW"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 200); + if(solPower <= 999) epd->print(solPower, 0); + if(solPower > 999) epd->print(float(solPower/1000.0), 1); + epd->setFont(&Ubuntu_Bold16pt8b); + if(solPower <= 999) epd->print("W"); + if(solPower > 999) epd->print("kW"); // Show info - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 235); - getdisplay().print("Installed"); - getdisplay().setCursor(10, 255); - getdisplay().print("Solar Modul"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 235); + epd->print("Installed"); + epd->setCursor(10, 255); + epd->print("Solar Modul"); // Show solar panel solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor); // Show load level in percent - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 200); - getdisplay().print(solPercentage); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("%"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(150, 235); - getdisplay().print("Load"); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 200); + epd->print(solPercentage); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("%"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(150, 235); + epd->print("Load"); // Show sensor type info String i2cAddr = ""; - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(270, 60); - if(powerSensor == "off") getdisplay().print("Internal"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(270, 60); + if(powerSensor == "off") epd->print("Internal"); if(powerSensor == "INA219"){ - getdisplay().print("INA219"); + epd->print("INA219"); i2cAddr = " (0x" + String(INA219_I2C_ADDR2, HEX) + ")"; } if(powerSensor == "INA226"){ - getdisplay().print("INA226"); + epd->print("INA226"); i2cAddr = " (0x" + String(INA226_I2C_ADDR2, HEX) + ")"; } - getdisplay().print(i2cAddr); - getdisplay().setCursor(270, 80); - getdisplay().print("Sensor Modul"); + epd->print(i2cAddr); + epd->setCursor(270, 80); + epd->print("Sensor Modul"); // Reading bus data or using simulation data - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 140); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 140); if(simulation == true){ if(batVoltage == "12V"){ value1 = 12.0; @@ -158,46 +159,46 @@ public: value1 = 24.0; } value1 += float(random(0, 5)) / 10; // Simulation data - getdisplay().print(value1,1); + epd->print(value1,1); } else{ // Check for valid real data, display also if hold values activated if(valid1 == true || holdvalues == true){ // Resolution switching - if(value1 <= 9.9) getdisplay().print(value1, 2); - if(value1 > 9.9 && value1 <= 99.9)getdisplay().print(value1, 1); - if(value1 > 99.9) getdisplay().print(value1, 0); + if(value1 <= 9.9) epd->print(value1, 2); + if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1); + if(value1 > 99.9) epd->print(value1, 0); } else{ - getdisplay().print("---"); // Missing bus data + epd->print("---"); // Missing bus data } } - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("V"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("V"); // Show actual current in A - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 200); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 200); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value2 <= 9.9) getdisplay().print(value2, 2); - if(value2 > 9.9 && value2 <= 99.9)getdisplay().print(value2, 1); - if(value2 > 99.9) getdisplay().print(value2, 0); + if(value2 <= 9.9) epd->print(value2, 2); + if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1); + if(value2 > 99.9) epd->print(value2, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("A"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("A"); // Show actual consumption in W - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(260, 260); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(260, 260); if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){ - if(value3 <= 9.9) getdisplay().print(value3, 2); - if(value3 > 9.9 && value3 <= 99.9)getdisplay().print(value3, 1); - if(value3 > 99.9) getdisplay().print(value3, 0); + if(value3 <= 9.9) epd->print(value3, 2); + if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1); + if(value3 > 99.9) epd->print(value3, 0); } - else getdisplay().print("---"); - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().print("W"); + else epd->print("---"); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->print("W"); return PAGE_UPDATE; }; diff --git a/lib/obp60task/PageSystem.cpp b/lib/obp60task/PageSystem.cpp index 2de30cc..776a6db 100644 --- a/lib/obp60task/PageSystem.cpp +++ b/lib/obp60task/PageSystem.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -116,101 +117,101 @@ private: uint16_t y0 = 155; - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("System information"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + 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]; snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid); displayBarcode(String(ssid), 320, 200, 2); - getdisplay().setCursor(8, 70); - getdisplay().print(String("MCUDEVICE-") + String(ssid)); + epd->setCursor(8, 70); + epd->print(String("MCUDEVICE-") + String(ssid)); - getdisplay().setCursor(8, 95); - getdisplay().print("Firmware version: "); - getdisplay().setCursor(150, 95); - getdisplay().print(VERSINFO); + epd->setCursor(8, 95); + epd->print("Firmware version: "); + epd->setCursor(150, 95); + epd->print(VERSINFO); - getdisplay().setCursor(8, 113); - getdisplay().print("Board version: "); - getdisplay().setCursor(150, 113); - getdisplay().print(BOARDINFO); - getdisplay().print(String(" HW ") + String(PCBINFO)); + epd->setCursor(8, 113); + epd->print("Board version: "); + epd->setCursor(150, 113); + epd->print(BOARDINFO); + epd->print(String(" HW ") + String(PCBINFO)); - getdisplay().setCursor(8, 131); - getdisplay().print("Display version: "); - getdisplay().setCursor(150, 131); - getdisplay().print(DISPLAYINFO); - getdisplay().print("; GxEPD2 v"); - getdisplay().print(GXEPD2INFO); + epd->setCursor(8, 131); + epd->print("Display version: "); + epd->setCursor(150, 131); + epd->print(DISPLAYINFO); + epd->print("; GxEPD2 v"); + epd->print(GXEPD2INFO); - getdisplay().setCursor(8, 265); + epd->setCursor(8, 265); #ifdef BOARD_OBP60S3 - getdisplay().print("Press STBY to enter deep sleep mode"); + epd->print("Press STBY to enter deep sleep mode"); #endif #ifdef BOARD_OBP40S3 - getdisplay().print("Press wheel to enter deep sleep mode"); + epd->print("Press wheel to enter deep sleep mode"); #endif // Flash memory size uint32_t flash_size = ESP.getFlashChipSize(); - getdisplay().setCursor(8, y0); - getdisplay().print("FLASH:"); - getdisplay().setCursor(90, y0); - getdisplay().print(String(flash_size / 1024) + String(" kB")); + epd->setCursor(8, y0); + epd->print("FLASH:"); + epd->setCursor(90, y0); + epd->print(String(flash_size / 1024) + String(" kB")); // PSRAM memory size uint32_t psram_size = ESP.getPsramSize(); - getdisplay().setCursor(8, y0 + 16); - getdisplay().print("PSRAM:"); - getdisplay().setCursor(90, y0 + 16); - getdisplay().print(String(psram_size / 1024) + String(" kB")); + epd->setCursor(8, y0 + 16); + epd->print("PSRAM:"); + epd->setCursor(90, y0 + 16); + epd->print(String(psram_size / 1024) + String(" kB")); // FRAM available / status - getdisplay().setCursor(8, y0 + 32); - getdisplay().print("FRAM:"); - getdisplay().setCursor(90, y0 + 32); - getdisplay().print(hasFRAM ? "available" : "not found"); + epd->setCursor(8, y0 + 32); + epd->print("FRAM:"); + epd->setCursor(90, y0 + 32); + epd->print(hasFRAM ? "available" : "not found"); #ifdef BOARD_OBP40S3 // SD-Card - getdisplay().setCursor(8, y0 + 48); - getdisplay().print("SD-Card:"); - getdisplay().setCursor(90, y0 + 48); + epd->setCursor(8, y0 + 48); + epd->print("SD-Card:"); + epd->setCursor(90, y0 + 48); if (sdcard) { uint64_t cardsize = SD.cardSize() / (1024 * 1024); - getdisplay().print(String(cardsize) + String(" MB")); + epd->print(String(cardsize) + String(" MB")); } else { - getdisplay().print("off"); + epd->print("off"); } #endif // CPU speed config / active - getdisplay().setCursor(202, y0); - getdisplay().print("CPU speed:"); - getdisplay().setCursor(300, y0); - getdisplay().print(cpuspeed); - getdisplay().print(" / "); + epd->setCursor(202, y0); + epd->print("CPU speed:"); + epd->setCursor(300, y0); + epd->print(cpuspeed); + epd->print(" / "); int cpu_freq = esp_clk_cpu_freq() / 1000000; - getdisplay().print(String(cpu_freq)); + epd->print(String(cpu_freq)); // total RAM free int Heap_free = esp_get_free_heap_size(); - getdisplay().setCursor(202, y0 + 16); - getdisplay().print("Total free:"); - getdisplay().setCursor(300, y0 + 16); - getdisplay().print(String(Heap_free)); + epd->setCursor(202, y0 + 16); + epd->print("Total free:"); + epd->setCursor(300, y0 + 16); + epd->print(String(Heap_free)); // RAM free for task int RAM_free = uxTaskGetStackHighWaterMark(NULL); - getdisplay().setCursor(202, y0 + 32); - getdisplay().print("Task free:"); - getdisplay().setCursor(300, y0 + 32); - getdisplay().print(String(RAM_free)); + epd->setCursor(202, y0 + 32); + epd->print("Task free:"); + epd->setCursor(300, y0 + 32); + epd->print(String(RAM_free)); } void displayModeConfig() { @@ -220,24 +221,24 @@ private: uint16_t y0 = 80; uint16_t dy = 20; - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("System configuration"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + epd->print("System configuration"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); - /*getdisplay().setCursor(x0, y0); - getdisplay().print("CPU speed: 80 | 160 | 240"); - getdisplay().setCursor(x0, y0 + 1 * dy); - getdisplay().print("Power mode: Max | 5V | Min"); - getdisplay().setCursor(x0, y0 + 2 * dy); - getdisplay().print("Accesspoint: On | Off"); + /*epd->setCursor(x0, y0); + epd->print("CPU speed: 80 | 160 | 240"); + epd->setCursor(x0, y0 + 1 * dy); + epd->print("Power mode: Max | 5V | Min"); + epd->setCursor(x0, y0 + 2 * dy); + epd->print("Accesspoint: On | Off"); // TODO Change NVRAM-preferences settings here - getdisplay().setCursor(x0, y0 + 4 * dy); - getdisplay().print("Simulation: On | Off"); */ + epd->setCursor(x0, y0 + 4 * dy); + epd->print("Simulation: On | Off"); */ - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); for (int i = 0 ; i < menu->getItemCount(); i++) { ConfigMenuItem *itm = menu->getItemByIndex(i); if (!itm) { @@ -248,14 +249,14 @@ private: drawTextBoxed(r, itm->getLabel(), commonData->fgcolor, commonData->bgcolor, inverted, false); if (inverted and editmode > 0) { // 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") { - getdisplay().print(itm->getValue()); - getdisplay().print(itm->getUnit()); + epd->print(itm->getValue()); + epd->print(itm->getUnit()); } 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 y0 = 72; - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(x0, 48); - getdisplay().print("System settings"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(x0, 48); + epd->print("System settings"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); // left column - getdisplay().setCursor(x0, y0); - getdisplay().print("Simulation:"); - getdisplay().setCursor(120, y0); - getdisplay().print(simulation ? "on" : "off"); + epd->setCursor(x0, y0); + epd->print("Simulation:"); + epd->setCursor(120, y0); + epd->print(simulation ? "on" : "off"); - getdisplay().setCursor(x0, y0 + 16); - getdisplay().print("Environment:"); - getdisplay().setCursor(120, y0 + 16); - getdisplay().print(env_module); + epd->setCursor(x0, y0 + 16); + epd->print("Environment:"); + epd->setCursor(120, y0 + 16); + epd->print(env_module); - getdisplay().setCursor(x0, y0 + 32); - getdisplay().print("Buzzer:"); - getdisplay().setCursor(120, y0 + 32); - getdisplay().print(buzzer_mode); + epd->setCursor(x0, y0 + 32); + epd->print("Buzzer:"); + epd->setCursor(120, y0 + 32); + epd->print(buzzer_mode); - getdisplay().setCursor(x0, y0 + 64); - getdisplay().print("GPS:"); - getdisplay().setCursor(120, y0 + 64); - getdisplay().print(gps_module); + epd->setCursor(x0, y0 + 64); + epd->print("GPS:"); + epd->setCursor(120, y0 + 64); + epd->print(gps_module); - getdisplay().setCursor(x0, y0 + 80); - getdisplay().print("RTC:"); - getdisplay().setCursor(120, y0 + 80); - getdisplay().print(rtc_module); + epd->setCursor(x0, y0 + 80); + epd->print("RTC:"); + epd->setCursor(120, y0 + 80); + epd->print(rtc_module); - getdisplay().setCursor(x0, y0 + 96); - getdisplay().print("Wifi:"); - getdisplay().setCursor(120, y0 + 96); - getdisplay().print(commonData->status.wifiApOn ? "on" : "off"); + epd->setCursor(x0, y0 + 96); + epd->print("Wifi:"); + epd->setCursor(120, y0 + 96); + epd->print(commonData->status.wifiApOn ? "on" : "off"); // Home location - getdisplay().setCursor(x0, y0 + 128); - getdisplay().print("Home Lat.:"); + epd->setCursor(x0, y0 + 128); + epd->print("Home Lat.:"); drawTextRalign(230, y0 + 128, formatLatitude(homelat)); - getdisplay().setCursor(x0, y0 + 144); - getdisplay().print("Home Lon.:"); + epd->setCursor(x0, y0 + 144); + epd->print("Home Lon.:"); drawTextRalign(230, y0 + 144, formatLongitude(homelon)); // right column - getdisplay().setCursor(202, y0); - getdisplay().print("Batt. sensor:"); - getdisplay().setCursor(320, y0); - getdisplay().print(batt_sensor); + epd->setCursor(202, y0); + epd->print("Batt. sensor:"); + epd->setCursor(320, y0); + epd->print(batt_sensor); // Solar sensor - getdisplay().setCursor(202, y0 + 16); - getdisplay().print("Solar sensor:"); - getdisplay().setCursor(320, y0 + 16); - getdisplay().print(solar_sensor); + epd->setCursor(202, y0 + 16); + epd->print("Solar sensor:"); + epd->setCursor(320, y0 + 16); + epd->print(solar_sensor); // Generator sensor - getdisplay().setCursor(202, y0 + 32); - getdisplay().print("Gen. sensor:"); - getdisplay().setCursor(320, y0 + 32); - getdisplay().print(gen_sensor); + epd->setCursor(202, y0 + 32); + epd->print("Gen. sensor:"); + epd->setCursor(320, y0 + 32); + epd->print(gen_sensor); #ifdef BOARD_OBP60S3 // Backlight infos - getdisplay().setCursor(202, y0 + 64); - getdisplay().print("Backlight:"); - getdisplay().setCursor(320, y0 + 64); - getdisplay().printf("%d%%", commonData->backlight.brightness); + epd->setCursor(202, y0 + 64); + epd->print("Backlight:"); + epd->setCursor(320, y0 + 64); + epd->printf("%d%%", commonData->backlight.brightness); // TODO test function with OBP60 device - getdisplay().setCursor(202, y0 + 80); - getdisplay().print("Bl color:"); - getdisplay().setCursor(320, y0 + 80); - getdisplay().print(commonData->backlight.color.toName()); - getdisplay().setCursor(202, y0 + 96); - getdisplay().print("Bl mode:"); - getdisplay().setCursor(320, y0 + 96); - getdisplay().print(commonData->backlight.mode); + epd->setCursor(202, y0 + 80); + epd->print("Bl color:"); + epd->setCursor(320, y0 + 80); + epd->print(commonData->backlight.color.toName()); + epd->setCursor(202, y0 + 96); + epd->print("Bl mode:"); + epd->setCursor(320, y0 + 96); + epd->print(commonData->backlight.mode); // TODO Buzzer mode and power #endif @@ -357,28 +358,28 @@ private: uint16_t x0 = 20; uint16_t y0 = 72; - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("SD Card info"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + epd->print("SD Card info"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(x0, y0); - getdisplay().print("Work in progress..."); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(x0, y0); + epd->print("Work in progress..."); } void displayModeDevicelist() { // NMEA2000 device list - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 48); - getdisplay().print("NMEA2000 device list"); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 48); + epd->print("NMEA2000 device list"); - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(20, 80); - getdisplay().print("RxD: "); - getdisplay().print(String(commonData->status.n2kRx)); - getdisplay().setCursor(20, 100); - getdisplay().print("TxD: "); - getdisplay().print(String(commonData->status.n2kTx)); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(20, 80); + epd->print("RxD: "); + epd->print(String(commonData->status.n2kRx)); + epd->setCursor(20, 100); + epd->print("TxD: "); + epd->print(String(commonData->status.n2kTx)); } void storeConfig() { @@ -421,8 +422,8 @@ public: // Accesspoint: On | Off // TODO Change NVRAM-preferences settings here - // getdisplay().setCursor(x0, y0 + 4 * dy); - // getdisplay().print("Simulation: On | Off"); + // epd->setCursor(x0, y0 + 4 * dy); + // epd->print("Simulation: On | Off"); // Initialize config menu menu = new ConfigMenu("Options", 40, 80); @@ -507,7 +508,7 @@ public: for (uint8_t j = 0; j < qrcode.size; j++) { for (uint8_t i = 0; i < qrcode.size; i++) { if (qrcode_getModule(&qrcode, i, j)) { - getdisplay().fillRect(x, y, s, s, commonData->fgcolor); + epd->fillRect(x, y, s, s, commonData->fgcolor); } x += s; } @@ -530,7 +531,7 @@ public: LOG_DEBUG(GwLog::LOG,"Drawing at PageSystem, Mode=%c", 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 switch (mode) { @@ -552,7 +553,7 @@ public: } // Update display - getdisplay().nextPage(); // Partial update (fast) + epd->nextPage(); // Partial update (fast) return PAGE_OK; }; }; diff --git a/lib/obp60task/PageThreeValues.cpp b/lib/obp60task/PageThreeValues.cpp index 996e2bc..6cb021f 100644 --- a/lib/obp60task/PageThreeValues.cpp +++ b/lib/obp60task/PageThreeValues.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -84,46 +85,46 @@ class PageThreeValues : public Page //*********************************************************** /// 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 ################ // Show name - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 55); - getdisplay().print(name1); // Page name + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 55); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 90); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 90); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Switch font if format for any values if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 90); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(50, 90); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 68); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(170, 68); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 90); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 90); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -133,45 +134,45 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); + epd->fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 145); - getdisplay().print(name2); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 145); + epd->print(name2); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 180); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 180); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); + epd->print(unit2old); } // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 180); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(50, 180); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 158); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(170, 158); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 180); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 180); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + epd->print(svalue2old); // Old value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value @@ -181,45 +182,45 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); + epd->fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 235); - getdisplay().print(name3); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 235); + epd->print(name3); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 270); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 270); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); + epd->print(unit3old); } // Switch font if format for any values if(bvalue3->getFormat() == "formatLatitude" || bvalue3->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 270); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(50, 270); } else if(bvalue3->getFormat() == "formatTime" || bvalue3->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 248); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(170, 248); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); - getdisplay().setCursor(180, 270); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setCursor(180, 270); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue3); // Real value as formated string + epd->print(svalue3); // Real value as formated string } else{ - getdisplay().print(svalue3old); // Old value as formated string + epd->print(svalue3old); // Old value as formated string } if(valid3 == true){ svalue3old = svalue3; // Save the old value diff --git a/lib/obp60task/PageTwoValues.cpp b/lib/obp60task/PageTwoValues.cpp index eaa59d4..bd868ec 100644 --- a/lib/obp60task/PageTwoValues.cpp +++ b/lib/obp60task/PageTwoValues.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -72,46 +73,46 @@ class PageTwoValues : public Page //*********************************************************** // 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 ################ // Show name - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 80); - getdisplay().print(name1); // Page name + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 80); + epd->print(name1); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 130); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 130); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); + epd->print(unit1old); } // Switch font if format for any values if(bvalue1->getFormat() == "formatLatitude" || bvalue1->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 130); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(50, 130); } else if(bvalue1->getFormat() == "formatTime" || bvalue1->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 105); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(170, 105); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); - getdisplay().setCursor(180, 130); + epd->setFont(&DSEG7Classic_BoldItalic42pt7b); + epd->setCursor(180, 130); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue1); // Real value as formated string + epd->print(svalue1); // Real value as formated string } else{ - getdisplay().print(svalue1old); // Old value as formated string + epd->print(svalue1old); // Old value as formated string } if(valid1 == true){ svalue1old = svalue1; // Save the old value @@ -121,45 +122,45 @@ class PageTwoValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 145, 400, 3, commonData->fgcolor); + epd->fillRect(0, 145, 400, 3, commonData->fgcolor); // ############### Value 2 ################ // Show name - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 190); - getdisplay().print(name2); // Page name + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 190); + epd->print(name2); // Page name // Show unit - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(20, 240); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(20, 240); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); + epd->print(unit2old); } // Switch font if format for any values if(bvalue2->getFormat() == "formatLatitude" || bvalue2->getFormat() == "formatLongitude"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(50, 240); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(50, 240); } else if(bvalue2->getFormat() == "formatTime" || bvalue2->getFormat() == "formatDate"){ - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(170, 215); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(170, 215); } else{ - getdisplay().setFont(&DSEG7Classic_BoldItalic42pt7b); - getdisplay().setCursor(180, 240); + epd->setFont(&DSEG7Classic_BoldItalic42pt7b); + epd->setCursor(180, 240); } // Show bus data if(holdvalues == false){ - getdisplay().print(svalue2); // Real value as formated string + epd->print(svalue2); // Real value as formated string } else{ - getdisplay().print(svalue2old); // Old value as formated string + epd->print(svalue2old); // Old value as formated string } if(valid2 == true){ svalue2old = svalue2; // Save the old value diff --git a/lib/obp60task/PageVoltage.cpp b/lib/obp60task/PageVoltage.cpp index 6f9364e..26bb996 100644 --- a/lib/obp60task/PageVoltage.cpp +++ b/lib/obp60task/PageVoltage.cpp @@ -75,38 +75,38 @@ public: } void printAvg(int avg, uint16_t x, uint16_t y, bool prefix) { - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(x, y); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(x, y); if (prefix) { - getdisplay().print("Avg: "); + epd->print("Avg: "); } switch (average) { case 0: - getdisplay().print("1s"); + epd->print("1s"); break; case 1: - getdisplay().print("10s"); + epd->print("10s"); break; case 2: - getdisplay().print("60s"); + epd->print("60s"); break; case 3: - getdisplay().print("300s"); + epd->print("300s"); break; default: - getdisplay().print("1s"); + epd->print("1s"); break; } } void printVoltageSymbol(uint16_t x, uint16_t y, uint16_t color) { - getdisplay().setFont(&Ubuntu_Bold16pt8b); - getdisplay().setCursor(x, y); - getdisplay().print("V"); - getdisplay().fillRect(x, y + 6, 22, 3, color); - getdisplay().fillRect(x, y + 11, 6, 3, color); - getdisplay().fillRect(x + 8, y + 11, 6, 3, color); - getdisplay().fillRect(x + 16, y + 11, 6, 3, color); + epd->setFont(&Ubuntu_Bold16pt8b); + epd->setCursor(x, y); + epd->print("V"); + epd->fillRect(x, y + 6, 22, 3, color); + epd->fillRect(x, y + 11, 6, 3, color); + epd->fillRect(x + 8, y + 11, 6, 3, color); + epd->fillRect(x + 16, y + 11, 6, 3, color); } int displayPage(PageData &pageData){ @@ -202,50 +202,50 @@ public: //*********************************************************** // 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') { // Display mode digital // Show name - getdisplay().setTextColor(commonData->fgcolor); - getdisplay().setFont(&Ubuntu_Bold32pt8b); - getdisplay().setCursor(20, 100); - getdisplay().print(name1); // Value name + epd->setTextColor(commonData->fgcolor); + epd->setFont(&Ubuntu_Bold32pt8b); + epd->setCursor(20, 100); + epd->print(name1); // Value name #if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR // Show charge status - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(185, 100); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(185, 100); if(commonData->data.BatteryChargeStatus == true){ - getdisplay().print("Charge"); + epd->print("Charge"); } else{ - getdisplay().print("Discharge"); + epd->print("Discharge"); } #endif // Show unit - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(270, 100); - getdisplay().print("V"); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(270, 100); + epd->print("V"); // Show battery type - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(295, 100); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(295, 100); #ifdef BOARD_OBP60S3 - getdisplay().print(batType); + epd->print(batType); #endif #if defined BOARD_OBP40S3 && defined LIPO_ACCU_1200 && defined VOLTAGE_SENSOR - getdisplay().print("LiPo"); + epd->print("LiPo"); #endif // Show average settings printAvg(average, 320, 84, true); // Reading bus data or using simulation data - getdisplay().setFont(&DSEG7Classic_BoldItalic60pt7b); - getdisplay().setCursor(20, 240); + epd->setFont(&DSEG7Classic_BoldItalic60pt7b); + epd->setCursor(20, 240); if(simulation == true){ if(batVoltage == "12V"){ value1 = 12.0; @@ -254,30 +254,30 @@ public: value1 = 24.0; } value1 += float(random(0, 5)) / 10; // Simulation data - getdisplay().print(value1,1); + epd->print(value1,1); } else{ // Check for valid real data, display also if hold values activated if(valid1 == true || holdvalues == true){ // Resolution switching if(value1 < 10){ - getdisplay().print(value1,2); + epd->print(value1,2); } if(value1 >= 10 && value1 < 100){ - getdisplay().print(value1,1); + epd->print(value1,1); } if(value1 >= 100){ - getdisplay().print(value1,0); + epd->print(value1,0); } } else{ - getdisplay().print("---"); // Missing bus data + epd->print("---"); // Missing bus data } } // Show trend indicator 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)){ displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator } @@ -298,9 +298,9 @@ public: std::vector pts; // Instrument - getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor); - getdisplay().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 + 2, 0x01, commonData->fgcolor); + epd->drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor); + epd->drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor); // Scale // angle to voltage scale mapping @@ -313,7 +313,7 @@ public: {c.x - r + 12, 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) { if (angle % 15 == 0) { fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); @@ -323,7 +323,7 @@ public: else { p1 = rotatePoint(c, {c.x - r, 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); // base - getdisplay().fillCircle(c.x, c.y, 7, commonData->fgcolor); - getdisplay().fillCircle(c.x, c.y, 4, commonData->bgcolor); + epd->fillCircle(c.x, c.y, 7, commonData->fgcolor); + epd->fillCircle(c.x, c.y, 4, commonData->bgcolor); // Symbol printVoltageSymbol(40, 60, commonData->fgcolor); // Additional information at right side - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(300, 60); - getdisplay().print("Source:"); - getdisplay().setCursor(300, 80); - getdisplay().print(name1); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(300, 60); + epd->print("Source:"); + epd->setCursor(300, 80); + epd->print(name1); - getdisplay().setCursor(300, 110); - getdisplay().print("Type:"); - getdisplay().setCursor(300, 130); - getdisplay().print(batType); + epd->setCursor(300, 110); + epd->print("Type:"); + epd->setCursor(300, 130); + epd->print(batType); - getdisplay().setCursor(300, 160); - getdisplay().print("Avg:"); + epd->setCursor(300, 160); + epd->print("Avg:"); printAvg(average, 300, 180, false); // FRAM indicator 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); } } diff --git a/lib/obp60task/PageWhite.cpp b/lib/obp60task/PageWhite.cpp index 4791400..9d86da9 100644 --- a/lib/obp60task/PageWhite.cpp +++ b/lib/obp60task/PageWhite.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -61,19 +62,19 @@ public: // Set display in partial refresh mode if (mode == 'W') { - getdisplay().setFullWindow(); + epd->setFullWindow(); } 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') { - 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') { #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 #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 } diff --git a/lib/obp60task/PageWind.cpp b/lib/obp60task/PageWind.cpp index 460d1fb..a8f47f8 100644 --- a/lib/obp60task/PageWind.cpp +++ b/lib/obp60task/PageWind.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -361,51 +362,51 @@ public: //*********************************************************** // 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') { // Original example code with scaling circle // Show values AWS/TWS - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 50); - getdisplay().print(name1); // Value name - getdisplay().print(": "); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 50); + epd->print(name1); // Value name + epd->print(": "); if(holdvalues == false){ - getdisplay().print(svalue1); // Value - getdisplay().print(" "); - getdisplay().print(unit1); // Unit + epd->print(svalue1); // Value + epd->print(" "); + epd->print(unit1); // Unit } else{ - getdisplay().print(svalue1old); // Value old - getdisplay().print(" "); - getdisplay().print(unit1old); // Unit old + epd->print(svalue1old); // Value old + epd->print(" "); + epd->print(unit1old); // Unit old } // Show values AWD/TWD - getdisplay().setFont(&Ubuntu_Bold20pt8b); - getdisplay().setCursor(20, 260); - getdisplay().print(name2); // Value name - getdisplay().print(": "); + epd->setFont(&Ubuntu_Bold20pt8b); + epd->setCursor(20, 260); + epd->print(name2); // Value name + epd->print(": "); if(holdvalues == false){ - getdisplay().print(svalue2); // Value - getdisplay().print(" "); - getdisplay().print(unit2); // Unit + epd->print(svalue2); // Value + epd->print(" "); + epd->print(unit2); // Unit } else{ - getdisplay().print(svalue2old); // Value old - getdisplay().print(" "); - getdisplay().print(unit2old); // Unit old + epd->print(svalue2old); // Value old + epd->print(" "); + epd->print(unit2old); // Unit old } Point c = {200, 145}; // Draw instrument - getdisplay().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 + 5, commonData->fgcolor); + epd->fillCircle(c.x, c.y, lp + 1, commonData->bgcolor); // Wind pointer if (bvalue2->valid or simulation) { @@ -420,7 +421,7 @@ public: }; fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData->fgcolor); } else { - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); drawTextCenter(c.x, c.y, "no data"); } @@ -438,7 +439,7 @@ public: }; int angle; - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); // starbord // text with line @@ -453,7 +454,7 @@ public: for (int i = 30; i < 138; i += 6) { if (i % 15 != 0) { 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) { if (i % 15 != 0) { 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 - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 50); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 50); if (source == 'A') { - getdisplay().print("APP"); + epd->print("APP"); } else { - getdisplay().print("TRUE"); + epd->print("TRUE"); } // Wind pointer (angle) @@ -500,7 +501,7 @@ public: alpha *= -1; } - getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); + epd->fillCircle(c.x, c.y, 8, commonData->fgcolor); pts = { {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} }; 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 { - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); drawTextCenter(c.x, c.y, "no data"); } // Wind speed as decimal number - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 250); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 250); if (holdvalues == false) { - getdisplay().print(svalue1); + epd->print(svalue1); } else { - getdisplay().print(svalue1old); + epd->print(svalue1old); } // unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(220, 265); - getdisplay().print("kts"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(220, 265); + epd->print("kts"); } else { // Normal mode // data source - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(8, 50); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(8, 50); if (source == 'A') { - getdisplay().print("APP"); + epd->print("APP"); } else { - getdisplay().print("TRUE"); + epd->print("TRUE"); } // 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}; uint16_t r = 150; @@ -565,7 +566,7 @@ public: for (int i = 30; i < 150; i += 10) { if (i % 30 != 0) { 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) { if (i % 30 != 0) { 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 - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(150, 250); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(150, 250); if (holdvalues == false) { - getdisplay().print(svalue1); + epd->print(svalue1); } else { - getdisplay().print(svalue1old); + epd->print(svalue1old); } // unit - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(220, 265); - getdisplay().print("kts"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(220, 265); + epd->print("kts"); // Wind pointer (angle) if (bvalue2->valid or simulation) { float alpha = RadToDeg(value2); - getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); + epd->fillCircle(c.x, c.y, 8, commonData->fgcolor); pts = { {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} }; 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 { - getdisplay().setFont(&Ubuntu_Bold12pt8b); + epd->setFont(&Ubuntu_Bold12pt8b); drawTextCenter(c.x, c.y, "no data"); } diff --git a/lib/obp60task/PageWindPlot.cpp b/lib/obp60task/PageWindPlot.cpp index 5255320..2fd7688 100644 --- a/lib/obp60task/PageWindPlot.cpp +++ b/lib/obp60task/PageWindPlot.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "BoatDataCalibration.h" @@ -181,8 +182,8 @@ public: String backlightMode = config->getString(config->backlight); if (!isInitialized) { - width = getdisplay().width(); - height = getdisplay().height(); + width = epd->width(); + height = epd->height(); xCenter = width / 2; cHeight = height - yOffset - 22; bufSize = pageData.boatHstry.twdHstry->getCapacity(); @@ -277,32 +278,32 @@ public: //*********************************************************************** // Set display in partial refresh mode - getdisplay().setPartialWindow(0, 0, width, height); // Set partial update - getdisplay().setTextColor(commonData->fgcolor); + epd->setPartialWindow(0, 0, width, height); // Set partial update + epd->setTextColor(commonData->fgcolor); // chart lines - getdisplay().fillRect(0, yOffset, width, 2, commonData->fgcolor); - getdisplay().fillRect(xCenter, yOffset, 1, cHeight, commonData->fgcolor); + epd->fillRect(0, yOffset, width, 2, commonData->fgcolor); + epd->fillRect(xCenter, yOffset, 1, cHeight, commonData->fgcolor); // chart labels char sWndLbl[4]; // char buffer for Wind angle label - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(xCenter - 88, yOffset - 3); - getdisplay().print("TWD"); // Wind data name + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(xCenter - 88, yOffset - 3); + epd->print("TWD"); // Wind data name snprintf(sWndLbl, 4, "%03d", (wndCenter < 0) ? (wndCenter + 360) : wndCenter); drawTextCenter(xCenter, yOffset - 11, sWndLbl); - getdisplay().drawCircle(xCenter + 25, yOffset - 17, 2, commonData->fgcolor); // symbol - getdisplay().drawCircle(xCenter + 25, yOffset - 17, 3, commonData->fgcolor); // symbol - getdisplay().setCursor(1, yOffset - 3); + epd->drawCircle(xCenter + 25, yOffset - 17, 2, commonData->fgcolor); // symbol + epd->drawCircle(xCenter + 25, yOffset - 17, 3, commonData->fgcolor); // symbol + epd->setCursor(1, yOffset - 3); snprintf(sWndLbl, 4, "%03d", (wndLeft < 0) ? (wndLeft + 360) : wndLeft); - getdisplay().print(sWndLbl); // Wind left value - getdisplay().drawCircle(46, yOffset - 17, 2, commonData->fgcolor); // symbol - getdisplay().drawCircle(46, yOffset - 17, 3, commonData->fgcolor); // symbol - getdisplay().setCursor(width - 50, yOffset - 3); + epd->print(sWndLbl); // Wind left value + epd->drawCircle(46, yOffset - 17, 2, commonData->fgcolor); // symbol + epd->drawCircle(46, yOffset - 17, 3, commonData->fgcolor); // symbol + epd->setCursor(width - 50, yOffset - 3); snprintf(sWndLbl, 4, "%03d", (wndRight < 0) ? (wndRight + 360) : wndRight); - getdisplay().print(sWndLbl); // Wind right value - getdisplay().drawCircle(width - 5, yOffset - 17, 2, commonData->fgcolor); // symbol - getdisplay().drawCircle(width - 5, yOffset - 17, 3, commonData->fgcolor); // symbol + epd->print(sWndLbl); // Wind right value + epd->drawCircle(width - 5, yOffset - 17, 2, commonData->fgcolor); // symbol + epd->drawCircle(width - 5, yOffset - 17, 3, commonData->fgcolor); // symbol if (pageData.boatHstry.twdHstry->getMax() == pageData.boatHstry.twdHstry->getMinVal()) { // only 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 current value crosses chart borders compared to previous value, split line int xSplit = (((chrtPrevVal180 > 0 ? wndRight : wndLeft) - wndLeft + 360) % 360) * chrtScl; - getdisplay().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, xSplit, 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; } } // Draw line with 2 pixels width + make sure vertical line are drawn correctly - getdisplay().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, x, y, commonData->fgcolor); + epd->drawLine(prevX, prevY - 1, ((x != prevX) ? x : x - 1), ((x != prevX) ? y - 1 : y), commonData->fgcolor); chrtPrevVal = chrtVal; prevX = x; prevY = y; @@ -383,8 +384,8 @@ public: } else { // No valid data available LOG_DEBUG(GwLog::LOG, "PageWindPlot: No valid data available"); - getdisplay().setFont(&Ubuntu_Bold10pt8b); - getdisplay().fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message + epd->setFont(&Ubuntu_Bold10pt8b); + epd->fillRect(xCenter - 33, height / 2 - 20, 66, 24, commonData->bgcolor); // Clear area for message drawTextCenter(xCenter, height / 2 - 10, "No data"); } @@ -409,39 +410,39 @@ public: } lastZone = currentZone; - getdisplay().fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); - getdisplay().setCursor(xPosTws, yPosTws); + epd->fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setCursor(xPosTws, yPosTws); if (!BDataValid[1]) { - getdisplay().print("--.-"); + epd->print("--.-"); } else { double dbl = BDataValue[1] * 3.6 / 1.852; 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 { - getdisplay().printf("%4.1f", dbl); // Value, round to 1 decimal + epd->printf("%4.1f", dbl); // Value, round to 1 decimal } } - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(xPosTws + 82, yPosTws - 14); -// getdisplay().print("TWS"); // Name - getdisplay().print(BDataName[1]); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); -// getdisplay().setCursor(xPosTws + 78, yPosTws + 1); - getdisplay().setCursor(xPosTws + 82, yPosTws + 1); -// getdisplay().printf(" kn"); // Unit - getdisplay().print(BDataUnit[1]); // Unit + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(xPosTws + 82, yPosTws - 14); +// epd->print("TWS"); // Name + epd->print(BDataName[1]); // Name + epd->setFont(&Ubuntu_Bold8pt8b); +// epd->setCursor(xPosTws + 78, yPosTws + 1); + epd->setCursor(xPosTws + 82, yPosTws + 1); +// epd->printf(" kn"); // Unit + epd->print(BDataUnit[1]); // Unit } // chart Y axis labels; print at last to overwrite potential chart lines in label area int yPos; int chrtLbl; - getdisplay().setFont(&Ubuntu_Bold8pt8b); + epd->setFont(&Ubuntu_Bold8pt8b); for (int i = 1; i <= 3; i++) { yPos = yOffset + (i * 60); - getdisplay().fillRect(0, yPos, width, 1, commonData->fgcolor); - getdisplay().fillRect(0, yPos - 8, 24, 16, commonData->bgcolor); // Clear small area to remove potential chart lines - getdisplay().setCursor(1, yPos + 4); + epd->fillRect(0, yPos, width, 1, commonData->fgcolor); + epd->fillRect(0, yPos - 8, 24, 16, commonData->bgcolor); // Clear small area to remove potential chart lines + epd->setCursor(1, yPos + 4); if (count >= intvBufSize) { // 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 @@ -449,7 +450,7 @@ public: int j = 3 - i; 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; @@ -476,4 +477,4 @@ PageDescription registerPageWindPlot( true // Show display header on/off ); -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/PageWindRose.cpp b/lib/obp60task/PageWindRose.cpp index c4ab0e0..f8087dd 100644 --- a/lib/obp60task/PageWindRose.cpp +++ b/lib/obp60task/PageWindRose.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -147,87 +148,87 @@ public: //*********************************************************** // 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 - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 65); - getdisplay().print(svalue1); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 95); - getdisplay().print(name1); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 115); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 65); + epd->print(svalue1); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 95); + epd->print(name1); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 115); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit1); // Unit + epd->print(unit1); // Unit } else{ - getdisplay().print(unit1old); // Unit + epd->print(unit1old); // Unit } // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); + epd->fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values AWS - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 270); - getdisplay().print(svalue2); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 220); - getdisplay().print(name2); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 190); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 270); + epd->print(svalue2); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 220); + epd->print(name2); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 190); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); // Unit + epd->print(unit2old); // Unit } // Show values TWD - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(295, 65); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(295, 65); if(valid3 == true){ - getdisplay().print(abs(value3 * 180 / PI), 0); // Value + epd->print(abs(value3 * 180 / PI), 0); // Value } else{ - getdisplay().print("---"); // Value + epd->print("---"); // Value } - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 95); - getdisplay().print(name3); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 115); - getdisplay().print(" "); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 95); + epd->print(name3); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 115); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); // Unit + epd->print(unit3old); // Unit } // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); + epd->fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values TWS - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(295, 270); - getdisplay().print(svalue4); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 220); - getdisplay().print(name4); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 190); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(295, 270); + epd->print(svalue4); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 220); + epd->print(name4); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 190); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit4); // Unit + epd->print(unit4); // Unit } else{ - getdisplay().print(unit4old); // Unit + epd->print(unit4old); // Unit } //******************************************************************************************* @@ -236,10 +237,10 @@ public: int rInstrument = 110; // Radius of grafic instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + epd->fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -267,17 +268,17 @@ public: // Print text centered on position x, y int16_t x1, y1; // Return values of getTextBounds uint16_t w, h; // Return values of getTextBounds - getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 30 == 0){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->print(ii); } // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - 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 cosx=cos(i/180.0*pi); @@ -288,10 +289,10 @@ public: float xx2 = +dx; float yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } @@ -308,7 +309,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -318,43 +319,43 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument-15); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); + epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* // Show values DBT - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); - getdisplay().setCursor(160, 200); - getdisplay().print(svalue5); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 215); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setCursor(160, 200); + epd->print(svalue5); // Value + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(190, 215); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit5); // Unit + epd->print(unit5); // Unit } else{ - getdisplay().print(unit5old); // Unit + epd->print(unit5old); // Unit } // Show values STW - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); - getdisplay().setCursor(160, 130); - getdisplay().print(svalue6); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 90); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setCursor(160, 130); + epd->print(svalue6); // Value + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(190, 90); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit6); // Unit + epd->print(unit6); // Unit } else{ - getdisplay().print(unit6old); // Unit + epd->print(unit6old); // Unit } return PAGE_UPDATE; diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index 35215c9..1e29361 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -147,88 +148,88 @@ public: //*********************************************************** // 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) - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 65); - getdisplay().print(svalue2); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 95); - getdisplay().print(name2); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 115); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 65); + epd->print(svalue2); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 95); + epd->print(name2); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 115); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit2); // Unit + epd->print(unit2); // Unit } else{ - getdisplay().print(unit2old); // Unit + epd->print(unit2old); // Unit } // 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 - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(10, 270); - getdisplay().print(svalue3); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(10, 220); - getdisplay().print(name3); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(10, 190); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(10, 270); + epd->print(svalue3); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(10, 220); + epd->print(name3); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(10, 190); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit3); // Unit + epd->print(unit3); // Unit } else{ - getdisplay().print(unit3old); // Unit + epd->print(unit3old); // Unit } // Show value 4 at top right - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(295, 65); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(295, 65); if(valid3 == true){ - // getdisplay().print(abs(value3 * 180 / M_PI), 0); // Value - getdisplay().print(svalue4); // Value + // epd->print(abs(value3 * 180 / M_PI), 0); // Value + epd->print(svalue4); // Value } else{ - getdisplay().print("---"); // Value + epd->print("---"); // Value } - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 95); - getdisplay().print(name4); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 115); - getdisplay().print(" "); + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 95); + epd->print(name4); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 115); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit4); // Unit + epd->print(unit4); // Unit } else{ - getdisplay().print(unit4old); // Unit + epd->print(unit4old); // Unit } // 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 - getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); - getdisplay().setCursor(295, 270); - getdisplay().print(svalue5); // Value - getdisplay().setFont(&Ubuntu_Bold12pt8b); - getdisplay().setCursor(335, 220); - getdisplay().print(name5); // Name - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(335, 190); - getdisplay().print(" "); + epd->setFont(&DSEG7Classic_BoldItalic20pt7b); + epd->setCursor(295, 270); + epd->print(svalue5); // Value + epd->setFont(&Ubuntu_Bold12pt8b); + epd->setCursor(335, 220); + epd->print(name5); // Name + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(335, 190); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit5); // Unit + epd->print(unit5); // Unit } else{ - getdisplay().print(unit5old); // Unit + epd->print(unit5old); // Unit } @@ -237,10 +238,10 @@ public: // Draw wind rose int rInstrument = 110; // Radius of grafic instrument - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle + epd->fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + epd->fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + epd->fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -267,17 +268,17 @@ public: // Print text centered on position x, y int16_t x1, y1; // Return values of getTextBounds uint16_t w, h; // Return values of getTextBounds - getdisplay().getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string - getdisplay().setCursor(x-w/2, y+h/2); + epd->getTextBounds(ii, int(x), int(y), &x1, &y1, &w, &h); // Calc width of new string + epd->setCursor(x-w/2, y+h/2); if(i % 30 == 0){ - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().print(ii); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->print(ii); } // Draw sub scale with dots float x1c = 200 + rInstrument*sin(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 cosx=cos(i/180.0*M_PI); @@ -288,10 +289,10 @@ public: float xx2 = +dx; float yy1 = -(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*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*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } @@ -308,7 +309,7 @@ public: float xx2 = startwidth; float yy1 = -startwidth; 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*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer @@ -318,36 +319,36 @@ public: float ix2 = -endwidth; float iy1 = -(rInstrument-15); 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*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); + epd->fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + epd->fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* // Show value6, so that it does not collide with the wind pointer - getdisplay().setFont(&DSEG7Classic_BoldItalic16pt7b); + epd->setFont(&DSEG7Classic_BoldItalic16pt7b); if (cos(value1) > 0){ - getdisplay().setCursor(160, 200); - getdisplay().print(svalue6); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 215); + epd->setCursor(160, 200); + epd->print(svalue6); // Value + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(190, 215); } else{ - getdisplay().setCursor(160, 130); - getdisplay().print(svalue6); // Value - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(190, 90); + epd->setCursor(160, 130); + epd->print(svalue6); // Value + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(190, 90); } - getdisplay().print(" "); + epd->print(" "); if(holdvalues == false){ - getdisplay().print(unit6); // Unit + epd->print(unit6); // Unit } else{ - getdisplay().print(unit6old); // Unit + epd->print(unit6old); // Unit } return PAGE_UPDATE; diff --git a/lib/obp60task/PageXTETrack.cpp b/lib/obp60task/PageXTETrack.cpp index 0b513df..ec04289 100644 --- a/lib/obp60task/PageXTETrack.cpp +++ b/lib/obp60task/PageXTETrack.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #if defined BOARD_OBP60S3 || defined BOARD_OBP40S3 #include "Pagedata.h" @@ -45,14 +46,14 @@ class PageXTETrack : public Page if (fill == true) { // no primitive for quadrangular object // we create it from 2 triangles - getdisplay().fillTriangle(x0, y0, x1, y1, x3, y3, color); - getdisplay().fillTriangle(x1, y1, x2, y2, x3, y3, color); + epd->fillTriangle(x0, y0, x1, y1, x3, y3, color); + epd->fillTriangle(x1, y1, x2, y2, x3, y3, color); } else { // draw outline - getdisplay().drawLine(x0, y0, x1, y1, color); - getdisplay().drawLine(x1, y1, x2, y2, color); - getdisplay().drawLine(x2, y2, x3, y3, color); - getdisplay().drawLine(x3, y3, x0, y0, color); + epd->drawLine(x0, y0, x1, y1, color); + epd->drawLine(x1, y1, x2, y2, color); + epd->drawLine(x2, y2, x3, y3, color); + epd->drawLine(x3, y3, x0, y0, color); } } @@ -89,57 +90,57 @@ class PageXTETrack : public Page //*********************************************************** // 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 - getdisplay().setFont(&Ubuntu_Bold8pt8b); - getdisplay().setCursor(50, 188); - getdisplay().print("Cross-track error"); - getdisplay().setCursor(270, 188); - getdisplay().print("Track"); - getdisplay().setCursor(45, 275); - getdisplay().print("Distance to waypoint"); - getdisplay().setCursor(260, 275); - getdisplay().print("Bearing"); + epd->setFont(&Ubuntu_Bold8pt8b); + epd->setCursor(50, 188); + epd->print("Cross-track error"); + epd->setCursor(270, 188); + epd->print("Track"); + epd->setCursor(45, 275); + epd->print("Distance to waypoint"); + epd->setCursor(260, 275); + epd->print("Bearing"); // values - getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b); + epd->setFont(&DSEG7Classic_BoldItalic30pt7b); int16_t x, y; uint16_t w, h; GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE String sval_xte = formatValue(bv_xte, *commonData).svalue; - getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h); - getdisplay().setCursor(160-w, 170); - getdisplay().print(sval_xte); + epd->getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h); + epd->setCursor(160-w, 170); + epd->print(sval_xte); GwApi::BoatValue *bv_cog = pageData.values[1]; // COG String sval_cog = formatValue(bv_cog, *commonData).svalue; - getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h); - getdisplay().setCursor(360-w, 170); - getdisplay().print(sval_cog); + epd->getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h); + epd->setCursor(360-w, 170); + epd->print(sval_cog); GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW String sval_dtw = formatValue(bv_dtw, *commonData).svalue; - getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h); - getdisplay().setCursor(160-w, 257); - getdisplay().print(sval_dtw); + epd->getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h); + epd->setCursor(160-w, 257); + epd->print(sval_dtw); GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW String sval_btw = formatValue(bv_btw, *commonData).svalue; - getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h); - getdisplay().setCursor(360-w, 257); - getdisplay().print(sval_btw); + epd->getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h); + epd->setCursor(360-w, 257); + epd->print(sval_btw); bool valid = bv_cog->valid && bv_btw->valid; // XTETrack view // 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 String sval_wpname = "no data"; @@ -148,13 +149,13 @@ class PageXTETrack : public Page sval_wpname = "Tonne 122"; } - getdisplay().setFont(&Ubuntu_Bold10pt8b); - getdisplay().getTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h); + epd->setFont(&Ubuntu_Bold10pt8b); + epd->getTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h); // TODO if text don't fix use smaller font size. // if smallest size does not fit use 2 lines // last resort: clip with ellipsis - getdisplay().setCursor(200 - w / 2, 60); - getdisplay().print(sval_wpname); + epd->setCursor(200 - w / 2, 60); + epd->print(sval_wpname); // draw course segments