From b73eacd23406b93aa6334fb0aadd73af864f2a6c Mon Sep 17 00:00:00 2001 From: linuswck Date: Fri, 19 Apr 2024 15:02:46 +0800 Subject: [PATCH] driver: Wait for a sec after hard rst cmd is sent --- pykirdy/driver/kirdy_async.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pykirdy/driver/kirdy_async.py b/pykirdy/driver/kirdy_async.py index aa272fc..4065f98 100644 --- a/pykirdy/driver/kirdy_async.py +++ b/pykirdy/driver/kirdy_async.py @@ -254,8 +254,14 @@ class Device: """ Hard Reset Kirdy. The socket connection will be closed by Kirdy. Laser diode power and Tec power will be turned off. + Kirdy will send out a json({'msg_type': 'HardReset'}) to all sockets indicating. The device is being reset. """ - return await self._send_cmd(TARGET_DEVICE, "HardReset") + response = await self._send_cmd(TARGET_DEVICE, "HardReset") + if response is not None: + if response["msg_type"] == "Acknowledge": + # Delay for a second to wait for the hard reset message being sent out on Kirdy + await asyncio.sleep(1.0) + return response class Laser: def __init__(self, send_cmd_handler, cmd_lock):