How can I change the timing of a long press for a LVGL button?

Sorry I tried to figure it out from the documentation, but I don’t see any examples.
Thanks!

Isn’t it dealt with here? LVGL Graphics — ESPHome

I don’t think there is a setting for this in ESPhome.

Looks like the default is only 400ms. What did you want to set it to?

I guess you could use a lamda. I’m not 100% sure where this would go.

  lv_indev_set_long_press_time(LV_INDEV_STATE_PR, 1000); // Set long press time to 1000ms
1 Like

Thanks for the replies, I realized I don’t have access to this control because I have been dipping my feet into using ha deck, I will have to try going direct, if I can figure out the right board/driver combo. Thanks!

An I mistaken about what this does then?

long_press_time (Optional, Time): For the touchscreen, delay after which the on_long_pressed interaction trigger will be called. Defaults to 400ms.

sorry to resurrect an old thread - where does this bit of code actually go?

In the touchscreen or encoder config.

I’ve been using the on_press_long action in ESPHome, and it’s working well for me. However, I’d like to adjust the time duration before it triggers. I’ve followed the documentation to do so, but whenever I make changes, I’m getting unexpected results:

[long_press_time] is an invalid option for [touchscreen.gt911]

I have it defined under “touchscreens”:

  touchscreens:
    - touchscreen_id: my_touchscreen
      long_press_time: 200ms

Hi, thanks!

I have this touchscreen config:

touchscreen:
  platform: gt911
  id: my_touch
  interrupt_pin: GPIO4
  update_interval: 16ms

And this lvgl config:

lvgl:
  displays: my_display
  touchscreens: my_touch
  buffer_size: 20%
  color_depth: 16
  log_level: DEBUG

For some reason, I’ve tried adding the long_press_time: 1000ms reference in each, but it keeps throwing an error. Not sure what I’m doing wrong.

under “lvgl” add “touchscreens” and “long press time”:

lvgl:
  displays: my_display
  touchscreens: my_touch
  buffer_size: 20%
  color_depth: 16
  log_level: DEBUG
  touchscreens:
    - touchscreen_id: my_touchscreen
      long_press_time: 1000ms

Thanks again. I’m definitely going to have to take a closer look at my yaml, as there’s definitely something funky going on. Even the helper does not recognise long_press_time:.