Added functions get and is for darkMode

pull/264/head
Elías A. Angulo Klein 2024-07-05 19:22:12 +02:00
parent 2b1679446c
commit 4aecc1599b
2 changed files with 25 additions and 3 deletions

View File

@ -50,15 +50,35 @@ void WatchyDisplay::asyncPowerOn() {
} }
} }
void WatchyDisplay::setDarkBorder(bool dark) { void WatchyDisplay::drawDarkBorder(bool dark) {
if (_hibernating) return; if (_hibernating) return;
darkBorder = dark; //This line overrides the intended behaviour that I want for the
//darkBorder variable. I want to set the darkBorder variable to dark
//and then paint the border always dark, not always putting the opposite
//colour of the background, like it is done here.
//darkBorder = dark;
_startTransfer(); _startTransfer();
_transferCommand(0x3C); // BorderWavefrom _transferCommand(0x3C); // BorderWavefrom
_transfer(dark ? 0x02 : 0x05); _transfer(dark ? 0x02 : 0x05);
_endTransfer(); _endTransfer();
} }
/*
This is a setter for the darkBorder variable. It sets the darkBorder.
*/
void WatchyDisplay::setDarkBorder(bool dark) {
if (_hibernating) return;
darkBorder = dark;
drawDarkBorder(dark);
}
/*
This is a getter for the darkBorder variable. It returns the darkBorder.
*/
bool WatchyDisplay::isDarkBorder() {
return darkBorder;
}
void WatchyDisplay::clearScreen(uint8_t value) void WatchyDisplay::clearScreen(uint8_t value)
{ {
writeScreenBuffer(value); writeScreenBuffer(value);

View File

@ -38,7 +38,9 @@ class WatchyDisplay : public GxEPD2_EPD
// constructor // constructor
WatchyDisplay(); WatchyDisplay();
void initWatchy(); void initWatchy();
void drawDarkBorder(bool darkBorder);
void setDarkBorder(bool darkBorder); void setDarkBorder(bool darkBorder);
bool isDarkBorder();
void asyncPowerOn(); void asyncPowerOn();
void _PowerOnAsync(); void _PowerOnAsync();
bool waitingPowerOn = false; bool waitingPowerOn = false;
@ -76,7 +78,7 @@ class WatchyDisplay : public GxEPD2_EPD
void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time void powerOff(); // turns off generation of panel driving voltages, avoids screen fading over time
void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0) void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
bool darkBorder = false; // adds a dark border outside the normal screen area bool darkBorder = true; // adds a dark border outside the normal screen area
static constexpr bool reduceBoosterTime = true; // Saves ~200ms static constexpr bool reduceBoosterTime = true; // Saves ~200ms
private: private: