added sus hk parsing

This commit is contained in:
Robin Müller 2022-05-25 18:15:22 +02:00
parent ef349856d6
commit da18ebab77
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

21
pus_tm/devs/sus.py Normal file
View File

@ -0,0 +1,21 @@
import struct
from pus_tm.defs import PrintWrapper
from pus_tc.devs.sus import SetIds
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):
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]
current_idx += 4
channels = []
for _ in range(6):
channels.append(struct.unpack('!H', hk_data[current_idx : current_idx + 2]))
current_idx += 2
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)