What do you want to achieve?
Solve the freezing problem, when i keep scrolling up and down the screen, eventually it’ll freeze. I’m using the gesture event to do the scrolling.
What have you tried so far?
Several code changes, but none of them solves
Code to reproduce
/*You code here*/
static void on_screen_loaded(lv_event_t *e)
{
s_switching = false;
}
static void scroll_down_event(lv_event_t *e)
{
if (s_switching)
return;
lv_indev_t *indev = lv_event_get_indev(e);
if (!indev)
return;
if (lv_event_get_code(e) != LV_EVENT_GESTURE)
return;
lv_dir_t dir = lv_indev_get_gesture_dir(indev);
if (dir == LV_DIR_BOTTOM)
{
s_switching = true;
lv_scr_load_anim(scr_settings, LV_SCR_LOAD_ANIM_MOVE_BOTTOM, 300, 0, false);
}
}
static void scroll_up_event(lv_event_t *e)
{
if (s_switching)
return;
lv_indev_t *indev = lv_event_get_indev(e);
if (!indev)
return;
if (lv_event_get_code(e) != LV_EVENT_GESTURE)
return;
lv_dir_t dir = lv_indev_get_gesture_dir(indev);
if (dir == LV_DIR_TOP)
{
lv_scr_load_anim(scr_main, LV_SCR_LOAD_ANIM_MOVE_TOP, 300, 0, false);
}
}
.
.
.
void ui()
{
.
.
.
lv_scr_load(scr_main);
lv_obj_add_event_cb(scr_main, scroll_down_event, LV_EVENT_GESTURE, NULL);
lv_obj_add_event_cb(scr_settings, scroll_up_event, LV_EVENT_GESTURE, NULL);
lv_obj_add_event_cb(scr_main, on_screen_loaded, LV_EVENT_SCREEN_LOADED, NULL);
lv_obj_add_event_cb(scr_settings, on_screen_loaded, LV_EVENT_SCREEN_LOADED, NULL);
}
Screenshot and/or video
Environment
- MCU/MPU/Board: ESP32S3
- LVGL version: See
lv_version.h
- v8.4