2023-07-10 16:25:44 +02:00
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
|
|
from eive_tmtc.config.object_ids import TCS_CONTROLLER
|
|
|
|
from eive_tmtc.tmtc.tcs import CtrlSetId
|
|
|
|
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
|
|
|
|
from tmtccmd.config.tmtc import (
|
2023-11-28 17:24:25 +01:00
|
|
|
CmdTreeNode,
|
2023-07-10 16:25:44 +02:00
|
|
|
tmtc_definitions_provider,
|
|
|
|
TmtcDefinitionWrapper,
|
|
|
|
OpCodeEntry,
|
|
|
|
)
|
2023-11-10 19:23:06 +01:00
|
|
|
from tmtccmd.tmtc import DefaultPusQueueHelper
|
|
|
|
from tmtccmd.pus.tc.s3_fsfw_hk import (
|
2023-07-10 16:25:44 +02:00
|
|
|
make_sid,
|
|
|
|
generate_one_hk_command,
|
|
|
|
create_request_one_diag_command,
|
2023-09-12 13:48:38 +02:00
|
|
|
create_request_one_hk_command,
|
|
|
|
create_enable_periodic_hk_command_with_interval_with_diag,
|
2023-07-10 16:25:44 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-11-22 10:17:05 +01:00
|
|
|
class CmdStr:
|
2023-07-10 16:25:44 +02:00
|
|
|
REQUEST_PRIMARY_TEMP_SET = "temp"
|
|
|
|
ENABLE_TEMP_SET = "enable_temp_set"
|
|
|
|
REQUEST_DEVICE_TEMP_SET = "temp_devs"
|
|
|
|
REQUEST_DEVICE_SUS_SET = "temp_sus"
|
|
|
|
REQUEST_HEATER_INFO = "heater_info"
|
2023-07-10 16:29:54 +02:00
|
|
|
REQUEST_TCS_CTRL_INFO = "tcs_ctrl_info"
|
|
|
|
|
|
|
|
|
2023-11-22 10:17:05 +01:00
|
|
|
class CmdInfo:
|
2023-07-10 16:29:54 +02:00
|
|
|
ENABLE_TEMP_SET = "Enable Primary Temperature Set"
|
|
|
|
REQUEST_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
|
|
|
|
REQUEST_DEVICE_TEMP_SET = "Request HK set of device sensor temperatures"
|
|
|
|
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
|
|
|
|
REQUEST_HEATER_INFO = "Request heater information"
|
|
|
|
REQUEST_TCS_CTRL_INFO = "Request TCS controller information"
|
2023-07-10 16:25:44 +02:00
|
|
|
|
|
|
|
|
2023-11-22 10:17:05 +01:00
|
|
|
def pack_tcs_ctrl_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
|
|
|
if cmd_str == CmdStr.REQUEST_PRIMARY_TEMP_SET:
|
2023-07-10 16:25:44 +02:00
|
|
|
sensor_set_sid = make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS)
|
2023-11-22 10:17:05 +01:00
|
|
|
q.add_log_cmd(CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
2023-07-10 16:25:44 +02:00
|
|
|
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == CmdStr.REQUEST_DEVICE_TEMP_SET:
|
|
|
|
q.add_log_cmd(CmdInfo.REQUEST_DEVICE_TEMP_SET)
|
2023-07-10 16:25:44 +02:00
|
|
|
q.add_pus_tc(
|
|
|
|
generate_one_hk_command(make_sid(TCS_CONTROLLER, CtrlSetId.DEVICE_SENSORS))
|
|
|
|
)
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == CmdStr.REQUEST_DEVICE_SUS_SET:
|
|
|
|
q.add_log_cmd(CmdInfo.REQUEST_DEVICE_SUS_SET)
|
2023-07-10 16:25:44 +02:00
|
|
|
q.add_pus_tc(
|
|
|
|
generate_one_hk_command(
|
|
|
|
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
|
|
|
)
|
|
|
|
)
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == CmdStr.REQUEST_HEATER_INFO:
|
|
|
|
q.add_log_cmd(CmdInfo.REQUEST_HEATER_INFO)
|
2023-07-10 16:25:44 +02:00
|
|
|
q.add_pus_tc(
|
|
|
|
create_request_one_diag_command(
|
|
|
|
make_sid(TCS_CONTROLLER, CtrlSetId.HEATER_INFO)
|
|
|
|
)
|
|
|
|
)
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == CmdStr.REQUEST_TCS_CTRL_INFO:
|
|
|
|
q.add_log_cmd(CmdInfo.REQUEST_TCS_CTRL_INFO)
|
2023-07-10 16:29:54 +02:00
|
|
|
q.add_pus_tc(
|
|
|
|
create_request_one_hk_command(
|
|
|
|
make_sid(TCS_CONTROLLER, CtrlSetId.TCS_CTRL_INFO)
|
|
|
|
)
|
|
|
|
)
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == CmdStr.ENABLE_TEMP_SET:
|
2023-07-10 16:25:44 +02:00
|
|
|
interval_seconds = float(input("Please specify interval in seconds: "))
|
2023-09-12 13:47:27 +02:00
|
|
|
cmds = create_enable_periodic_hk_command_with_interval_with_diag(
|
2023-07-10 16:25:44 +02:00
|
|
|
False, make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS), interval_seconds
|
|
|
|
)
|
|
|
|
for cmd in cmds:
|
|
|
|
q.add_pus_tc(cmd)
|
2023-11-22 10:17:05 +01:00
|
|
|
pack_tcs_ass_cmds(q, cmd_str)
|
2023-07-10 16:25:44 +02:00
|
|
|
|
|
|
|
|
2023-11-28 17:24:25 +01:00
|
|
|
CTN = CmdTreeNode
|
|
|
|
|
|
|
|
|
|
|
|
def create_tcs_ctrl_node() -> CmdTreeNode:
|
|
|
|
node = CmdTreeNode(
|
|
|
|
"tcs_ctrl", "TCS Controller", hide_children_which_are_leaves=True
|
|
|
|
)
|
|
|
|
node.add_child(CTN(CmdStr.ENABLE_TEMP_SET, CmdInfo.ENABLE_TEMP_SET))
|
|
|
|
node.add_child(
|
|
|
|
CTN(CmdStr.REQUEST_PRIMARY_TEMP_SET, CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
|
|
|
)
|
|
|
|
node.add_child(CTN(CmdStr.REQUEST_DEVICE_TEMP_SET, CmdInfo.REQUEST_DEVICE_TEMP_SET))
|
|
|
|
node.add_child(CTN(CmdStr.REQUEST_DEVICE_SUS_SET, CmdInfo.REQUEST_DEVICE_SUS_SET))
|
|
|
|
node.add_child(CTN(CmdStr.REQUEST_HEATER_INFO, CmdInfo.REQUEST_HEATER_INFO))
|
|
|
|
node.add_child(CTN(CmdStr.REQUEST_TCS_CTRL_INFO, CmdInfo.REQUEST_TCS_CTRL_INFO))
|
|
|
|
return node
|
|
|
|
|
|
|
|
|
2023-07-10 16:25:44 +02:00
|
|
|
@tmtc_definitions_provider
|
|
|
|
def add_tcs_ctrl_cmds(defs: TmtcDefinitionWrapper):
|
|
|
|
oce = OpCodeEntry()
|
2023-11-22 10:17:05 +01:00
|
|
|
oce.add(keys=CmdStr.ENABLE_TEMP_SET, info=CmdInfo.ENABLE_TEMP_SET)
|
|
|
|
oce.add(keys=CmdStr.REQUEST_PRIMARY_TEMP_SET, info=CmdInfo.REQUEST_PRIMARY_TEMP_SET)
|
|
|
|
oce.add(keys=CmdStr.REQUEST_DEVICE_TEMP_SET, info=CmdInfo.REQUEST_DEVICE_TEMP_SET)
|
|
|
|
oce.add(keys=CmdStr.REQUEST_DEVICE_SUS_SET, info=CmdInfo.REQUEST_DEVICE_SUS_SET)
|
|
|
|
oce.add(keys=CmdStr.REQUEST_HEATER_INFO, info=CmdInfo.REQUEST_HEATER_INFO)
|
|
|
|
oce.add(keys=CmdStr.REQUEST_TCS_CTRL_INFO, info=CmdInfo.REQUEST_TCS_CTRL_INFO)
|
2023-07-10 16:25:44 +02:00
|
|
|
defs.add_service(
|
|
|
|
name=CustomServiceList.TCS_CTRL,
|
|
|
|
info="TCS controller",
|
|
|
|
op_code_entry=oce,
|
|
|
|
)
|