2021-09-08 13:20:22 +02:00
|
|
|
import enum
|
|
|
|
|
2022-05-24 01:34:33 +02:00
|
|
|
from config.definitions import CustomServiceList
|
|
|
|
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
|
|
|
|
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
|
|
|
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
|
|
|
|
from tmtccmd.logging import get_console_logger
|
2021-09-08 13:20:22 +02:00
|
|
|
from tmtccmd.tc.definitions import TcQueueT
|
2022-05-05 16:15:53 +02:00
|
|
|
from tmtccmd.tc.pus_8_funccmd import generate_action_command
|
2021-09-08 13:20:22 +02:00
|
|
|
|
|
|
|
|
2022-05-24 01:34:33 +02:00
|
|
|
LOGGER = get_console_logger()
|
2021-09-08 13:20:22 +02:00
|
|
|
|
2022-05-24 01:34:33 +02:00
|
|
|
|
|
|
|
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,
|
2022-05-25 10:37:38 +02:00
|
|
|
info="GPS/GNSS Controller",
|
2022-05-24 01:34:33 +02:00
|
|
|
)
|
2021-09-08 13:20:22 +02:00
|
|
|
|
|
|
|
|
2022-05-25 12:06:17 +02:00
|
|
|
class SetIds:
|
|
|
|
HK = 0
|
|
|
|
|
|
|
|
|
2021-09-08 14:47:33 +02:00
|
|
|
def pack_gps_command(object_id: bytes, tc_queue: TcQueueT, op_code: str):
|
2022-05-24 01:34:33 +02:00
|
|
|
if op_code in OpCodes.RESET_GNSS:
|
2022-05-24 01:49:57 +02:00
|
|
|
# TODO: This needs to be re-implemented
|
|
|
|
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
2022-05-24 01:34:33 +02:00
|
|
|
if op_code in OpCodes.REQ_OS_HK:
|
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, f"GMSS: {Info.REQ_OS_HK}"))
|
2022-05-25 10:37:38 +02:00
|
|
|
cmd = generate_one_hk_command(
|
|
|
|
sid=make_sid(object_id=object_id, set_id=SetIds.HK), ssc=0
|
|
|
|
)
|
2022-05-24 01:34:33 +02:00
|
|
|
tc_queue.appendleft(cmd.pack_command_tuple())
|