Gt911 touch controller not function

I am using esp32-s3 interface with lvgl but it cannot work I am using this GitHub provided: https://github.com/limpens/esp32-8048S043/blob/main/main/lcd.cpp#L275

my display specification:
IDE: PlatformIO idf framework
display driver: ili9488
touch controller: GT911
size: 320*480

#define LCD_H_RES 320
#define LCD_V_RES 480

//
// min / max determined by printing x/y coordinates while pressing different locations on the display
// can be reproduced by printing the numbers in process_coordinates before calling the map function
//
#define TOUCH_H_RES_MIN 0
#define TOUCH_H_RES_MAX 477
#define TOUCH_V_RES_MIN 0
#define TOUCH_V_RES_MAX 269

esp_err_t InitI2C(void)
{
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = TOUCH_PIN_SDA,
.scl_io_num = TOUCH_PIN_SCL,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master
{
.clk_speed = TOUCH_FREQ_HZ,
},
.clk_flags = I2C_SCLK_SRC_FLAG_FOR_NOMAL
};

ESP_LOGI(TAG, “Initializing I2C”);

i2c_param_config(i2c_master_port, &conf);
return i2c_driver_install(i2c_master_port, conf.mode, 0, 0, 0);
}

uint16_t map(uint16_t n, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max)
{
return (n - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

void process_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num)
{
//
// in gt911_touchpad_read we ask for a single (1) measurement, so we do not loop over all points.
//
*x = map(*x, TOUCH_H_RES_MIN, TOUCH_H_RES_MAX, 0, LCD_H_RES);
*y = map(*y, TOUCH_V_RES_MIN, TOUCH_V_RES_MAX, 0, LCD_V_RES);
}

void gt911_touch_init(esp_lcd_touch_handle_t *tp)
{
esp_lcd_panel_io_handle_t tp_io_handle = nullptr;

const esp_lcd_panel_io_i2c_config_t tp_io_config = { .dev_addr = ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS,
.on_color_trans_done = nullptr,
.user_ctx = nullptr,
.control_phase_bytes = 1,
.dc_bit_offset = 0,
.lcd_cmd_bits = 16,
.lcd_param_bits = 0,
.flags = {
.dc_low_on_data = 0,
.disable_control_phase = 1,
} };

const esp_lcd_touch_config_t tp_cfg = {
.x_max = LCD_H_RES,
.y_max = LCD_V_RES,
.rst_gpio_num = TOUCH_PIN_RESET,
.int_gpio_num = TOUCH_PIN_INT,
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 0,
.mirror_x = 0,
.mirror_y = 0,
},
.process_coordinates = process_coordinates, // callback to fix coordinates between gt911 and display
.interrupt_callback = nullptr
};

ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)i2c_master_port, &tp_io_config, &tp_io_handle));
ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, tp));
}

static void gt911_touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
auto tp = (esp_lcd_touch_handle_t)indev_drv->user_data;
assert(tp);

uint16_t touchpad_x;
uint16_t touchpad_y;
uint8_t touchpad_cnt = 0;

esp_lcd_touch_read_data(tp);

bool touchpad_pressed = esp_lcd_touch_get_coordinates(tp, &touchpad_x, &touchpad_y, nullptr, &touchpad_cnt, 1);
if (touchpad_pressed && touchpad_cnt > 0)
{
data->point.x = touchpad_x;
data->point.y = touchpad_y;
data->state = LV_INDEV_STATE_PRESSED;
}
else
{
data->state = LV_INDEV_STATE_RELEASED;
}
}

void initlvlg()
{ //
// setup/configure input device:
//
ESP_ERROR_CHECK(InitI2C());
gt911_touch_init(&tp);

// Register a touchpad input device
lv_indev_drv_init(&indev_drv_tp);
indev_drv_tp.type = LV_INDEV_TYPE_POINTER;
indev_drv_tp.read_cb = gt911_touchpad_read;
indev_drv_tp.user_data = tp;

xGuiSemaphore = xSemaphoreCreateMutex();

if (lv_indev_drv_register(&indev_drv_tp))
{
xTaskCreatePinnedToCore(&lvUpdateTask, “lv_update”, 4096, nullptr, tskIDLE_PRIORITY, &g_lvgl_task_handle, 1);
return ESP_OK;
}

return ESP_FAIL;
}

I had issues a while back with the GT911. In my case it was the hardware, the chip can have 2 address, but the line to set them was not connected. So it varied randomly. I was using the TAMC lib and in the setup had to check which one it was on. Not sure if this is the same issue.

void TAMC_GT911::checkCorrectAddr(void) {
//Need to solve floating INT pin so on reset changes between the 2 addresses
  uint8_t returnSize;
  Wire.beginTransmission(addr);
  Wire.write(highByte(GT911_PRODUCT_ID));
  Wire.write(lowByte(GT911_PRODUCT_ID));
  Wire.endTransmission();
  returnSize = Wire.requestFrom(addr, (uint8_t)1); //returns rxLength - if 0 we have a problem
  if (returnSize == 0) {
    addr = GT911_ADDR2;
    Serial.println ("setting address to ADDR2");
  }
}

hi i pass the initialization process but the touch not function.

Which version of LVGL are you using?

lvgl 8.3.11