From f70756a42e58893cb0748ce3440ee768df7d17bd Mon Sep 17 00:00:00 2001 From: GetPsyched Date: Wed, 17 Jan 2024 23:57:59 +0530 Subject: [PATCH] fix: catch when serial header is on --- charachorder/device.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charachorder/device.py b/charachorder/device.py index 2e4eb5e..587242d 100644 --- a/charachorder/device.py +++ b/charachorder/device.py @@ -114,6 +114,10 @@ def execute(self, *args: int | str) -> tuple[str, ...]: self.connection.write(f"{command}\r\n".encode("utf-8")) output = tuple(self.connection.readline().decode("utf-8").strip().split(" ")) + # Drop serial header + if output[0] == "01": + output = output[1:] + if output[0] == "UKN": raise UnknownCommand(command)