From 6e86c3e55907b0cf3662d9ccdf6899dd71482c83 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sat, 4 Sep 2021 19:12:01 +0930 Subject: [PATCH] Handle extra trailing nulls --- horusdemodlib/__init__.py | 2 +- horusdemodlib/demod.py | 6 +++--- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/horusdemodlib/__init__.py b/horusdemodlib/__init__.py index 3ced358..b5fdc75 100755 --- a/horusdemodlib/__init__.py +++ b/horusdemodlib/__init__.py @@ -1 +1 @@ -__version__ = "0.2.1" +__version__ = "0.2.2" diff --git a/horusdemodlib/demod.py b/horusdemodlib/demod.py index 5e9ac22..45dcffe 100644 --- a/horusdemodlib/demod.py +++ b/horusdemodlib/demod.py @@ -62,12 +62,11 @@ class Mode(Enum): """ BINARY = 0 BINARY_V1 = 0 + BINARY_V2 = 0 RTTY_7N1 = 89 RTTY_7N2 = 90 RTTY = 90 RTTY_8N2 = 91 - BINARY_V2_256BIT = 1 - BINARY_V2_128BIT = 2 class Frame(): @@ -309,7 +308,8 @@ class HorusLib(): ) elif (self.mode != Mode.RTTY_7N2) and (self.mode != Mode.RTTY_8N2) and (self.mode != Mode.RTTY_7N1): try: - data_out = bytes.fromhex(data_out.decode("ascii")) + # Strip out any additional nulls. + data_out = bytes.fromhex(data_out.decode("ascii").rstrip('\0')) except ValueError: logging.debug(data_out) logging.error("Couldn't decode the hex from the modem") diff --git a/pyproject.toml b/pyproject.toml index fefa717..d74f5b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "horusdemodlib" -version = "0.2.1" +version = "0.2.2" description = "Project Horus HAB Telemetry Demodulators" authors = ["Mark Jessop"] license = "LGPL-2.1-or-later"