mirror of https://github.com/arendst/Tasmota.git
display support for larger pictures
This commit is contained in:
parent
ff631ac322
commit
0b12c6a514
|
@ -1579,7 +1579,7 @@ void Adafruit_GFX_Button::initButtonUL(
|
||||||
strncpy(_label, label, 9);
|
strncpy(_label, label, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, bool inverted);
|
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, uint32_t ocolor, bool inverted);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
|
@ -1601,8 +1601,7 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_label[0]=='/') {
|
if (_label[0]=='/') {
|
||||||
// picture path
|
draw_picture(_label, _x1, _y1, _w, _h, outline, inverted);
|
||||||
draw_picture(_label, _x1, _y1, _w, _h, inverted);
|
|
||||||
_gfx->drawRect(_x1, _y1, _w, _h, text);
|
_gfx->drawRect(_x1, _y1, _w, _h, text);
|
||||||
} else {
|
} else {
|
||||||
uint8_t r = min(_w, _h) / 4; // Corner radius
|
uint8_t r = min(_w, _h) / 4; // Corner radius
|
||||||
|
|
|
@ -514,7 +514,7 @@ void SSD1351::setAddrWindow(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
||||||
if (flag) stop();
|
if (flag) stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSD1351::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void SSD1351::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
for (uint16_t b=0; b<len; b++){
|
for (uint16_t b=0; b<len; b++){
|
||||||
write16BitColor(*data++);
|
write16BitColor(*data++);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SSD1351 : public Renderer {
|
||||||
void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font);
|
void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font);
|
||||||
void setAddrWindow_i(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
void setAddrWindow_i(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 setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
||||||
void pushColors(uint16_t *data, uint8_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||||
void write16BitColor(uint16_t color);
|
void write16BitColor(uint16_t color);
|
||||||
void setRotation(uint8_t r);
|
void setRotation(uint8_t r);
|
||||||
|
|
|
@ -611,7 +611,7 @@ void Arduino_ST7789::pushColor(uint16_t color) {
|
||||||
SPI_END_TRANSACTION();
|
SPI_END_TRANSACTION();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arduino_ST7789::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void Arduino_ST7789::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
|
|
||||||
SPI_BEGIN_TRANSACTION();
|
SPI_BEGIN_TRANSACTION();
|
||||||
|
|
|
@ -152,7 +152,7 @@ class Arduino_ST7789 : public Renderer {
|
||||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return Color565(r, g, b); }
|
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return Color565(r, g, b); }
|
||||||
void DisplayOnff(int8_t on);
|
void DisplayOnff(int8_t on);
|
||||||
void dim(uint8_t contrast);
|
void dim(uint8_t contrast);
|
||||||
void pushColors(uint16_t *data, uint8_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t _colstart, _rowstart, _xstart, _ystart; // some displays need this changed
|
uint8_t _colstart, _rowstart, _xstart, _ystart; // some displays need this changed
|
||||||
|
|
|
@ -292,7 +292,7 @@ void ILI9341_2::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ILI9341_2::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void ILI9341_2::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
|
|
||||||
while (len--) {
|
while (len--) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ class ILI9341_2 : public Renderer {
|
||||||
void fillScreen(uint16_t color);
|
void fillScreen(uint16_t color);
|
||||||
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||||
void dim(uint8_t dim);
|
void dim(uint8_t dim);
|
||||||
void pushColors(uint16_t *data, uint8_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
void invertDisplay(boolean i);
|
void invertDisplay(boolean i);
|
||||||
void spiwrite(uint8_t c);
|
void spiwrite(uint8_t c);
|
||||||
void spiwrite16(uint16_t c);
|
void spiwrite16(uint16_t c);
|
||||||
|
|
|
@ -605,7 +605,7 @@ void ILI9488::pushColor(uint16_t color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
void ILI9488::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void ILI9488::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
uint8_t buff[len*3+1];
|
uint8_t buff[len*3+1];
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
|
|
|
@ -141,7 +141,7 @@ class ILI9488 : public Renderer {
|
||||||
void setScrollArea(uint16_t topFixedArea, uint16_t bottomFixedArea);
|
void setScrollArea(uint16_t topFixedArea, uint16_t bottomFixedArea);
|
||||||
void scroll(uint16_t pixels);
|
void scroll(uint16_t pixels);
|
||||||
void pushColor(uint16_t color);
|
void pushColor(uint16_t color);
|
||||||
void pushColors(uint16_t *data, uint8_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
//void drawImage(const uint8_t* img, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
//void drawImage(const uint8_t* img, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||||
void fillScreen(uint16_t color);
|
void fillScreen(uint16_t color);
|
||||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||||
|
|
|
@ -932,18 +932,28 @@ void RA8876::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
|
||||||
SPI.endTransaction();
|
SPI.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RA8876::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void RA8876::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
SPI.beginTransaction(m_spiSettings);
|
SPI.beginTransaction(m_spiSettings);
|
||||||
|
//RA8876_CS_LOW
|
||||||
while (len--) {
|
while (len--) {
|
||||||
|
|
||||||
//uint16_t color=RA8876_WHITE;
|
|
||||||
uint16_t color=*data++;
|
uint16_t color=*data++;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
SPI.transfer(RA8876_DATA_WRITE);
|
||||||
|
SPI.transfer(color&0xff);
|
||||||
|
SPI.transfer(RA8876_DATA_WRITE);
|
||||||
|
SPI.transfer(color>>8);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
//waitWriteFifo();
|
//waitWriteFifo();
|
||||||
writeData(color&0xff);
|
writeData(color&0xff);
|
||||||
//waitWriteFifo();
|
//waitWriteFifo();
|
||||||
writeData(color>>8);
|
writeData(color>>8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
//RA8876_CS_HIGH
|
||||||
SPI.endTransaction();
|
SPI.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -472,7 +472,7 @@ class RA8876 : public Renderer {
|
||||||
int getCursorY(void);
|
int getCursorY(void);
|
||||||
|
|
||||||
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, uint8_t len, boolean first);
|
void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
void selectInternalFont(enum FontSize size, enum FontEncoding enc = RA8876_FONT_ENCODING_8859_1);
|
void selectInternalFont(enum FontSize size, enum FontEncoding enc = RA8876_FONT_ENCODING_8859_1);
|
||||||
|
|
|
@ -66,7 +66,7 @@ void Renderer::dim(uint8_t contrast) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::pushColors(uint16_t *data, uint8_t len, boolean first) {
|
void Renderer::pushColors(uint16_t *data, uint16_t len, boolean first) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
virtual void Begin(int16_t p1,int16_t p2,int16_t p3);
|
virtual void Begin(int16_t p1,int16_t p2,int16_t p3);
|
||||||
virtual void Updateframe();
|
virtual void Updateframe();
|
||||||
virtual void dim(uint8_t contrast);
|
virtual void dim(uint8_t contrast);
|
||||||
virtual void pushColors(uint16_t *data, uint8_t len, boolean first);
|
virtual void pushColors(uint16_t *data, uint16_t len, boolean first);
|
||||||
virtual void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
virtual void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
||||||
virtual void invertDisplay(boolean i);
|
virtual void invertDisplay(boolean i);
|
||||||
void setDrawMode(uint8_t mode);
|
void setDrawMode(uint8_t mode);
|
||||||
|
|
|
@ -1543,7 +1543,7 @@ void CmndDisplayRows(void)
|
||||||
|
|
||||||
#ifdef USE_TOUCH_BUTTONS
|
#ifdef USE_TOUCH_BUTTONS
|
||||||
// very limited path size, so, add .jpg
|
// very limited path size, so, add .jpg
|
||||||
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, bool inverted) {
|
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, uint32_t ocol, bool inverted) {
|
||||||
char ppath[16];
|
char ppath[16];
|
||||||
strcpy(ppath, path);
|
strcpy(ppath, path);
|
||||||
uint8_t plen = strlen(path) -1;
|
uint8_t plen = strlen(path) -1;
|
||||||
|
@ -1554,7 +1554,11 @@ char ppath[16];
|
||||||
}
|
}
|
||||||
inverted = false;
|
inverted = false;
|
||||||
}
|
}
|
||||||
strcat(ppath, ".jpg");
|
if (ocol == 9) {
|
||||||
|
strcat(ppath, ".rgb");
|
||||||
|
} else {
|
||||||
|
strcat(ppath, ".jpg");
|
||||||
|
}
|
||||||
Draw_RGB_Bitmap(ppath, xp, yp, inverted);
|
Draw_RGB_Bitmap(ppath, xp, yp, inverted);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue