Transplant LVGL 7.11.0 Touch event is abnormal

I use STM32F429 to transplant LVGL V7.11.0 version, using capacitive screen。now,The display is normal, but the touch is not normal。
Here is the transplantation part

static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
    static lv_coord_t last_x = 0;
    static lv_coord_t last_y = 0;

	  GTP_TouchProcess(); 
    /*Save the pressed coordinates and the state*/
    if(touchpad_is_pressed()) {
        
        data->state = LV_INDEV_STATE_PR;
    } else {
        data->state = LV_INDEV_STATE_REL;
    }
		touchpad_get_xy(&last_x, &last_y);
    /*Set the last pressed coordinates*/
    data->point.x = last_x;
    data->point.y = last_y;
//		printf("(last_x) = %d ,last_y = %d \r\n",data->point.x, data->point.y);
    /*Return `false` because we are not buffering and no more data to read*/
    return false;
}

I use the serial port to detect the touch value, it is displayed normally, and the value is also the correct value:
E.g:
(last_x) = 587 ,last_y = 284

Below is my function to test touch:

    static void event_handler(lv_obj_t * obj, lv_event_t event)
    {
			printf("event = %d\r\n",event);
            if(event == LV_EVENT_CLICKED) {
                    printf("Clicked\n");
            }
            else if(event == LV_EVENT_VALUE_CHANGED) {
                    printf("Toggled\n");
            }			
			
    }

    void lv_ex_btn_1(void)
    {
            lv_obj_t * label;

            lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);
            lv_obj_set_event_cb(btn1, event_handler);
            lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40);

            label = lv_label_create(btn1, NULL);
            lv_label_set_text(label, "Button");

            lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL);
            lv_obj_set_event_cb(btn2, event_handler);
            lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
            lv_btn_set_checkable(btn2, true);
            lv_btn_toggle(btn2);
            lv_btn_set_fit2(btn2, LV_FIT_NONE, LV_FIT_TIGHT);

            label = lv_label_create(btn2, NULL);
            lv_label_set_text(label, "Toggled");
    }

Its touch event is wrong。
I found through the serial port monitoring that when the touch event is pressed, it is LV_EVENT_PRESSED
When the key is released, the touch event is LV_EVENT_PRESSING

In theory it should be LV_EVENT_CLICKEDLV_EVENT_RELEASED

So, what caused it。(When touched, there are correct XY coordinate values)

sorry,it should be LV_EVENT_VALUE_CHANGED

Are the coordinates valid even when you are not touching the screen? A lot of issues like this boil down to the touch driver sending back bogus coordinates like (-1, -1) only when the screen is not being touched.

thank you for your reply。
image

I checked my touch and press judgment, it does have a problem, resulting in lastx /lasty is always -1.
I changed the judging mechanism and it already works normally。

Thanks buddy!