This commit is contained in:
2023-11-22 10:17:05 +01:00
parent 07b13c153d
commit b3920524ab
33 changed files with 731 additions and 616 deletions

View File

@ -144,10 +144,10 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
)
def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
def create_single_rw_cmd( # noqa C901: Complexity is okay here.
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, cmd_str: str
):
if op_code == OpCodesDev.SPEED:
if cmd_str == OpCodesDev.SPEED:
speed, ramp_time = prompt_speed_ramp_time()
q.add_log_cmd(
f"RW {rw_idx}: {InfoDev.SPEED} with target "
@ -155,41 +155,41 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
)
q.add_pus_tc(pack_set_speed_command(object_id, speed, ramp_time))
if op_code == OpCodesDev.ON:
if cmd_str == 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 == OpCodesDev.NML:
if cmd_str == 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 == OpCodesDev.OFF:
if cmd_str == 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 == OpCodesDev.GET_TM:
if cmd_str == 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:
if cmd_str == 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 cmd_str in OpCodesDev.GET_STATUS:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.GET_STATUS}")
q.add_pus_tc(
generate_one_diag_command(
sid=make_sid(object_id=object_id, set_id=RwSetId.STATUS_SET_ID)
)
)
if op_code in OpCodesDev.ENABLE_STATUS_HK:
if cmd_str in OpCodesDev.ENABLE_STATUS_HK:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.ENABLE_STATUS_HK}")
interval = float(input("Please enter HK interval in floating point seconds: "))
cmds = enable_periodic_hk_command_with_interval(
@ -197,7 +197,7 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code in OpCodesDev.DISABLE_STATUS_HK:
if cmd_str in OpCodesDev.DISABLE_STATUS_HK:
q.add_log_cmd(f"RW {rw_idx}: {InfoDev.DISABLE_STATUS_HK}")
q.add_pus_tc(
disable_periodic_hk_command(
@ -206,32 +206,32 @@ def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
)
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, op_code: str):
if op_code in OpCodesAss.OFF:
def pack_rw_ass_cmds(q: DefaultPusQueueHelper, object_id: bytes, cmd_str: str):
if cmd_str in OpCodesAss.OFF:
data = pack_mode_data(object_id=object_id, mode=Mode.OFF, submode=0)
q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
)
)
if op_code in OpCodesAss.ON:
if cmd_str in OpCodesAss.ON:
data = pack_mode_data(object_id=object_id, mode=Mode.ON, submode=0)
q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
)
)
if op_code in OpCodesAss.NML:
if cmd_str in OpCodesAss.NML:
data = pack_mode_data(object_id=object_id, mode=Mode.NORMAL, submode=0)
q.add_pus_tc(
PusTelecommand(
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=data
)
)
if op_code in OpCodesAss.ALL_SPEED_UP:
if cmd_str in OpCodesAss.ALL_SPEED_UP:
speed, ramp_time = prompt_speed_ramp_time()
rw_speed_up_cmd_consec(q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], speed, ramp_time)
if op_code in OpCodesAss.ALL_SPEED_OFF:
if cmd_str in OpCodesAss.ALL_SPEED_OFF:
rw_speed_down_cmd_consec(
q, [RW1_ID, RW2_ID, RW3_ID, RW4_ID], prompt_ramp_time()
)