Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/helpers/ui/E213Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ void E213Display::setTextSize(int sz) {

void E213Display::setColor(Color c) {
display_crc.update<Color>(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) {
Expand All @@ -147,15 +149,15 @@ void E213Display::fillRect(int x, int y, int w, int h) {
display_crc.update<int>(y);
display_crc.update<int>(w);
display_crc.update<int>(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) {
display_crc.update<int>(x);
display_crc.update<int>(y);
display_crc.update<int>(w);
display_crc.update<int>(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) {
Expand All @@ -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);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/helpers/ui/E213Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/helpers/ui/E290Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ void E290Display::setTextSize(int sz) {

void E290Display::setColor(Color c) {
display_crc.update<Color>(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) {
Expand All @@ -100,15 +102,15 @@ void E290Display::fillRect(int x, int y, int w, int h) {
display_crc.update<int>(y);
display_crc.update<int>(w);
display_crc.update<int>(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) {
display_crc.update<int>(x);
display_crc.update<int>(y);
display_crc.update<int>(w);
display_crc.update<int>(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) {
Expand All @@ -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);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/helpers/ui/E290Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down