Skip to content

Commit 6e86c3e

Browse files
committed
Handle extra trailing nulls
1 parent 8d11d9e commit 6e86c3e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

horusdemodlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.1"
1+
__version__ = "0.2.2"

horusdemodlib/demod.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ class Mode(Enum):
6262
"""
6363
BINARY = 0
6464
BINARY_V1 = 0
65+
BINARY_V2 = 0
6566
RTTY_7N1 = 89
6667
RTTY_7N2 = 90
6768
RTTY = 90
6869
RTTY_8N2 = 91
69-
BINARY_V2_256BIT = 1
70-
BINARY_V2_128BIT = 2
7170

7271

7372
class Frame():
@@ -309,7 +308,8 @@ def demodulate(self, demod_in: bytes) -> Frame:
309308
)
310309
elif (self.mode != Mode.RTTY_7N2) and (self.mode != Mode.RTTY_8N2) and (self.mode != Mode.RTTY_7N1):
311310
try:
312-
data_out = bytes.fromhex(data_out.decode("ascii"))
311+
# Strip out any additional nulls.
312+
data_out = bytes.fromhex(data_out.decode("ascii").rstrip('\0'))
313313
except ValueError:
314314
logging.debug(data_out)
315315
logging.error("Couldn't decode the hex from the modem")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "horusdemodlib"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "Project Horus HAB Telemetry Demodulators"
55
authors = ["Mark Jessop"]
66
license = "LGPL-2.1-or-later"

0 commit comments

Comments
 (0)