Refactor DarkBorder

* Allow to be changed dynamically between
  display updated.
pull/242/head
Daniel Ansorregui 2023-12-29 21:54:10 +00:00
parent 84c0cd106c
commit 8103df1499
2 changed files with 12 additions and 2 deletions

View File

@ -38,6 +38,15 @@ void WatchyDisplay::initWatchy() {
init(0, displayFullInit, 2, true); init(0, displayFullInit, 2, true);
} }
void WatchyDisplay::setDarkBorder(bool dark) {
if (_hibernating) return;
darkBorder = dark;
_startTransfer();
_transferCommand(0x3C); // BorderWavefrom
_transfer(dark ? 0x02 : 0x05);
_endTransfer();
}
void WatchyDisplay::clearScreen(uint8_t value) void WatchyDisplay::clearScreen(uint8_t value)
{ {
writeScreenBuffer(value); writeScreenBuffer(value);
@ -394,12 +403,12 @@ void WatchyDisplay::_InitDisplay()
_transfer(0x00); // Duration of phases, Default 0xF = 0b00 11 11 (40ms Phase 1/2, 10ms Phase 3) _transfer(0x00); // Duration of phases, Default 0xF = 0b00 11 11 (40ms Phase 1/2, 10ms Phase 3)
} }
_transferCommand(0x3C); // BorderWavefrom
_transfer(darkBorder ? 0x02 : 0x05);
_transferCommand(0x18); // Read built-in temperature sensor _transferCommand(0x18); // Read built-in temperature sensor
_transfer(0x80); _transfer(0x80);
_endTransfer(); _endTransfer();
setDarkBorder(darkBorder);
_setPartialRamArea(0, 0, WIDTH, HEIGHT); _setPartialRamArea(0, 0, WIDTH, HEIGHT);
} }

View File

@ -36,6 +36,7 @@ class WatchyDisplay : public GxEPD2_EPD
// constructor // constructor
WatchyDisplay(); WatchyDisplay();
void initWatchy(); void initWatchy();
void setDarkBorder(bool darkBorder);
static void busyCallback(const void *); static void busyCallback(const void *);
// methods (virtual) // methods (virtual)
// Support for Bitmaps (Sprites) to Controller Buffer and to Screen // Support for Bitmaps (Sprites) to Controller Buffer and to Screen