diff --git a/eive_tmtc/pus_tc/cmd_demux.py b/eive_tmtc/pus_tc/cmd_demux.py index d379ebd..e45e6ff 100644 --- a/eive_tmtc/pus_tc/cmd_demux.py +++ b/eive_tmtc/pus_tc/cmd_demux.py @@ -225,7 +225,7 @@ def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: Lis object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2] ) - if cmd_path_list[0] == "gnss_devs": + if cmd_path_list[0] == "gnss_ctrl": return pack_gps_command( object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1] ) diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index a99a7f0..86849ea 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -15,6 +15,7 @@ from tmtccmd.pus.tc.s3_fsfw_hk import ( create_enable_periodic_hk_command_with_interval_with_diag, create_disable_periodic_hk_command_with_diag, ) +from tmtccmd.pus.tc.s8_fsfw_action import create_action_cmd from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter _LOGGER = logging.getLogger(__name__) @@ -24,6 +25,15 @@ class GpsInfo: MAX_SATELLITES = 30 +class ActIds: + RESET_GNSS = 5 + + +class AcsBoardSides(enum.IntEnum): + A_SIDE = 0 + B_SIDE = 1 + + class OpCode: OFF = "off" ON = "on" @@ -33,7 +43,7 @@ class OpCode: REQ_SKYVIEW_HK = "skyview_hk_request" ENABLE_SKYVIEW_HK = "skyview_hk_enable" DISABLE_SKYVIEW_HK = "skyview_hk_disable" - RESET_GNSS = "reset" + RESET_GNSS = "reset_gnss" class Info: @@ -59,37 +69,27 @@ def create_gnss_node() -> CmdTreeNode: ] info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")] combined_dict = dict(zip(op_code_strs, info_strs)) - node = CmdTreeNode("gnss", "GNSS device", hide_children_for_print=True) + node = CmdTreeNode("gnss_ctrl", "GNSS Ctrl", hide_children_for_print=True) for op_code, info in combined_dict.items(): node.add_child(CmdTreeNode(op_code, info)) return node -@tmtc_definitions_provider -def add_gps_cmds(defs: TmtcDefinitionWrapper): - oce = OpCodeEntry() - oce.add(keys=OpCode.OFF, info=Info.OFF) - oce.add(keys=OpCode.ON, info=Info.ON) - oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS) - oce.add(keys=OpCode.REQ_CORE_HK, info=Info.REQ_CORE_HK) - oce.add(keys=OpCode.ENABLE_CORE_HK, info=Info.ENABLE_CORE_HK) - oce.add(keys=OpCode.DISABLE_CORE_HK, info=Info.DISABLE_CORE_HK) - oce.add(keys=OpCode.REQ_SKYVIEW_HK, info=Info.REQ_SKYVIEW_HK) - oce.add(keys=OpCode.ENABLE_SKYVIEW_HK, info=Info.ENABLE_SKYVIEW_HK) - oce.add(keys=OpCode.DISABLE_SKYVIEW_HK, info=Info.DISABLE_SKYVIEW_HK) - defs.add_service( - name=CustomServiceList.GPS_CTRL.value, - info="GPS/GNSS Controller", - op_code_entry=oce, - ) - - def pack_gps_command( # noqa: C901 object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str ): # noqa: C901: if cmd_str == OpCode.RESET_GNSS: - # TODO: This needs to be re-implemented - _LOGGER.warning("Reset pin handling needs to be re-implemented") + for val in AcsBoardSides: + print("{:<2}: {:<20}".format(val, val.name)) + board_side = int(input("Select Board Side \n" "")) + q.add_log_cmd(f"GPS: {Info.RESET_GNSS}") + q.add_pus_tc( + create_action_cmd( + object_id=object_id, + action_id=ActIds.RESET_GNSS, + user_data=bytearray([board_side]), + ) + ) if cmd_str == OpCode.ENABLE_CORE_HK: interval = float(input("Please specify interval in floating point seconds: ")) if interval <= 0: