diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index 35b2855..e2de7d9 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -32,7 +32,7 @@ from eive_tmtc.config.object_ids import ( TMP1075_HANDLER_TCS_BRD_1_ID, get_object_ids, ) -from eive_tmtc.tmtc.acs.acs_board import pack_acs_command +from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_command from eive_tmtc.tmtc.acs.acs_ctrl import pack_acs_ctrl_command from eive_tmtc.tmtc.acs.gps import pack_gps_command from eive_tmtc.tmtc.acs.gyros import handle_gyr_cmd @@ -44,6 +44,7 @@ from eive_tmtc.tmtc.acs.reaction_wheels import ( ) from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands from eive_tmtc.tmtc.acs.str_img_helper import pack_str_img_helper_command +from eive_tmtc.tmtc.acs.subsystem import build_acs_subsystem_cmd from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command from eive_tmtc.tmtc.com.pdec_handler import pack_pdec_handler_commands from eive_tmtc.tmtc.com.subsystem import build_com_subsystem_procedure @@ -182,7 +183,7 @@ def handle_tcs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: Lis def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]): obj_id_man = get_object_ids() if len(cmd_path_list) == 1: - return pack_acs_command(q=queue_helper, cmd_str=cmd_path_list[0]) + return build_acs_subsystem_cmd(queue_helper, cmd_path_list[0]) assert len(cmd_path_list) >= 2 if cmd_path_list[0] == "mgt": object_id = cast(ObjectIdU32, obj_id_man.get(IMTQ_HANDLER_ID)) @@ -228,12 +229,14 @@ def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: Lis object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1] ) if cmd_path_list[0] == "acs_brd_assy": - assert len(cmd_path_list) >= 3 - if cmd_path_list[1] == "mgm_devs": - return handle_mgm_cmd(q=queue_helper, cmd_str=cmd_path_list[2]) - if cmd_path_list[1] == "gyro_devs": - assert len(cmd_path_list) >= 3 - return handle_gyr_cmd(q=queue_helper, cmd_str=cmd_path_list[2]) + if len(cmd_path_list) == 2: + return pack_acs_board_command(q=queue_helper, cmd_str=cmd_path_list[1]) + else: + if cmd_path_list[1] == "mgm_devs": + return handle_mgm_cmd(q=queue_helper, cmd_str=cmd_path_list[2]) + if cmd_path_list[1] == "gyro_devs": + assert len(cmd_path_list) >= 3 + return handle_gyr_cmd(q=queue_helper, cmd_str=cmd_path_list[2]) if cmd_path_list[0] == "str_img_helper": object_id = cast(ObjectIdU32, obj_id_man.get(STR_IMG_HELPER_ID)) return pack_str_img_helper_command( diff --git a/eive_tmtc/pus_tc/system/proc.py b/eive_tmtc/pus_tc/system/proc.py index ed189fb..374f96a 100644 --- a/eive_tmtc/pus_tc/system/proc.py +++ b/eive_tmtc/pus_tc/system/proc.py @@ -34,7 +34,7 @@ from eive_tmtc.pus_tc.system.controllers import ( pack_cmd_ctrl_to_off, pack_cmd_ctrl_to_nml, ) -from eive_tmtc.tmtc.acs.acs_board import pack_acs_command +from eive_tmtc.tmtc.acs.acs_board import pack_acs_board_command from eive_tmtc.tmtc.acs.sus_board import pack_sus_cmds from eive_tmtc.tmtc.acs.imtq import create_imtq_command, pack_dipole_command from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands @@ -337,7 +337,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. ] d_side_pairs = a_side_pairs + b_side_pairs diag_list = [False, False, True, False, False] - pack_acs_command(q=q, cmd_str="acs-a") + pack_acs_board_command(q=q, cmd_str="acs-a") for a_side_dev in a_side_pairs: oid = a_side_dev[0] @@ -351,9 +351,9 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="acs-off") + pack_acs_board_command(q=q, cmd_str="acs-off") q.add_wait_seconds(5.0) - pack_acs_command(q=q, cmd_str="acs-b") + pack_acs_board_command(q=q, cmd_str="acs-b") sid_list.clear() diag_list = [False, False, True, False, False] @@ -370,9 +370,9 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="acs-off") + pack_acs_board_command(q=q, cmd_str="acs-off") q.add_wait_seconds(5.0) - pack_acs_command(q=q, cmd_str="acs-d") + pack_acs_board_command(q=q, cmd_str="acs-d") sid_list.clear() @@ -400,7 +400,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="acs-off") + pack_acs_board_command(q=q, cmd_str="acs-off") if op_code in OpCode.MGT_FT: key = KAI.MGT_FT[0] @@ -472,7 +472,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. True, True, ] - pack_acs_command(q=q, cmd_str="acs-d") + pack_acs_board_command(q=q, cmd_str="acs-d") # Command MGT to mode on create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="1") q.add_wait_seconds(20.0) @@ -495,7 +495,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. ) create_imtq_command(oids.IMTQ_HANDLER_ID, q=q, cmd_str="0") - pack_acs_command(q=q, cmd_str="acs-off") + pack_acs_board_command(q=q, cmd_str="acs-off") if op_code in OpCode.SUS_FT: key = KAI.SUS_FT[0] @@ -538,7 +538,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="sus-off") + pack_acs_board_command(q=q, cmd_str="sus-off") q.add_wait_seconds(5.0) pack_sus_cmds(q=q, op_code="sus-red") @@ -562,7 +562,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="sus-off") + pack_acs_board_command(q=q, cmd_str="sus-off") q.add_wait_seconds(5.0) pack_sus_cmds(q=q, op_code="sus-d") @@ -593,7 +593,7 @@ def pack_proc_commands( # noqa C901: Complexity is okay here. cfg=GenericHkListeningCfg.default(), ) - pack_acs_command(q=q, cmd_str="sus-off") + pack_acs_board_command(q=q, cmd_str="sus-off") if op_code in OpCode.SYRLINKS_FT: key = KAI.SYRLINKS_FT[0] diff --git a/eive_tmtc/tmtc/acs/acs_board.py b/eive_tmtc/tmtc/acs/acs_board.py index 97f60dd..02bbbd5 100644 --- a/eive_tmtc/tmtc/acs/acs_board.py +++ b/eive_tmtc/tmtc/acs/acs_board.py @@ -30,7 +30,7 @@ class DualSideSubmode(enum.IntEnum): DUAL_SIDE = 2 -def pack_acs_command(q: DefaultPusQueueHelper, cmd_str: str): +def pack_acs_board_command(q: DefaultPusQueueHelper, cmd_str: str): if cmd_str in AcsOpCodes.ACS_ASS_A_SIDE: pack_mode_cmd_with_info( object_id=ACS_BOARD_ASS_ID, @@ -93,43 +93,43 @@ def create_acs_board_node() -> CmdTreeNode: node = CmdTreeNode("acs_brd", "ACS Board", hide_children_which_are_leaves=True) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_A_SIDE[0], + AcsOpCodes.ACS_ASS_A_SIDE[1], "Switch to ACS board A side", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_B_SIDE[0], + AcsOpCodes.ACS_ASS_B_SIDE[1], "Switch to ACS board B side", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_DUAL_MODE[0], + AcsOpCodes.ACS_ASS_DUAL_MODE[1], "Switch to ACS board dual mode", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_A_ON[0], + AcsOpCodes.ACS_ASS_A_ON[1], "Switch ACS board A side on", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_B_ON[0], + AcsOpCodes.ACS_ASS_B_ON[1], "Switch ACS board B side on", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_DUAL_ON[0], + AcsOpCodes.ACS_ASS_DUAL_ON[1], "Switch ACS board dual mode on", ) ) node.add_child( CmdTreeNode( - AcsOpCodes.ACS_ASS_OFF[0], + AcsOpCodes.ACS_ASS_OFF[1], "Switch off ACS board", ) ) diff --git a/eive_tmtc/tmtc/acs/acs_ctrl.py b/eive_tmtc/tmtc/acs/acs_ctrl.py index c987114..ea2ab0c 100644 --- a/eive_tmtc/tmtc/acs/acs_ctrl.py +++ b/eive_tmtc/tmtc/acs/acs_ctrl.py @@ -171,7 +171,7 @@ if PERFORM_MGM_CALIBRATION: def create_acs_ctrl_node() -> CmdTreeNode: # Zip the two classes together into a dictionary op_code_strs = [ - getattr(OpCodes, key)[0] for key in dir(OpCodes) if not key.startswith("__") + getattr(OpCodes, key) for key in dir(OpCodes) if not key.startswith("__") ] info_strs = [getattr(Info, key) for key in dir(OpCodes) if not key.startswith("__")] combined_dict = dict(zip(op_code_strs, info_strs))