mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
proper set_input/set_output
This commit is contained in:
parent
9baf507453
commit
584651afba
@ -64,7 +64,7 @@ class _GpioInput:
|
||||
def __init__(self, channel: str, config: Section, reader: gpio.BatchReader) -> None:
|
||||
self.__channel = channel
|
||||
self.__title: str = config.title
|
||||
self.__pin: int = gpio.set_input(config.pin)
|
||||
self.__pin: int = config.pin # gpio.set_input(config.pin) # Configured in UserGpio/BatchReader
|
||||
self.__inverted: bool = config.inverted
|
||||
self.__reader = reader
|
||||
|
||||
@ -172,7 +172,7 @@ class UserGpio:
|
||||
def __init__(self, config: Section) -> None:
|
||||
self.__state_notifier = aiotools.AioNotifier()
|
||||
self.__reader = gpio.BatchReader(
|
||||
pins=[ch_config.pin for ch_config in config.scheme.values()],
|
||||
pins=[gpio.set_input(ch_config.pin) for ch_config in config.scheme.values()],
|
||||
interval=config.state_poll,
|
||||
notifier=self.__state_notifier,
|
||||
)
|
||||
|
||||
@ -74,7 +74,7 @@ class BatchReader:
|
||||
def __init__(self, pins: List[int], interval: float, notifier: aiotools.AioNotifier) -> None:
|
||||
self.__pins = pins
|
||||
self.__flags: Tuple[Optional[bool], ...] = (None,) * len(pins)
|
||||
self.__state = dict.fromkeys(pins, False)
|
||||
self.__state = {pin: read(pin) for pin in pins}
|
||||
|
||||
self.__interval = interval
|
||||
self.__notifier = notifier
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user