summaryrefslogtreecommitdiff
path: root/kvmd/aiogp.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-13 19:18:12 +0300
committerDevaev Maxim <[email protected]>2020-09-13 19:18:12 +0300
commit5464bc2297e69b493b37c6dffd7fec66d55d6ad9 (patch)
treeb4d5850588c2cc7c0e6911eb89b0b81e2ecafd54 /kvmd/aiogp.py
parent1e6ab4672f0980f073ab7e1c6f48fb9bf43b0856 (diff)
fixed AioPinsReader's main loop
Diffstat (limited to 'kvmd/aiogp.py')
-rw-r--r--kvmd/aiogp.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/kvmd/aiogp.py b/kvmd/aiogp.py
index 9b515d9a..100bcd4c 100644
--- a/kvmd/aiogp.py
+++ b/kvmd/aiogp.py
@@ -93,16 +93,15 @@ class AioPinsReader(threading.Thread):
self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)
while not self.__stop_event.is_set():
- ev_lines = lines.event_wait(10)
+ ev_lines = lines.event_wait(1)
if ev_lines:
- for ev_lines in lines.event_wait(1):
- for ev_line in ev_lines:
- event = ev_line.event_read()
- if event.type == gpiod.LineEvent.RISING_EDGE:
- value = True
- elif event.type == gpiod.LineEvent.FALLING_EDGE:
- value = False
- else:
- raise RuntimeError(f"Invalid event {event} type: {event.type}")
- self.__state[event.source.offset()] = value
- self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)
+ for ev_line in ev_lines:
+ event = ev_line.event_read()
+ if event.type == gpiod.LineEvent.RISING_EDGE:
+ value = True
+ elif event.type == gpiod.LineEvent.FALLING_EDGE:
+ value = False
+ else:
+ raise RuntimeError(f"Invalid event {event} type: {event.type}")
+ self.__state[event.source.offset()] = value
+ self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)