Xinyuan-LilyGO / TTGO-T-Display

MIT License
991 stars 332 forks source link

Does readrect() work on this display #123

Open Chanete opened 7 months ago

Chanete commented 7 months ago

Hi, I'm trying to write a function that will blink a part of the screen using readRect to get the contents, store them, empty that part of the screen and after a while, use pushRect to re-paint that area,

it doesn't work, readrect gives me a full-of-zeroes array.

I've read that some screens doesnt support readback. Is this the case? how can I solve this issue,

Thx in advance

This is my blink code:

void blink(int x, int y, int w, int h) {
    if (!isRectBlack) {
        Serial.println("Blink");
        if (originalContent == NULL) {
            originalContent = new uint16_t[w * h];  
        }
        tft.readRect(x, y, w, h, originalContent);  
        for (int f=0; f< w*h;f++)
          Serial.print(originalContent[f]); 
        tft.fillRect(x, y, w, h, TFT_BLACK);       
        isRectBlack = true;
    } else {
        Serial.println("Recover");
        tft.pushRect(x, y, w, h, originalContent); 
        isRectBlack = false;
        delete[] originalContent;
        originalContent = NULL;
    }
}
3djc commented 4 months ago

The available lua functions is listed here : https://luadoc.edgetx.org/part_iii_-_opentx_lua_api_reference/