loboris / ESP32_TFT_library

Full featured TFT library for ESP32 with demo application
553 stars 219 forks source link

TFT_print() problem after TFT_read_touch() call #52

Open chrdan opened 5 years ago

chrdan commented 5 years ago

With TOUCH_TYPE_XPT2046 activated after calling TFT_read_touch() the TFT_print() command shows the first character of the given string crippled, which means the left and right part of that single character are swapped (for example an "O" changes from "()" to ")("), and its foreground color also isn't set correctly.

To get that result insert

  TFT_print("O_Untouched", CENTER, 80);
  vTaskDelay(10000 / portTICK_RATE_MS);

in tft_demo.c after line 996:

  if (TFT_read_touch(&tx, &ty, 0)) {
  ...
  }
  else {
    TFT_print("O_Untouched", CENTER, 80); // added
    vTaskDelay(10000 / portTICK_RATE_MS); // added
    doexit++;

Is there a display reinitialization problem after switching devices (disp_spi -> ts_spi -> disp_spi)?

Nice library, btw!

TIA

Chris

viethoangitvn commented 5 years ago

Hi Chris, I am using ILI9341 and an NFC Reader that share the same SPI bus of ESP ( different CS pins) and can see same problem. Did you find the reason of this issue?

Thank you, Viet Hoang.

chrdan commented 5 years ago

Hi Viet,

before integrating this library into my AquariOS project (https://danner-net.de/ao.htm) in order to control an ILI9341/XPT2046 device, I had to fix minor bugs in _direct_send(), readPixel() and _drawLine() and rewrite touch_get_data() and TFT_read_touch_xpt2046().

What I still experience is a wrong background color of the first character that's drawn with TFT_print() after switching from ts_spi to disp_spi, which I wasn't able to sort out. That's why I have to do a dummy "TFT_print( " ", x, y);" between polling the touch device and intended TFT_print() calls, which as a side effect only causes a hardly noticeable flicker. Nevertheless it would be nice to get that fixed.

Kind regards

Chris

sieren commented 5 years ago

@chrdan do you mind posting your touch rewrites somewhere? I'm running into the same issue apparently.

mekkoli commented 2 years ago

same problem for me with XPT2046 and loboris great library. anyone has solved this issue ? @chrdan have you posted anywhere your solution ?