rework it

This commit is contained in:
2023-05-23 09:54:51 +02:00
parent 6182369e4f
commit aab093cc0a
17 changed files with 106 additions and 94 deletions

View File

@ -524,8 +524,7 @@ def get_sequence_file() -> str:
return file
def handle_ploc_mpsoc_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int):
pw = PrintWrapper(printer)
def handle_ploc_mpsoc_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int):
if set_id == SetId.HK_ID:
fmt_str = "!IBBBBBBB"
current_idx = 0
@ -640,10 +639,7 @@ class DirElement:
size: int
def handle_mpsoc_data_reply(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
):
pw = PrintWrapper(printer)
def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytearray):
if action_id == ActionId.TM_MEM_READ_RPT:
header_list = [
"PLOC Memory Address",
@ -655,20 +651,16 @@ def handle_mpsoc_data_reply(
struct.unpack("!H", custom_data[4:6])[0],
"0x" + custom_data[6:10].hex(),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
pw.dlog(f"{header_list}")
pw.dlog(f"{content_list}")
elif action_id == ActionId.TM_CAM_CMD_RPT:
header_list = ["Camera reply string", "ACK"]
content_list = [
custom_data[: len(custom_data) - 1].decode("utf-8"),
hex(custom_data[-1]),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
pw.dlog(f"{header_list}")
pw.dlog(f"{content_list}")
elif action_id == ActionId.TM_FLASH_DIRECTORY_CONTENT:
if len(custom_data) < 16:
_LOGGER.warning(

View File

@ -752,7 +752,7 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
)
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
pw.printer.print_validity_buffer(hk_data[current_idx:], 10)
pw.printer.get_validity_buffer(hk_data[current_idx:], 10)
else:
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")

View File

@ -116,4 +116,4 @@ def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
for idx, val in ain_dict.items():
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
current_idx += inc_len
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
printer.get_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)