I have created a small (test) program to see whether I could get readRect() to work (see below)
The problem is that readRect() only returns '0' bytes. The pushImage() function works fine btw.
Am I doing something wrong? Or is this a issue in the library?
Any help would be greatly appreciated.
Coen
TTGOClass *watch;
uint16_t *screenContent = NULL;
void setup()
{
// Serial port for debugging purposes
Serial.begin(115200);
while (!Serial)
; // wait for serial attach
Serial.flush(); // Cleanup..
log_d("Total heap: %d", ESP.getHeapSize());
log_d("Free heap: %d", ESP.getFreeHeap());
log_d("Total PSRAM: %d", ESP.getPsramSize());
log_d("Free PSRAM: %d", ESP.getFreePsram());
// Alloc memory to store screen content
screenContent = (uint16_t *)ps_calloc(220 * 30, sizeof(uint16_t));
// Get Watch object and set up the display
watch = TTGOClass::getWatch();
watch->begin();
watch->openBL();
watch->tft->setSwapBytes(true);
watch->tft->pushImage(0, 0, 240, 240, Image_240x240);
// Get initial image (part)
watch->tft->readRect(10, 110, 220, 30, screenContent);
watch->tft->setTextFont(2);
watch->tft->setTextSize(2);
watch->tft->setTextColor(TFT_DARKGREEN);
watch->tft->setCursor(0, 0);
watch->tft->println("Hello T-Watch");
watch->tft->drawCentreString("-Middle-", 120, 110, 1);
}
void loop()
{
int16_t x, y;
char buf[128];
if (watch->getTouch(x, y))
{
watch->tft->pushRect(10, 110, 220, 30, screenContent);
sprintf(buf, "x:%03d y:%03d", x, y);
watch->tft->drawCentreString(buf, 120, 110, 1);
}
delay(5);
}
Hi,
I have created a small (test) program to see whether I could get
readRect()
to work (see below) The problem is thatreadRect()
only returns '0' bytes. ThepushImage()
function works fine btw.Am I doing something wrong? Or is this a issue in the library?
Any help would be greatly appreciated.
Coen