Skip to content

Commit d079d04

Browse files
committed
fix null touch handle
1 parent f15ab3f commit d079d04

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

platforms/tab5/components/m5stack_tab5/m5stack_tab5.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,18 +1562,16 @@ static lv_display_t* bsp_display_lcd_init(const bsp_display_cfg_t* cfg)
15621562
return lvgl_port_add_disp_dsi(&disp_cfg, &dpi_cfg);
15631563
}
15641564

1565-
static esp_lcd_touch_handle_t _touch_handle;
1565+
esp_lcd_touch_handle_t _lcd_touch_handle;
15661566

15671567
esp_lcd_touch_handle_t bsp_display_get_touch_handle(void)
15681568
{
1569-
return _touch_handle;
1569+
return _lcd_touch_handle;
15701570
}
15711571

1572-
esp_lcd_touch_handle_t _lcd_touch_handle;
1573-
15741572
static void lvgl_read_cb(lv_indev_t* indev, lv_indev_data_t* data)
15751573
{
1576-
if (_touch_handle == NULL) {
1574+
if (_lcd_touch_handle == NULL) {
15771575
data->state = LV_INDEV_STATE_REL;
15781576
return;
15791577
}
@@ -1583,9 +1581,9 @@ static void lvgl_read_cb(lv_indev_t* indev, lv_indev_data_t* data)
15831581
uint16_t touch_strength[1];
15841582
uint8_t touch_cnt = 0;
15851583

1586-
esp_lcd_touch_read_data(_touch_handle);
1584+
esp_lcd_touch_read_data(_lcd_touch_handle);
15871585
bool touchpad_pressed =
1588-
esp_lcd_touch_get_coordinates(_touch_handle, touch_x, touch_y, touch_strength, &touch_cnt, 1);
1586+
esp_lcd_touch_get_coordinates(_lcd_touch_handle, touch_x, touch_y, touch_strength, &touch_cnt, 1);
15891587

15901588
if (!touchpad_pressed) {
15911589
data->state = LV_INDEV_STATE_REL;
@@ -1602,7 +1600,7 @@ static lv_indev_t* bsp_display_indev_init(lv_display_t* disp)
16021600
BSP_ERROR_CHECK_RETURN_NULL(bsp_touch_new(NULL, &tp));
16031601
esp_lcd_touch_exit_sleep(tp); // !!!
16041602
assert(tp);
1605-
_touch_handle = tp;
1603+
_lcd_touch_handle = tp;
16061604

16071605
disp_indev = lv_indev_create();
16081606
lv_indev_set_type(disp_indev, LV_INDEV_TYPE_POINTER);

0 commit comments

Comments
 (0)