From abefe62344275b44b415d32820af583ec05d79ec Mon Sep 17 00:00:00 2001 From: rgroh1996 Date: Mon, 20 Nov 2023 14:18:20 +0100 Subject: [PATCH] send reset command in destructor The PPK2 was not reset when the object was deleted. The PPK2 is reset with the PPK2 RESET command. This allows a new connection to be established immediately. --- src/ppk2_api/ppk2_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ppk2_api/ppk2_api.py b/src/ppk2_api/ppk2_api.py index 58bab9c..fc34a18 100644 --- a/src/ppk2_api/ppk2_api.py +++ b/src/ppk2_api/ppk2_api.py @@ -98,6 +98,9 @@ def __init__(self, port: str, **kwargs): def __del__(self): """Destructor""" try: + # reset device + self._write_serial((PPK2_Command.RESET,)) + if self.ser: self.ser.close() except Exception as e: