Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[esp32-p4] esp_lcd_touch_gt911_read_data false positive release reports (BSP-633) #501

Open
chegewara opened this issue Feb 3, 2025 · 0 comments

Comments

@chegewara
Copy link

chegewara commented Feb 3, 2025

Hi team,
there is small issue with false positive release report with lvgl on esp32-p4 (and probably all boards with GT911).
It is because driver does not follow programming guide

[0x814E]:
Bit7: Buffer status, 1 = coordinate (or key) is ready for host to read; 0 = coordinate (or key) is not ready and
data is not valid. After reading coordinates, host should configure this flag (or the entire byte) to 0 via I2C.

This small change seems to work, but you may find a better solution (maybe return something else than ESP_OK instead)

static esp_err_t esp_lcd_touch_gt911_read_data(esp_lcd_touch_handle_t tp)
{
esp_err_t err;
uint8_t buf[41];
uint8_t touch_cnt = 0;
uint8_t clear = 0;
size_t i = 0;
assert(tp != NULL);
err = touch_gt911_i2c_read(tp, ESP_LCD_TOUCH_GT911_READ_XY_REG, buf, 1);
ESP_RETURN_ON_ERROR(err, TAG, "I2C read error!");
/* Any touch data? */
if ((buf[0] & 0x80) == 0x00) {
touch_gt911_i2c_write(tp, ESP_LCD_TOUCH_GT911_READ_XY_REG, clear);
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0)

    uint8_t repeat = 0;

    assert(tp != NULL);
repeat:
    err = touch_gt911_i2c_read(tp, ESP_LCD_TOUCH_GT911_READ_XY_REG, buf, 1);
    ESP_RETURN_ON_ERROR(err, TAG, "I2C read error!");

    /* Any touch data? */
    if ((buf[0] & 0x80) == 0x00) {
        // touch_gt911_i2c_write(tp, ESP_LCD_TOUCH_GT911_READ_XY_REG, clear);       <---- dont clear buffer if data has not been read and processed

    esp_rom_delay_us(3000);    <----- with shorter delay it may take up to 10 loops, so 3ms seems to be optimal
    if(repeat++ < 3)
        goto repeat;

I am using v1.1.0

Thanks

Page 15
https://www.orientdisplay.com/pdf/GT911.pdf

@github-actions github-actions bot changed the title [esp32-p4] esp_lcd_touch_gt911_read_data false positive release reports [esp32-p4] esp_lcd_touch_gt911_read_data false positive release reports (BSP-633) Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant