75 lines
2.8 KiB
Python
75 lines
2.8 KiB
Python
from .defs import CtrlSetId
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
from eive_tmtc.config.object_ids import TCS_CONTROLLER, TCS_SUBSYSTEM_ID
|
|
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
|
from eive_tmtc.tmtc.tcs.brd_assy import pack_tcs_ass_cmds
|
|
from tmtccmd.config.tmtc import (
|
|
tmtc_definitions_provider,
|
|
TmtcDefinitionWrapper,
|
|
OpCodeEntry,
|
|
)
|
|
from tmtccmd.tc import DefaultPusQueueHelper
|
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
|
from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
|
|
|
|
|
|
class OpCodeSys:
|
|
OFF = ["off"]
|
|
NML = ["nml"]
|
|
REQUEST_PRIMARY_TEMP_SET = ["temp"]
|
|
REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
|
|
REQUEST_DEVICE_SUS_SET = ["temp_sus"]
|
|
|
|
|
|
class InfoSys:
|
|
OFF = "Switch TCS subsystem OFF"
|
|
NML = "Switch TCS subsystem NORMAL (nominal)"
|
|
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"
|
|
|
|
|
|
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
|
if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
|
|
sensor_set_sid = make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS)
|
|
q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
|
|
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
|
|
if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
|
|
q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
|
|
q.add_pus_tc(
|
|
generate_one_hk_command(make_sid(TCS_CONTROLLER, CtrlSetId.DEVICE_SENSORS))
|
|
)
|
|
if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
|
|
q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
|
|
q.add_pus_tc(
|
|
generate_one_hk_command(
|
|
make_sid(TCS_CONTROLLER, CtrlSetId.SUS_TEMP_SENSORS)
|
|
)
|
|
)
|
|
if op_code in OpCodeSys.OFF:
|
|
q.add_log_cmd(InfoSys.OFF)
|
|
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.OFF, 0, q, InfoSys.OFF)
|
|
if op_code in OpCodeSys.NML:
|
|
q.add_log_cmd(InfoSys.NML)
|
|
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
|
|
pack_tcs_ass_cmds(q, op_code)
|
|
|
|
|
|
@tmtc_definitions_provider
|
|
def add_tcs_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
|
oce = OpCodeEntry()
|
|
oce.add(keys=OpCodeSys.OFF, info=InfoSys.OFF)
|
|
oce.add(keys=OpCodeSys.NML, info=InfoSys.NML)
|
|
oce.add(
|
|
keys=OpCodeSys.REQUEST_PRIMARY_TEMP_SET, info=InfoSys.REQUEST_PRIMARY_TEMP_SET
|
|
)
|
|
oce.add(
|
|
keys=OpCodeSys.REQUEST_DEVICE_TEMP_SET, info=InfoSys.REQUEST_DEVICE_TEMP_SET
|
|
)
|
|
oce.add(keys=OpCodeSys.REQUEST_DEVICE_SUS_SET, info=InfoSys.REQUEST_DEVICE_SUS_SET)
|
|
defs.add_service(
|
|
name=CustomServiceList.TCS,
|
|
info="TCS Board",
|
|
op_code_entry=oce,
|
|
)
|