From 41e297e4f112525db19d4bf9d5bd7f1aff121252 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 10 Apr 2022 11:34:22 +0930 Subject: [PATCH] Report modulation type --- horusdemodlib/__init__.py | 2 +- horusdemodlib/decoder.py | 11 ++++++++++- horusdemodlib/sondehubamateur.py | 9 ++++++++- pyproject.toml | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/horusdemodlib/__init__.py b/horusdemodlib/__init__.py index a8d4557..d7b30e1 100755 --- a/horusdemodlib/__init__.py +++ b/horusdemodlib/__init__.py @@ -1 +1 @@ -__version__ = "0.3.5" +__version__ = "0.3.6" diff --git a/horusdemodlib/decoder.py b/horusdemodlib/decoder.py index fd9d3a2..d5cad52 100644 --- a/horusdemodlib/decoder.py +++ b/horusdemodlib/decoder.py @@ -99,9 +99,17 @@ def decode_packet(data:bytes, packet_format:dict = None, ignore_crc:bool = False 'packet_format': packet_format, 'crc_ok': False, 'payload_id': 0, - 'raw': codecs.encode(data, 'hex').decode().upper() + 'raw': codecs.encode(data, 'hex').decode().upper(), } + # Report the modulation type + if 'v1' in packet_format['name']: + _output['modulation'] = 'Horus Binary v1' + elif 'v2' in packet_format['name']: + _output['modulation'] = 'Horus Binary v2' + else: + _output['modulation'] = 'Horus Binary' + # Check the length provided in the packet format matches up with the length defined by the struct. _struct_length = struct.calcsize(packet_format['struct']) if _struct_length != packet_format['length']: @@ -261,6 +269,7 @@ def parse_ukhas_string(sentence:str) -> dict: # Produce a dict output which is compatible with the output of the binary decoder. _telem = { 'raw': _raw, + 'modulation': 'RTTY', 'callsign': _callsign, 'sequence_number': _sequence_number, 'time': _time, diff --git a/horusdemodlib/sondehubamateur.py b/horusdemodlib/sondehubamateur.py index 5c4c820..289dee3 100644 --- a/horusdemodlib/sondehubamateur.py +++ b/horusdemodlib/sondehubamateur.py @@ -165,7 +165,11 @@ class SondehubAmateurUploader(object): self.log_debug("Offending datetime_dt: %s" % str(telemetry["time"])) return None - # Callsign + # Callsign - Break if this is an unknown payload ID. + if telemetry["callsign"] == "UNKNOWN_PAYLOAD_ID": + self.log_error("Not uploading telemetry from unknown payload ID. Is your payload ID list old?") + return None + _output['payload_callsign'] = telemetry["callsign"] # Frame Number @@ -198,6 +202,9 @@ class SondehubAmateurUploader(object): if "raw" in telemetry: _output["raw"] = telemetry["raw"] + if "modulation" in telemetry: + _output["modulation"] = telemetry["modulation"] + # Add in any field names from the custom field section if "custom_field_names" in telemetry: for _custom_field_name in telemetry["custom_field_names"]: diff --git a/pyproject.toml b/pyproject.toml index 4f4922d..ce6335a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "horusdemodlib" -version = "0.3.5" +version = "0.3.6" description = "Project Horus HAB Telemetry Demodulators" authors = ["Mark Jessop"] license = "LGPL-2.1-or-later"