TM parsing for version event

This commit is contained in:
Robin Müller 2023-02-08 11:47:37 +01:00
parent dedfe1c977
commit ca04b6018b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -1,5 +1,6 @@
import logging import logging
import datetime import datetime
import struct
from eive_tmtc.config.events import get_event_dict from eive_tmtc.config.events import get_event_dict
from eive_tmtc.config.object_ids import get_object_ids 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" mode_name = "Raw"
pw.dlog(f"Mode Number {event_def.param1}, Mode Name {mode_name}") pw.dlog(f"Mode Number {event_def.param1}, Mode Name {mode_name}")
pw.dlog(f"Submode: {event_def.param2}") 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": elif info.name == "CLOCK_SET":
old_time = event_def.param1 old_time = event_def.param1
new_time = event_def.param2 new_time = event_def.param2