Description
What MCU/Processor/Board and compiler are you using?
- ESP32-S3 SC01 Plus
- Esp-Arduino
- LovyanGFX
- Touch_FT5x06
What LVGL version are you using?
9.0.0-dev
What do you want to achieve?
Detect left/right swipe on the screen (to move to the next screen).
What have you tried so far?
Implemented swipe detection from here How to create a swipe left/right event
Code to reproduce
void scr_event_cb(lv_event_t *e)
{
if (i++ < 150 || lv_event_get_code(e) > 18)
return;
Serial.printf("Got screen event %d\n", lv_event_get_code(e));
if (lv_event_get_code(e) == LV_EVENT_GESTURE)
{
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
Serial.printf("Dir %d\n", dir);
for (size_t i = 255; i > 0; i = i - 5)
{
setBL(i);
delay(3);
}
for (size_t i = 0; i < 255; i = i + 5)
{
setBL(i);
delay(3);
}
}
// ingesture=millis()+300;
}
void ui_init(void)
{
...
lv_obj_add_event_cb(lv_scr_act(), scr_event_cb, LV_EVENT_ALL, NULL);
}
Issue
Most of the swipe are detected correctly, just that, when I swipe fast (the normal speed on a mobile phone I would say), I would sometime not get a LV_EVENT_GESTURE
event, only the other normal events like LV_EVENT_PRESSED
, LV_EVENT_FOCUSED
, LV_EVENT_DEFOCUSED
of the elements I swipe over.
When I swipe more gently, I always get the LV_EVENT_GESTURE
. Is there a max velocity somewhere, or a refresh rate I should increase?
Sidenote: I discovered LVGL few weeks ago, thanks for this awesome work!