Skip to content
Snippets Groups Projects
Commit 2022ebc4 authored by Pixtxa's avatar Pixtxa
Browse files

long press was fixed to about 1-2 seconds, based on the time in seconds when...

long press was fixed to about 1-2 seconds, based on the time in seconds when the button was pressed,
now it's a variable in milliseconds with 1000 ms as default
parent e9d77a5b
No related branches found
No related tags found
1 merge request!433Simple Menu
......@@ -305,7 +305,7 @@ class Menu:
self.disp.update()
def run(self):
def run(self, long_press_ms = 1000):
"""Start the event-loop."""
try:
timeout = self.scroll_speed
......@@ -336,10 +336,10 @@ class Menu:
print("Exception during menu.on_scroll():")
sys.print_exception(e)
elif ev == self.button_select:
t0 = time.time()
t0 = time.time_ms()
long_press = False
while buttons.read(buttons.button_select) > 0:
if time.time() - t0 > 1:
if time.time_ms() - t0 > long_press_ms:
long_press = True
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment