I'm using TFT_eSPI library to control TFT 480x320px screen with ESP32. I wanted to capture the screen, so I ran an example from TFT_eSPI and installed Proccessing etc. When I try to recieve screenshot from ESP it's tottaly broken (It has only few red dots). Any ideas? I didn't find much info about this utility.
Very little information to base an answer on.
If you're referring to File | Examples | Examples from Custom Libraries | TFT_eSPI | General | TFT_Screen_Capture, it does say
>>>> NOTE: NOT ALL TFTs SUPPORT READING THE CGRAM (pixel) MEMORY <<<<
#########################################################################
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
#########################################################################
The reading depends on how it Is configured, whether it's 24-bit RGB or 16-bit color ("565": 5-bit red, 6 green, 5 blue)
#if defined BITS_PER_PIXEL && BITS_PER_PIXEL >= 24 && NPIXELS > 1
// Fetch N RGB pixels from x,y and put in buffer
tft.readRectRGB(x, y, NPIXELS, 1, color);
// Send buffer to client
Serial.write(color, 3 * NPIXELS); // Write all pixels in the buffer
#else
// Fetch N 565 format pixels from x,y and put in buffer
if (NPIXELS > 1) tft.readRect(x, y, NPIXELS, 1, (uint16_t *)color);
else
{
uint16_t c = tft.readPixel(x, y);
color[0] = c>>8;
color[1] = c & 0xFF; // Swap bytes
}
// Send buffer to client
Serial.write(color, 2 * NPIXELS); // Write all pixels in the buffer
#endif
It calls either tft.readRectRGB
, tft.readRect
, or tft.readPixel
to read into a buffer
uint8_t color[3 * NPIXELS]; // RGB and 565 format color buffer for N pixels
So the first thing is to check if that works. Fill the screen with a few different colors. See if they are reported correctly instead of pretty much all zero (black).
If that works, then there is some issue transmitting over Serial to that Processing part.
I'm using ESP32 DEVKIT V1 and ILI9488 but I couldn't find whether TFT has CGRAM or not. Example says:
int color_bytes = 2; // 2 for 16-bit, 3 for three RGB bytes (automatic - sent by Arduino)
So it should be automatic, but I changed it and still same.
Check the values stored in the color
buffer, if any. If that's not working, then color_bytes
on the Processing side doesn't matter.