Bugfixes for display
This commit is contained in:
parent
c49d17e482
commit
2b27d18248
2 changed files with 51 additions and 6 deletions
|
@ -51,16 +51,49 @@ void WatchyDisplayBase::writeScreenBuffer(uint8_t value)
|
||||||
|
|
||||||
_initial_write = false;
|
_initial_write = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_startTransfer();
|
||||||
|
TransferCommand(0x24);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
|
||||||
|
_transfer(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyDisplayBase::writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
_endTransfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplayBase::writeScreenBufferAgain(uint8_t value)
|
||||||
{
|
{
|
||||||
if (_initial_write) {
|
|
||||||
if (!_using_partial_mode) {
|
if (!_using_partial_mode) {
|
||||||
InitPart();
|
InitPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
writeScreenBuffer(0x24); // initial full screen buffer clean
|
_startTransfer();
|
||||||
|
TransferCommand(0x24);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
|
||||||
|
_transfer(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
_endTransfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplayBase::writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
writeImageInternal(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplayBase::writeImageInternal(uint8_t command, const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
if (_initial_write) {
|
||||||
|
_startTransfer();
|
||||||
|
TransferCommand(0x24);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < uint32_t(WIDTH) * uint32_t(HEIGHT) / 8; i++) {
|
||||||
|
_transfer(0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
_endTransfer();
|
||||||
_initial_write = false;
|
_initial_write = false;
|
||||||
}
|
}
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
|
@ -117,6 +150,12 @@ void WatchyDisplayBase::writeImage(const uint8_t * bitmap, int16_t x, int16_t y,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchyDisplayBase::writeImageForFullRefresh(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
|
{
|
||||||
|
writeImageInternal(0x26, bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
writeImageInternal(0x24, bitmap, x, y, w, h, invert, mirror_y, pgm);
|
||||||
|
}
|
||||||
|
|
||||||
// screen refresh from controller memory, partial screen
|
// screen refresh from controller memory, partial screen
|
||||||
void WatchyDisplayBase::writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
void WatchyDisplayBase::writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert, bool mirror_y, bool pgm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,9 @@ public:
|
||||||
|
|
||||||
// init controller memory (default white)
|
// init controller memory (default white)
|
||||||
void writeScreenBuffer(uint8_t value = 0xFF) override;
|
void writeScreenBuffer(uint8_t value = 0xFF) override;
|
||||||
|
void writeScreenBufferAgain(uint8_t value = 0xFF) override;
|
||||||
void writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
|
void writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
|
||||||
|
void writeImageForFullRefresh(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
|
||||||
|
|
||||||
// screen refresh from controller memory, partial screen
|
// screen refresh from controller memory, partial screen
|
||||||
void writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
|
void writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override;
|
||||||
|
@ -40,6 +42,8 @@ private:
|
||||||
static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us
|
static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us
|
||||||
static const bool darkBorder = false;
|
static const bool darkBorder = false;
|
||||||
|
|
||||||
|
void writeImageInternal(uint8_t command, const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
|
||||||
|
|
||||||
void InitFull();
|
void InitFull();
|
||||||
void InitPart();
|
void InitPart();
|
||||||
void InitDisplay();
|
void InitDisplay();
|
||||||
|
@ -48,3 +52,5 @@ private:
|
||||||
void TransferCommand(uint8_t value);
|
void TransferCommand(uint8_t value);
|
||||||
void SetPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
void SetPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef GxEPD2_BW<WatchyDisplayBase, WatchyDisplayBase::HEIGHT> WatchyDisplay;
|
Loading…
Reference in a new issue