mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
fixed AioPinsReader's main loop
This commit is contained in:
parent
1e6ab4672f
commit
5464bc2297
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user