diff --git a/src/helpers/ui/E213Display.cpp b/src/helpers/ui/E213Display.cpp index 814693a06b..6071528202 100644 --- a/src/helpers/ui/E213Display.cpp +++ b/src/helpers/ui/E213Display.cpp @@ -128,7 +128,9 @@ void E213Display::setTextSize(int sz) { void E213Display::setColor(Color c) { display_crc.update(c); - // implemented in individual display methods + _color = c == 0 ? WHITE : BLACK; // for rectangles and bitmaps + display.setTextColor(UINT16_MAX * _color); // for text + // keep in mind this is inverted on e-ink } void E213Display::setCursor(int x, int y) { @@ -147,7 +149,7 @@ void E213Display::fillRect(int x, int y, int w, int h) { display_crc.update(y); display_crc.update(w); display_crc.update(h); - display->fillRect(x, y, w, h, BLACK); + display->fillRect(x, y, w, h, _color); } void E213Display::drawRect(int x, int y, int w, int h) { @@ -155,7 +157,7 @@ void E213Display::drawRect(int x, int y, int w, int h) { display_crc.update(y); display_crc.update(w); display_crc.update(h); - display->drawRect(x, y, w, h, BLACK); + display->drawRect(x, y, w, h, _color); } void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) { @@ -179,7 +181,7 @@ void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) { // If the bit is set, draw the pixel if (bitSet) { - display->drawPixel(x + bx, y + by, BLACK); + display->drawPixel(x + bx, y + by, _color); } } } diff --git a/src/helpers/ui/E213Display.h b/src/helpers/ui/E213Display.h index 420792c8a3..fbd01b03bf 100644 --- a/src/helpers/ui/E213Display.h +++ b/src/helpers/ui/E213Display.h @@ -13,6 +13,7 @@ class E213Display : public DisplayDriver { BaseDisplay* display=NULL; bool _init = false; bool _isOn = false; + uint8_t _color; RefCountedDigitalPin* _periph_power; CRC32 display_crc; uint32_t last_display_crc_value = 0; diff --git a/src/helpers/ui/E290Display.cpp b/src/helpers/ui/E290Display.cpp index ef4df05ed7..8c7f4ab4b6 100644 --- a/src/helpers/ui/E290Display.cpp +++ b/src/helpers/ui/E290Display.cpp @@ -81,7 +81,9 @@ void E290Display::setTextSize(int sz) { void E290Display::setColor(Color c) { display_crc.update(c); - // implemented in individual display methods + _color = c == 0 ? WHITE : BLACK; // for rectangles and bitmaps + display.setTextColor(UINT16_MAX * _color); // for text + // keep in mind this is inverted on e-ink } void E290Display::setCursor(int x, int y) { @@ -100,7 +102,7 @@ void E290Display::fillRect(int x, int y, int w, int h) { display_crc.update(y); display_crc.update(w); display_crc.update(h); - display.fillRect(x, y, w, h, BLACK); + display.fillRect(x, y, w, h, _color); } void E290Display::drawRect(int x, int y, int w, int h) { @@ -108,7 +110,7 @@ void E290Display::drawRect(int x, int y, int w, int h) { display_crc.update(y); display_crc.update(w); display_crc.update(h); - display.drawRect(x, y, w, h, BLACK); + display.drawRect(x, y, w, h, _color); } void E290Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) { @@ -132,7 +134,7 @@ void E290Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) { // If the bit is set, draw the pixel if (bitSet) { - display.drawPixel(x + bx, y + by, BLACK); + display.drawPixel(x + bx, y + by, _color); } } } diff --git a/src/helpers/ui/E290Display.h b/src/helpers/ui/E290Display.h index 2ca50225d1..b299efd963 100644 --- a/src/helpers/ui/E290Display.h +++ b/src/helpers/ui/E290Display.h @@ -13,6 +13,7 @@ class E290Display : public DisplayDriver { EInkDisplay_VisionMasterE290 display; bool _init = false; bool _isOn = false; + uint8_t _color; RefCountedDigitalPin* _periph_power; CRC32 display_crc; uint32_t last_display_crc_value = 0;