diff options
author | Devaev Maxim <[email protected]> | 2018-11-28 22:35:31 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-11-28 22:35:31 +0300 |
commit | fe4afd7623df7c54072c1b28ab90d3a547dfe231 (patch) | |
tree | a1d475ee90ec2ee5bb67eb6bbb459a20855ccab6 /kvmd | |
parent | 6c2d8900f53cca2f5e0980f8ac038566080986a9 (diff) |
non-blocking click handle
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/atx.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kvmd/apps/kvmd/atx.py b/kvmd/apps/kvmd/atx.py index 8444c097..7bf237c9 100644 --- a/kvmd/apps/kvmd/atx.py +++ b/kvmd/apps/kvmd/atx.py @@ -66,7 +66,13 @@ class Atx: # pylint: disable=too-many-instance-attributes get_logger().info("Clicked reset") async def __click(self, pin: int, delay: float) -> None: - with self.__region: + self.__region.enter() + asyncio.ensure_future(self.__inner_click(pin, delay)) + + async def __inner_click(self, pin: int, delay: float) -> None: + try: for flag in (True, False): gpio.write(pin, flag) await asyncio.sleep(delay) + finally: + self.__region.exit() |