mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-03-28 18:06:37 +01:00
Finalize switch to epd pointer instead if getdisplay()
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user