mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-31 01:45:45 +00:00
std behaviour
This commit is contained in:
@@ -99,7 +99,7 @@ void UITask::renderCurrScreen() {
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->print(_msg);
|
||||
|
||||
_display->setCursor(100, 9);
|
||||
_display->setCursor(_display->width() - 28, 9);
|
||||
_display->setTextSize(2);
|
||||
_display->setColor(DisplayDriver::ORANGE);
|
||||
sprintf(tmp, "%d", _msgcount);
|
||||
|
||||
@@ -6,22 +6,33 @@ bool GxEPDDisplay::begin() {
|
||||
SPI1.begin();
|
||||
display.init(115200, true, 2, false);
|
||||
display.setRotation(3);
|
||||
display.setFont(&FreeMono9pt7b);
|
||||
|
||||
#ifdef TECHO_ZOOM
|
||||
display.setFont(&FreeMono9pt7b);
|
||||
#endif
|
||||
display.setPartialWindow(0, 0, display.width(), display.height());
|
||||
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.display(true);
|
||||
#if DISP_BACKLIGHT
|
||||
pinMode(DISP_BACKLIGHT, OUTPUT);
|
||||
#endif
|
||||
_init = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GxEPDDisplay::turnOn() {
|
||||
if (!_init) begin();
|
||||
#if DISP_BACKLIGHT
|
||||
digitalWrite(DISP_BACKLIGHT, HIGH);
|
||||
_isOn = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void GxEPDDisplay::turnOff() {
|
||||
|
||||
#if DISP_BACKLIGHT
|
||||
digitalWrite(DISP_BACKLIGHT, LOW);
|
||||
#endif
|
||||
_isOn = false;
|
||||
}
|
||||
|
||||
void GxEPDDisplay::clear() {
|
||||
@@ -34,6 +45,7 @@ void GxEPDDisplay::startFrame(Color bkg) {
|
||||
}
|
||||
|
||||
void GxEPDDisplay::setTextSize(int sz) {
|
||||
display.setTextSize(sz);
|
||||
}
|
||||
|
||||
void GxEPDDisplay::setColor(Color c) {
|
||||
@@ -41,7 +53,11 @@ void GxEPDDisplay::setColor(Color c) {
|
||||
}
|
||||
|
||||
void GxEPDDisplay::setCursor(int x, int y) {
|
||||
display.setCursor(x*1.5, (y*1.5)+10);
|
||||
#ifdef TECHO_ZOOM
|
||||
x = x + (x >> 1);
|
||||
y = y + (y >> 1);
|
||||
#endif
|
||||
display.setCursor(x, (y+10));
|
||||
}
|
||||
|
||||
void GxEPDDisplay::print(const char* str) {
|
||||
@@ -49,12 +65,32 @@ void GxEPDDisplay::print(const char* str) {
|
||||
}
|
||||
|
||||
void GxEPDDisplay::fillRect(int x, int y, int w, int h) {
|
||||
#ifdef TECHO_ZOOM
|
||||
x = x + (x >> 1);
|
||||
y = y + (y >> 1);
|
||||
w = w + (w >> 1);
|
||||
h = h + (h >> 1);
|
||||
#endif
|
||||
display.fillRect(x, y, w, h, GxEPD_BLACK);
|
||||
}
|
||||
|
||||
void GxEPDDisplay::drawRect(int x, int y, int w, int h) {
|
||||
#ifdef TECHO_ZOOM
|
||||
x = x + (x >> 1);
|
||||
y = y + (y >> 1);
|
||||
w = w + (w >> 1);
|
||||
h = h + (h >> 1);
|
||||
#endif
|
||||
display.drawRect(x, y, w, h, GxEPD_BLACK);
|
||||
}
|
||||
|
||||
void GxEPDDisplay::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
|
||||
#ifdef TECHO_ZOOM
|
||||
x = x + (x >> 1);
|
||||
y = y + (y >> 1);
|
||||
w = w + (w >> 1);
|
||||
h = h + (h >> 1);
|
||||
#endif
|
||||
display.drawBitmap(x*1.5, (y*1.5) + 10, bits, w, h, GxEPD_BLACK);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,17 @@ class GxEPDDisplay : public DisplayDriver {
|
||||
|
||||
GxEPD2_BW<GxEPD2_150_BN, 200> display;
|
||||
bool _init = false;
|
||||
bool _isOn = false;
|
||||
|
||||
public:
|
||||
GxEPDDisplay() : DisplayDriver(200, 200), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) {
|
||||
// there is a margin in y...
|
||||
GxEPDDisplay() : DisplayDriver(200, 200-10), display(GxEPD2_150_BN(DISP_CS, DISP_DC, DISP_RST, DISP_BUSY)) {
|
||||
|
||||
}
|
||||
|
||||
bool begin();
|
||||
|
||||
bool isOn() override { return true; }
|
||||
bool isOn() override {return _isOn;};
|
||||
void turnOn() override;
|
||||
void turnOff() override;
|
||||
void clear() override;
|
||||
|
||||
Reference in New Issue
Block a user