• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Where is the definition of the "long_press_time" in the sketch

Q&A Forum › Category: ESP32 › Where is the definition of the "long_press_time" in the sketch
0 Vote Up Vote Down
mmmE asked 1 week ago

On page 103 of the LVGL-build-GUI’s course there is the sentence “LV_EVENT_LONG_PRESSED: the object has been pressed for at least long_press_time.”
I understand that with this value i can define how long to press the button on screen before it is classified as a long press.
My problem is that i can not find the “long_press_time” value in the sketch. 
 
 

4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 week ago

Hi.
That’s a great question.
 
To find out, we need to dig into the LVGL documentation:

  • https://docs.lvgl.io/master/details/main-modules/indev.html

 
From that page, if you search for “long_press_time”, we can see that to define and use the long_press_time for an input device in LVGL, you need to configure the lv_indev_t structure’s long_press_time parameter.
 
So, in the setup(), we can define that parameter after initializing the LVGL input device (after these lines):
 

// Initialize an LVGL input device object (Touchscreen)
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);

 

Since the long_press_time is a parameter of the lv_indev_t structure (now created as indev), we can set it as follows:
 

indev->long_press_time = 2000; /* Set long press time to 2000 ms */

Adjust for your desired time.
 
If you need information about any LVGL function, variable, or parameter, you just need to search for it here: 

  • https://docs.lvgl.io/master/search.html?q=long_press_time&check_keywords=yes&area=default

In this case, I’m setting the search for the long_press_time parameter.
 

I hope this helps, and I’m sorry for the delay in my response.
 
Regards,
Sara

0 Vote Up Vote Down
mmmE answered 1 week ago

Hi Sara,
Thanks for the answer. I was under the impression that the long_press_time was already inside the sketch. But now i understand i had to search the LVGL lib. Great answer. Somewhat complicated for me because i am a relative newby, but it gives me some grip.

Regards,
Martin

0 Vote Up Vote Down
mmmE answered 7 days ago

It works. Thanks.

0 Vote Up Vote Down
Sara Santos Staff answered 7 days ago

Great!
 
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 V1.6 September 9, 2025
  • [eBook Updated] Learn LVGL: Build GUIs for ESP32 Projects – Version 1.5 July 7, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.