mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 17:20:30 +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)
|
self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)
|
||||||
|
|
||||||
while not self.__stop_event.is_set():
|
while not self.__stop_event.is_set():
|
||||||
ev_lines = lines.event_wait(10)
|
ev_lines = lines.event_wait(1)
|
||||||
if ev_lines:
|
if ev_lines:
|
||||||
for ev_lines in lines.event_wait(1):
|
for ev_line in ev_lines:
|
||||||
for ev_line in ev_lines:
|
event = ev_line.event_read()
|
||||||
event = ev_line.event_read()
|
if event.type == gpiod.LineEvent.RISING_EDGE:
|
||||||
if event.type == gpiod.LineEvent.RISING_EDGE:
|
value = True
|
||||||
value = True
|
elif event.type == gpiod.LineEvent.FALLING_EDGE:
|
||||||
elif event.type == gpiod.LineEvent.FALLING_EDGE:
|
value = False
|
||||||
value = False
|
else:
|
||||||
else:
|
raise RuntimeError(f"Invalid event {event} type: {event.type}")
|
||||||
raise RuntimeError(f"Invalid event {event} type: {event.type}")
|
self.__state[event.source.offset()] = value
|
||||||
self.__state[event.source.offset()] = value
|
self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)
|
||||||
self.__loop.call_soon_threadsafe(self.__notifier.notify_sync)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user