From ca04b6018baaa1394141656d5db40e22ba322f36 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Feb 2023 11:47:37 +0100 Subject: [PATCH] TM parsing for version event --- eive_tmtc/pus_tm/event_handler.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index 40a1d1e..a404028 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -1,5 +1,6 @@ import logging import datetime +import struct from eive_tmtc.config.events import get_event_dict from eive_tmtc.config.object_ids import get_object_ids @@ -74,6 +75,19 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter): mode_name = "Raw" pw.dlog(f"Mode Number {event_def.param1}, Mode Name {mode_name}") pw.dlog(f"Submode: {event_def.param2}") + elif info.name == "VERSION_INFO": + ver_major = (event_def.param1 >> 24) & 0xff + ver_minor = (event_def.param1 >> 16) & 0xff + ver_rev = (event_def.param1 >> 8) & 0xff + has_git_sha = bool(event_def.param1 & 0xff) + git_sha = "" + if has_git_sha: + p2_as_bytes = struct.pack("@I", event_def.param2) + git_sha = p2_as_bytes.decode("ascii") + version_string = f"v{ver_major}.{ver_minor}.{ver_rev}" + pw.dlog(f"Version {version_string}") + if has_git_sha: + pw.dlog(f"Git SHA first four letters: {git_sha}") elif info.name == "CLOCK_SET": old_time = event_def.param1 new_time = event_def.param2