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

esp_lvgl_port Component enhancements (BSP-655) #538

Closed
1 task done
Y1hsiaochunnn opened this issue Mar 12, 2025 · 0 comments
Closed
1 task done

esp_lvgl_port Component enhancements (BSP-655) #538

Y1hsiaochunnn opened this issue Mar 12, 2025 · 0 comments
Assignees

Comments

@Y1hsiaochunnn
Copy link

Related area

esp_lvgl_port esp32_p4_function_ev_board

Hardware specification

Third party touch display and esp32_p4_function_ev_board

Is your feature request related to a problem?

I encounter in my daily development process, sometimes touch display screen touch resolution and display resolution is different; For example:
I currently have a 7 "screen with 1024600 resolution, but a touch (e.g. GT911) resolution of 800480

At this time, if I use bsp such as esp32_p4_function_ev_board to drive it, then the touch is defined in the program is 1024*600, which is beyond the resolution size of the touch firmware. At this time, a point exception will appear, resulting in a touch exception.
(You can find the definitions here:

esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t *ret_touch)
{
/* Initilize I2C */
BSP_ERROR_CHECK_RETURN_ERR(bsp_i2c_init());
/* Initialize touch */
const esp_lcd_touch_config_t tp_cfg = {
.x_max = BSP_LCD_H_RES,
.y_max = BSP_LCD_V_RES,
.rst_gpio_num = BSP_LCD_TOUCH_RST, // Shared with LCD reset
.int_gpio_num = BSP_LCD_TOUCH_INT,
.levels = {
.reset = 0,
.interrupt = 0,
},
.flags = {
.swap_xy = 0,
#if CONFIG_BSP_LCD_TYPE_1024_600
.mirror_x = 1,
.mirror_y = 1,
#else
.mirror_x = 0,
.mirror_y = 0,
#endif
},
};
esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
tp_io_config.scl_speed_hz = CONFIG_BSP_I2C_CLK_SPEED_HZ;
ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, "");
return esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, ret_touch);
}
)

If I change the touch resolution defined in the bsp mentioned above to 800480, it will not map properly to 1024600 display resolution. This problem occurs in the lvgl touch function in esp_lvgl_port (you can see it here, where the lvgl v8, The same is true for the lvgl v9.

static void lvgl_port_touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
assert(indev_drv);
lvgl_port_touch_ctx_t *touch_ctx = (lvgl_port_touch_ctx_t *)indev_drv->user_data;
assert(touch_ctx->handle);
uint16_t touchpad_x[1] = {0};
uint16_t touchpad_y[1] = {0};
uint8_t touchpad_cnt = 0;
/* Read data from touch controller into memory */
esp_lcd_touch_read_data(touch_ctx->handle);
/* Read data from touch controller */
bool touchpad_pressed = esp_lcd_touch_get_coordinates(touch_ctx->handle, touchpad_x, touchpad_y, NULL, &touchpad_cnt, 1);
if (touchpad_pressed && touchpad_cnt > 0) {
data->point.x = touchpad_x[0];
data->point.y = touchpad_y[0];
data->state = LV_INDEV_STATE_PRESSED;
} else {
data->state = LV_INDEV_STATE_RELEASED;
}
}
)

So is it possible to add a function that allows me to zoom in on the point map by passing in different resolutions?

Describe the solution you'd like

I thought it would be possible to add a function with the same name and let me pass in a different function value for the coordinate magnification function

Describe alternatives you've considered

Image

While I extracted the components and zooming in, this worked fine, but it was a bit redundant and would take a long time for many screen and touch resolutions

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@github-actions github-actions bot changed the title esp_lvgl_port Component enhancements esp_lvgl_port Component enhancements (BSP-655) Mar 12, 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

2 participants