clean up and extend power TMTC handling

This commit is contained in:
2022-08-26 23:52:47 +02:00
parent 0f9aed4ee2
commit 6c59fb95d3
10 changed files with 108 additions and 157 deletions

View File

@ -1,9 +1,10 @@
import struct
from typing import List, Tuple
from tmtccmd.util import ObjectIdBase
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
from pus_tm.defs import PrintWrapper
from gomspace.gomspace_common import SetIds
from gomspace.gomspace_common import SetIds, GomspaceDeviceActionIds
P60_INDEX_LIST = [
"ACU VCC",
@ -378,9 +379,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
f"{i} | {str(voltages[i]).ljust(4)} | {str(currents[i]).ljust(4)} | "
f"{str(vboosts[i]).ljust(4)} | {str(powers[i]).ljust(2)}"
)
pw.dlog(
f"Temperatures in C: Ch0 {tmp0} | Ch1 {tmp1} | Ch2 {tmp2}"
)
pw.dlog(f"Temperatures in C: Ch0 {tmp0} | Ch1 {tmp1} | Ch2 {tmp2}")
pw.dlog(
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
@ -423,3 +422,30 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
)
dev_parser.print(pw=pw)
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=8)
def handle_get_param_data_reply(
obj_id: ObjectIdBase, action_id: int, pw: PrintWrapper, custom_data: bytearray
):
if action_id == GomspaceDeviceActionIds.PARAM_GET:
pw.dlog(f"Parameter Get Request received for object {obj_id}")
header_list = [
"Gomspace Request Code",
"Table ID",
"Memory Address",
"Payload length",
"Payload",
]
fmt_str = "!BBHH"
(gs_request_code, table_id, address, payload_length) = struct.unpack(
fmt_str, custom_data[:6]
)
content_list = [
hex(gs_request_code),
table_id,
hex(address),
payload_length,
f"0x[{custom_data[6:].hex(sep=',')}]",
]
pw.dlog(f"{header_list}")
pw.dlog(f"{content_list}")