lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.08k stars 191 forks source link

tft.getTouch(&touchX, &touchY); freeze loop() #580

Open Red-Owl opened 2 weeks ago

Red-Owl commented 2 weeks ago

Carefully written Issues are more likely to be given priority. 丁寧に記述された報告は優先して対応される可能性が高くなります。

Environment ( 実行環境 )

Problem Description ( 問題の内容 )

freeze loop() ; FT6336U I2C single touch

Expected Behavior ( 期待される動作 )

Actual Behavior ( 実際の動作 )

Steps to reproduce ( 再現のための前提条件 )

  1. step1 system works
  2. touch
  3. freeze

// If possible, attach a picture of your setup/wiring here.

Code to reproduce this issue ( 再現させるためのコード )

Please submit complete source code that can reproduce your problem.

void my_touchpad_read(lv_indev_drv_t indev_driver, lv_indev_data_t data){ uint16_t touchX, touchY; boolean touched = tft.getTouch(&touchX, &touchY); if (!touched){ data->state = LV_INDEV_STATE_REL; }else{ data->state = LV_INDEV_STATE_PR; data->point.x = touchX; data->point.y = touchY; }

// If your code is longer than 30 lines, GIST is preferred.

tobozo commented 2 weeks ago

hi,

LovyanGFX version: LovyanGFX@1.1.12

please upgrade to 1.1.16, then try with this code:


void setup()
{
  tft.init();
}

void loop()
{
  static int count = 0;
  int32_t x, y;
  if (tft.getTouch(&x, &y)) {
    count++;
    tft.fillRect(x-2, y-2, 5, 5, count*7);
  }
}