add command to test RW TM set retrieval

This commit is contained in:
Robin Müller 2023-04-07 17:01:30 +02:00
parent 91a8a2e895
commit 98a9601dd7
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 26 additions and 13 deletions

View File

@ -20,6 +20,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
enable_periodic_hk_command_with_interval,
disable_periodic_hk_command,
)
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
from eive_tmtc.config.definitions import CustomServiceList
@ -28,14 +29,15 @@ from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
class OpCodesDev:
SPEED = ["0", "speed"]
ON = ["1", "on"]
NML = ["2", "nml"]
OFF = ["3", "off"]
GET_STATUS = ["4", "status"]
GET_TM = ["5", "tm"]
ENABLE_STATUS_HK = ["6", "enable_status_hk"]
DISABLE_STATUS_HK = ["7", "disable_status_hk"]
SPEED = "speed"
ON = "on"
NML = "nml"
OFF = "off"
GET_STATUS = "status"
GET_TM = "get_tm_set"
REQ_TM = "req_tm_set"
ENABLE_STATUS_HK = "enable_status_hk"
DISABLE_STATUS_HK = "disable_status_hk"
class InfoDev:
@ -45,6 +47,7 @@ class InfoDev:
OFF = "Set Off"
GET_STATUS = "Get Status HK"
GET_TM = "Get TM HK"
REQ_TM = "Request TM HK"
ENABLE_STATUS_HK = "Enable Status HK"
DISABLE_STATUS_HK = "Disable Status HK"
@ -57,6 +60,10 @@ class OpCodesAss:
ALL_SPEED_OFF = ["4", "speed_off"]
class ActionId:
REQUEST_TM = 9
class InfoAss:
ON = "Mode On: 3/4 RWs min. on"
NML = "Mode Normal: 3/4 RWs min. normal"
@ -99,6 +106,7 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
oce.add(info=InfoDev.ON, keys=OpCodesDev.ON)
oce.add(info=InfoDev.OFF, keys=OpCodesDev.OFF)
oce.add(info=InfoDev.NML, keys=OpCodesDev.NML)
oce.add(info=InfoDev.REQ_TM, keys=OpCodesDev.REQ_TM)
oce.add(info=InfoDev.GET_STATUS, keys=OpCodesDev.GET_STATUS)
oce.add(info=InfoDev.GET_TM, keys=OpCodesDev.GET_TM)
oce.add(info=InfoDev.ENABLE_STATUS_HK, keys=OpCodesDev.ENABLE_STATUS_HK)
@ -139,7 +147,7 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
def pack_single_rw_test_into(
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
):
if op_code in OpCodesDev.SPEED:
if op_code == OpCodesDev.SPEED:
speed, ramp_time = prompt_speed_ramp_time()
q.add_log_cmd(
f"RW {rw_idx}: {InfoDev.SPEED} with target "
@ -147,28 +155,33 @@ def pack_single_rw_test_into(
)
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
if op_code in OpCodesDev.ON:
if op_code == OpCodesDev.ON:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ON}")
mode_data = pack_mode_data(object_id, Mode.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
if op_code in OpCodesDev.NML:
if op_code == OpCodesDev.NML:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.NML}")
mode_data = pack_mode_data(object_id, Mode.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
if op_code in OpCodesDev.OFF:
if op_code == OpCodesDev.OFF:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.OFF}")
mode_data = pack_mode_data(object_id, Mode.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
if op_code in OpCodesDev.GET_TM:
if op_code == OpCodesDev.GET_TM:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_TM}")
q.add_pus_tc(
generate_one_hk_command(
sid=make_sid(object_id=object_id, set_id=RwSetId.TM_SET)
)
)
if op_code == OpCodesDev.REQ_TM:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.REQ_TM}")
q.add_pus_tc(
create_action_cmd(object_id=object_id, action_id=ActionId.REQUEST_TM)
)
if op_code in OpCodesDev.GET_STATUS:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_STATUS}")
q.add_pus_tc(