clean up and extend power TMTC handling
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from config.object_ids import PDU_1_HANDLER_ID, PDU_2_HANDLER_ID
|
||||
from gomspace.gomspace_common import (
|
||||
@ -9,9 +8,11 @@ from gomspace.gomspace_common import (
|
||||
GsInfo,
|
||||
SetIds,
|
||||
GomspaceDeviceActionIds,
|
||||
prompt_and_pack_set_param_command,
|
||||
prompt_and_pack_get_param_command,
|
||||
pack_request_config_command,
|
||||
)
|
||||
from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST
|
||||
from pus_tm.defs import PrintWrapper
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
@ -19,8 +20,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
generate_one_diag_command,
|
||||
generate_one_hk_command,
|
||||
)
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Pdu1ChIndex(enum.IntEnum):
|
||||
@ -187,6 +188,35 @@ def add_pdu2_common_defs(oce: OpCodeEntry):
|
||||
oce.add(keys=PowerOpCodes.PL_CAM_OFF, info=info_off_pdu2(Pdu2InfoBase.PL_CAM))
|
||||
|
||||
|
||||
def add_gomspace_cmds(
|
||||
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.PRINT_SWITCH_V_I}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.PRINT_LATCHUPS}")
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.SET_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.SET_PARAMETER}")
|
||||
prompt_and_pack_set_param_command(q, object_id)
|
||||
if op_code in GomspaceOpCodes.GET_PARAM:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.GET_PARAMETER}")
|
||||
prompt_and_pack_get_param_command(q, object_id)
|
||||
if op_code in GomspaceOpCodes.REQUEST_CONFIG_TABLE:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.REQUEST_CONFIG_TABLE}")
|
||||
q.add_pus_tc(pack_request_config_command(object_id.as_bytes))
|
||||
|
||||
|
||||
def pdu1_cmds(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in PowerOpCodes.TCS_ON:
|
||||
tcs_on_cmd(q)
|
||||
@ -447,28 +477,16 @@ def generic_off_cmd(
|
||||
)
|
||||
|
||||
|
||||
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}")
|
||||
def add_gomspace_cmd_defs(oce: OpCodeEntry):
|
||||
oce.add(
|
||||
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
|
||||
info=GsInfo.REQUEST_CORE_HK_ONCE,
|
||||
)
|
||||
oce.add(
|
||||
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
|
||||
info=GsInfo.REQUEST_AUX_HK_ONCE,
|
||||
)
|
||||
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info=GsInfo.PRINT_LATCHUPS)
|
||||
oce.add(keys=GomspaceOpCodes.SET_PARAM, info=GsInfo.SET_PARAMETER)
|
||||
oce.add(keys=GomspaceOpCodes.REQUEST_CONFIG_TABLE, info=GsInfo.REQUEST_CONFIG_TABLE)
|
||||
|
Reference in New Issue
Block a user