summaryrefslogtreecommitdiff
path: root/kvmd/aiogp.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
committerMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
commit7a53f1445619fc471c2823e7081de8b6039b938e (patch)
tree961dd0072cc976504fe4570743d801c79512e9a6 /kvmd/aiogp.py
parent45270a09d7b5076bac96887a1e36d752882e3adf (diff)
refactoring
Diffstat (limited to 'kvmd/aiogp.py')
-rw-r--r--kvmd/aiogp.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kvmd/aiogp.py b/kvmd/aiogp.py
index 7ebe4ade..3ee0ea2b 100644
--- a/kvmd/aiogp.py
+++ b/kvmd/aiogp.py
@@ -83,9 +83,9 @@ class AioReader: # pylint: disable=too-many-instance-attributes
self.__path,
consumer=self.__consumer,
config={tuple(pins): gpiod.LineSettings(edge_detection=gpiod.line.Edge.BOTH)},
- ) as line_request:
+ ) as line_req:
- line_request.wait_edge_events(0.1)
+ line_req.wait_edge_events(0.1)
self.__values = {
pin: _DebouncedValue(
initial=bool(value.value),
@@ -93,14 +93,14 @@ class AioReader: # pylint: disable=too-many-instance-attributes
notifier=self.__notifier,
loop=self.__loop,
)
- for (pin, value) in zip(pins, line_request.get_values(pins))
+ for (pin, value) in zip(pins, line_req.get_values(pins))
}
self.__loop.call_soon_threadsafe(self.__notifier.notify)
while not self.__stop_event.is_set():
- if line_request.wait_edge_events(1):
+ if line_req.wait_edge_events(1):
new: dict[int, bool] = {}
- for event in line_request.read_edge_events():
+ for event in line_req.read_edge_events():
(pin, value) = self.__parse_event(event)
new[pin] = value
for (pin, value) in new.items():
@@ -110,7 +110,7 @@ class AioReader: # pylint: disable=too-many-instance-attributes
# Размер буфера ядра - 16 эвентов на линии. При превышении этого числа,
# новые эвенты потеряются. Это не баг, это фича, как мне объяснили в LKML.
# Штош. Будем с этим жить и синхронизировать состояния при таймауте.
- for (pin, value) in zip(pins, line_request.get_values(pins)):
+ for (pin, value) in zip(pins, line_req.get_values(pins)):
self.__values[pin].set(bool(value.value)) # type: ignore
def __parse_event(self, event: gpiod.EdgeEvent) -> tuple[int, bool]: