clean up imtq commands

This commit is contained in:
Robin Müller 2023-02-19 12:39:25 +01:00
parent fbf507b2a8
commit af4ceec4f4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -28,10 +28,18 @@ from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
class OpCode:
ON = ["on"]
NORMAL = ["normal"]
OFF = ["off"]
SET_DIPOLE = ["set_dipole"]
ON = "on"
NORMAL = "normal"
OFF = "off"
SET_DIPOLE = "set_dipole"
REQUEST_ENG_HK = "hk_os_eng_hk"
REQUEST_MGM_RAW = "hk_os_mgm_raw"
POS_X_SELF_TEST = "self_test_pos_x"
NEG_X_SELF_TEST = "self_test_neg_x"
POS_Y_SELF_TEST = "self_test_pos_y"
NEG_Y_SELF_TEST = "self_test_neg_y"
POS_Z_SELF_TEST = "self_test_pos_z"
NEG_Z_SELF_TEST = "self_test_neg_z"
class ImtqSetId:
@ -71,17 +79,17 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.OFF, "Mode Off")
oce.add(OpCode.ON, "Mode On")
oce.add(OpCode.NORMAL, "Mode Normal")
oce.add("3", "IMTQ perform pos X self test")
oce.add("4", "IMTQ perform neg X self test")
oce.add("5", "IMTQ perform pos Y self test")
oce.add("6", "IMTQ perform neg Y self test")
oce.add("7", "IMTQ perform pos Z self test")
oce.add("8", "IMTQ perform neg Z self test")
oce.add(OpCode.REQUEST_ENG_HK, "Request Engineering HK One Shot")
oce.add(OpCode.REQUEST_MGM_RAW, "Request MGM Raw HK One Shot")
oce.add(OpCode.POS_X_SELF_TEST, "IMTQ perform pos X self test")
oce.add(OpCode.NEG_X_SELF_TEST, "IMTQ perform neg X self test")
oce.add(OpCode.POS_Y_SELF_TEST, "IMTQ perform pos Y self test")
oce.add(OpCode.NEG_Y_SELF_TEST, "IMTQ perform neg Y self test")
oce.add(OpCode.POS_Z_SELF_TEST, "IMTQ perform pos Z self test")
oce.add(OpCode.NEG_Z_SELF_TEST, "IMTQ perform neg Z self test")
oce.add(OpCode.SET_DIPOLE, "IMTQ command dipole")
oce.add("10", "IMTQ get commanded dipole")
oce.add("11", "IMTQ get engineering hk set")
oce.add("12", "IMTQ get calibrated MTM measurement one shot")
oce.add("13", "IMTQ get raw MTM measurement one shot")
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
@ -90,19 +98,19 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
)
if op_code in OpCode.OFF:
if op_code == OpCode.OFF:
q.add_log_cmd("IMTQ: Set mode off")
command = pack_mode_data(object_id.as_bytes, Mode.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if op_code in OpCode.ON:
if op_code == OpCode.ON:
q.add_log_cmd("IMTQ: Set mode on")
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if op_code in OpCode.NORMAL:
if op_code == OpCode.NORMAL:
q.add_log_cmd("IMTQ: Mode Normal")
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if op_code == "3":
if op_code == OpCode.POS_X_SELF_TEST:
q.add_log_cmd("IMTQ: Perform positive x self test")
command = object_id.as_bytes + ImtqActionId.perform_positive_x_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -115,7 +123,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_X_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "4":
if op_code == OpCode.NEG_X_SELF_TEST:
q.add_log_cmd("IMTQ: Perform negative x self test")
command = object_id.as_bytes + ImtqActionId.perform_negative_x_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -126,7 +134,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_X_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "5":
if op_code == OpCode.POS_Y_SELF_TEST:
q.add_log_cmd("IMTQ: Perform positive y self test")
command = object_id.as_bytes + ImtqActionId.perform_positive_y_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -138,7 +146,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "6":
if op_code == OpCode.NEG_Y_SELF_TEST:
q.add_log_cmd("IMTQ: Perform negative y self test")
command = object_id.as_bytes + ImtqActionId.perform_negative_y_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -151,7 +159,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetId.NEGATIVE_Y_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "7":
if op_code == OpCode.POS_Z_SELF_TEST:
q.add_log_cmd("IMTQ: Perform positive z self test")
command = object_id.as_bytes + ImtqActionId.perform_positive_z_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -164,7 +172,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
sid = make_sid(object_id.as_bytes, ImtqSetId.POSITIVE_Y_TEST)
q.add_pus_tc(generate_one_hk_command(sid))
if op_code == "8":
if op_code == OpCode.NEG_Z_SELF_TEST:
q.add_log_cmd("IMTQ: Perform negative z self test")
command = object_id.as_bytes + ImtqActionId.perform_negative_z_test
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -200,7 +208,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
command = object_id.as_bytes + ImtqActionId.get_commanded_dipole
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "11":
if op_code == OpCode.REQUEST_ENG_HK:
q.add_log_cmd("IMTQ: Get engineering hk set")
q.add_pus_tc(
generate_one_diag_command(
@ -218,7 +226,7 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod
)
)
if op_code == "13":
if op_code == OpCode.REQUEST_MGM_RAW:
q.add_log_cmd("IMTQ: Get raw MTM hk set")
q.add_pus_tc(
generate_one_diag_command(