mirror of https://github.com/arendst/Tasmota.git
Merge pull request #11664 from gemu2015/lilygo_ep
add partial and full refresh
This commit is contained in:
commit
b5777aeb25
|
@ -44,10 +44,14 @@
|
||||||
|
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
|
|
||||||
int temperature;
|
int temperature = 25;
|
||||||
|
|
||||||
EpdiyHighlevelState hl;
|
EpdiyHighlevelState hl;
|
||||||
|
|
||||||
|
uint16_t Epd47::GetColorFromIndex(uint8_t index) {
|
||||||
|
return index & 0xf;
|
||||||
|
}
|
||||||
|
|
||||||
Epd47::Epd47(int16_t dwidth, int16_t dheight) : Renderer(dwidth, dheight) {
|
Epd47::Epd47(int16_t dwidth, int16_t dheight) : Renderer(dwidth, dheight) {
|
||||||
width = dwidth;
|
width = dwidth;
|
||||||
height = dheight;
|
height = dheight;
|
||||||
|
@ -63,11 +67,27 @@ int32_t Epd47::Init(void) {
|
||||||
|
|
||||||
void Epd47::DisplayInit(int8_t p, int8_t size, int8_t rot, int8_t font) {
|
void Epd47::DisplayInit(int8_t p, int8_t size, int8_t rot, int8_t font) {
|
||||||
|
|
||||||
if (p == DISPLAY_INIT_FULL) {
|
|
||||||
|
if (p == DISPLAY_INIT_MODE) {
|
||||||
epd_poweron();
|
epd_poweron();
|
||||||
epd_clear();
|
epd_clear();
|
||||||
epd_poweroff();
|
epd_poweroff();
|
||||||
}
|
}
|
||||||
|
if (p == DISPLAY_INIT_FULL) {
|
||||||
|
memset(hl.back_fb, 0xff, width * height / 2);
|
||||||
|
epd_poweron();
|
||||||
|
epd_clear();
|
||||||
|
epd_hl_update_screen(&hl, MODE_GC16, temperature);
|
||||||
|
epd_poweroff();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (p == DISPLAY_INIT_PARTIAL) {
|
||||||
|
memset(hl.back_fb, 0xff, width * height / 2);
|
||||||
|
epd_poweron();
|
||||||
|
epd_hl_update_screen(&hl, MODE_GL16, temperature);
|
||||||
|
epd_poweroff();
|
||||||
|
return;
|
||||||
|
}
|
||||||
setRotation(rot);
|
setRotation(rot);
|
||||||
setTextWrap(false);
|
setTextWrap(false);
|
||||||
cp437(true);
|
cp437(true);
|
||||||
|
@ -94,6 +114,7 @@ void Epd47::fillScreen(uint16_t color) {
|
||||||
void Epd47::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
void Epd47::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||||
uint16_t xp = x;
|
uint16_t xp = x;
|
||||||
uint16_t yp = y;
|
uint16_t yp = y;
|
||||||
|
uint8_t *buf_ptr;
|
||||||
|
|
||||||
switch (getRotation()) {
|
switch (getRotation()) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -107,14 +128,13 @@ uint16_t yp = y;
|
||||||
case 3:
|
case 3:
|
||||||
_swap(xp, yp);
|
_swap(xp, yp);
|
||||||
yp = height - yp - 1;
|
yp = height - yp - 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t maxsize = width * height / 2;
|
if (xp >= width) return;
|
||||||
uint8_t *buf_ptr = &buffer[yp * width / 2 + xp / 2];
|
if (yp >= height) return;
|
||||||
if ((uint32_t)buf_ptr >= (uint32_t)buffer + maxsize) {
|
buf_ptr = &buffer[yp * width / 2 + xp / 2];
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xp % 2) {
|
if (xp % 2) {
|
||||||
*buf_ptr = (*buf_ptr & 0x0F) | (color << 4);
|
*buf_ptr = (*buf_ptr & 0x0F) | (color << 4);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||||
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
||||||
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
|
uint16_t GetColorFromIndex(uint8_t index);
|
||||||
private:
|
private:
|
||||||
uint16_t width;
|
uint16_t width;
|
||||||
uint16_t height;
|
uint16_t height;
|
||||||
|
|
|
@ -53,7 +53,7 @@ void EpdInitDriver47(void) {
|
||||||
epd47->Init();
|
epd47->Init();
|
||||||
|
|
||||||
renderer = epd47;
|
renderer = epd47;
|
||||||
renderer->DisplayInit(DISPLAY_INIT_FULL, Settings.display_size, Settings.display_rotate, Settings.display_font);
|
renderer->DisplayInit(DISPLAY_INIT_MODE, Settings.display_size, Settings.display_rotate, Settings.display_font);
|
||||||
renderer->setTextColor(EPD47_BLACK, EPD47_WHITE);
|
renderer->setTextColor(EPD47_BLACK, EPD47_WHITE);
|
||||||
|
|
||||||
#ifdef SHOW_SPLASH
|
#ifdef SHOW_SPLASH
|
||||||
|
@ -98,4 +98,4 @@ bool Xdsp16(uint8_t function)
|
||||||
|
|
||||||
#endif // USE_LILYGO47
|
#endif // USE_LILYGO47
|
||||||
#endif // USE_DISPLAY
|
#endif // USE_DISPLAY
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
Loading…
Reference in New Issue