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

View File

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