more power commands
This commit is contained in:
@ -7,6 +7,7 @@ from gomspace.gomspace_common import (
|
||||
prompt_and_pack_set_param_command,
|
||||
prompt_and_pack_get_param_command,
|
||||
pack_request_config_command,
|
||||
pack_gnd_wdt_reset_command,
|
||||
)
|
||||
from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST
|
||||
from tmtccmd.config import OpCodeEntry
|
||||
@ -17,13 +18,14 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
generate_one_hk_command,
|
||||
)
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
class PowerInfo:
|
||||
INFO_CORE = "Core Information"
|
||||
INFO_AUX = "Auxiliary Information"
|
||||
INFO_ALL = "All Information"
|
||||
RESET_ALL_GND_WDTS = "Reset all Ground Watchdogs"
|
||||
|
||||
|
||||
class PowerOpCodes:
|
||||
@ -66,9 +68,10 @@ class PowerOpCodes:
|
||||
INFO_CORE = ["info"]
|
||||
INFO_AUX = ["info_aux"]
|
||||
INFO_ALL = ["info_all"]
|
||||
RESET_ALL_GND_WDTS = ["reset_gnd_wdts"]
|
||||
|
||||
|
||||
def add_gomspace_cmds(
|
||||
def pack_gomspace_cmds(
|
||||
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||
):
|
||||
objb = object_id.as_bytes
|
||||
@ -95,6 +98,51 @@ def add_gomspace_cmds(
|
||||
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))
|
||||
if op_code in GomspaceOpCodes.SAVE_TABLE:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.SAVE_TABLE}")
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table [0: Board Config, 1: Module Config, "
|
||||
"2: Calibration Parameter, 4: TM Data]: "
|
||||
)
|
||||
)
|
||||
# Not used for now
|
||||
"""
|
||||
target_table = int(input(
|
||||
"Target table. [Default: Source table]: "
|
||||
))
|
||||
"""
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.SAVE_TABLE,
|
||||
user_data=bytes([source_table]),
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.SAVE_TABLE_DEFAULT:
|
||||
source_table = int(
|
||||
input(
|
||||
"Source table [0: Board Config, 1: Module Config, "
|
||||
"2: Calibration Parameter, 4: TM Data]: "
|
||||
)
|
||||
)
|
||||
q.add_pus_tc(
|
||||
make_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.SAVE_TABLE_DEFAULT,
|
||||
user_data=bytes([source_table]),
|
||||
)
|
||||
)
|
||||
if op_code in GomspaceOpCodes.RESET_GND_WATCHDOG:
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
|
||||
q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
|
||||
|
||||
|
||||
def pack_reset_gnd_wdt_cmd(
|
||||
q: DefaultPusQueueHelper, prefix: str, object_id: ObjectIdBase
|
||||
):
|
||||
q.add_log_cmd(f"{prefix}: {GsInfo.RESET_GND_WATCHDOG}")
|
||||
q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
|
||||
|
||||
|
||||
def req_hk_cmds(
|
||||
@ -155,3 +203,6 @@ def add_gomspace_cmd_defs(oce: OpCodeEntry):
|
||||
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)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE, info=GsInfo.SAVE_TABLE)
|
||||
oce.add(keys=GomspaceOpCodes.SAVE_TABLE_DEFAULT, info=GsInfo.SAVE_TABLE_DEFAULT)
|
||||
oce.add(keys=GomspaceOpCodes.RESET_GND_WATCHDOG, info=GsInfo.RESET_GND_WATCHDOG)
|
||||
|
Reference in New Issue
Block a user