complete sus hk parsing

This commit is contained in:
2022-05-27 09:54:06 +02:00
parent da18ebab77
commit 3e087dc803
2 changed files with 27 additions and 5 deletions

View File

@ -6,16 +6,21 @@ from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
def handle_sus_hk(object_id: ObjectId, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int):
def handle_sus_hk(
object_id: ObjectId, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
):
pw = PrintWrapper(printer)
pw.dlog(f"Received SUS HK data from {object_id}")
if set_id == SetIds.HK:
current_idx = 0
temperature = struct.unpack('!f', hk_data[current_idx : current_idx + 4])[0]
temperature = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
current_idx += 4
channels = []
for _ in range(6):
channels.append(struct.unpack('!H', hk_data[current_idx : current_idx + 2]))
channels.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2]))
current_idx += 2
pw.dlog(f"Temperature: {temperature} C")
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
for idx, val in enumerate(channels):
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)