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

Try loading default values from config

parent 7be1aded
No related branches found
No related tags found
1 merge request!433Simple Menu
......@@ -6,9 +6,22 @@ import time
import config
TIMEOUT = 0x100
LONG_PRESS_MS = 1000
RETRIGGER_MS = 250
try:
LONG_PRESS_MS = int(config.get_string("long_press_ms"))
except OSError:
pass
try:
RETRIGGER_MS = int(config.get_string("retrigger_ms"))
except OSError:
pass
""":py:func:`~simple_menu.button_events` timeout marker."""
def button_events(timeout=None, long_press_ms = 1000, retrigger_ms = 250):
def button_events(timeout=None, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS):
"""
Iterate over button presses (event-loop).
......@@ -316,7 +329,7 @@ class Menu:
self.disp.update()
def run(self, long_press_ms = 1000, retrigger_ms = 250):
def run(self, long_press_ms = LONG_PRESS_MS, retrigger_ms = RETRIGGER_MS):
"""Start the event-loop."""
try:
timeout = self.scroll_speed
......
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