51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
import enum
|
|
|
|
from config.definitions import CustomServiceList
|
|
from tmtccmd.tc import QueueHelper
|
|
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
|
from tmtccmd.logging import get_console_logger
|
|
|
|
|
|
LOGGER = get_console_logger()
|
|
|
|
|
|
class OpCodes:
|
|
REQ_OS_HK = ["0", "hk-os"]
|
|
RESET_GNSS = ["5", "reset"]
|
|
|
|
|
|
class Info:
|
|
REQ_OS_HK = "Request One-Shot HK"
|
|
RESET_GNSS = "Reset GNSS using reset pin"
|
|
|
|
|
|
class SetIds:
|
|
HK = 0
|
|
|
|
|
|
def add_gps_cmds(cmd_dict: ServiceOpCodeDictT):
|
|
op_code_dict = dict()
|
|
add_op_code_entry(
|
|
op_code_dict=op_code_dict, keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS
|
|
)
|
|
add_op_code_entry(
|
|
op_code_dict=op_code_dict, keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK
|
|
)
|
|
add_service_op_code_entry(
|
|
srv_op_code_dict=cmd_dict,
|
|
op_code_entry=op_code_dict,
|
|
name=CustomServiceList.GPS_CTRL.value,
|
|
info="GPS/GNSS Controller",
|
|
)
|
|
|
|
|
|
def pack_gps_command(object_id: bytes, q: QueueHelper, op_code: str):
|
|
if op_code in OpCodes.RESET_GNSS:
|
|
# TODO: This needs to be re-implemented
|
|
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
|
if op_code in OpCodes.REQ_OS_HK:
|
|
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
|
q.add_pus_tc(
|
|
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetIds.HK))
|
|
)
|