add TCS subsystem commands

This commit is contained in:
Robin Müller 2023-01-20 11:28:07 +01:00
parent d6c35262bf
commit b3b98eb2d2
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 60 additions and 23 deletions

View File

@ -126,6 +126,7 @@ SUS_11_R_LOC_XBYMZB_PT_ZB = bytes([0x44, 0x12, 0x00, 0x43])
# System and Assembly Objects # System and Assembly Objects
ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01]) ACS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x01])
PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02]) PL_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x02])
TCS_SUBSYSTEM_ID = bytes([0x73, 0x01, 0x00, 0x03])
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01]) ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02]) SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03]) TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])

View File

@ -15,25 +15,39 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
) )
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID, TCS_CONTROLLER from eive_tmtc.config.object_ids import (
TCS_BOARD_ASS_ID,
TCS_CONTROLLER,
TCS_SUBSYSTEM_ID,
)
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
class OpCode: class OpCodeAssy:
TCS_BOARD_ASS_NORMAL = ["0", "normal"] TCS_BOARD_ASS_NORMAL = ["nml"]
TCS_BOARD_ASS_OFF = ["1", "off"] TCS_BOARD_ASS_OFF = ["off"]
class OpCodeSys:
OFF = ["off"]
NML = ["nml"]
REQUEST_PRIMARY_TEMP_SET = ["temp"] REQUEST_PRIMARY_TEMP_SET = ["temp"]
REQUEST_DEVICE_TEMP_SET = ["temp_devs"] REQUEST_DEVICE_TEMP_SET = ["temp_devs"]
REQUEST_DEVICE_SUS_SET = ["temp_sus"] REQUEST_DEVICE_SUS_SET = ["temp_sus"]
class Info: 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_PRIMARY_TEMP_SET = "Request HK set of primary sensor temperatures"
REQUEST_DEVICE_TEMP_SET = ( REQUEST_DEVICE_TEMP_SET = (
"Request HK set of device sensor (not dedicated sensors) temperatures" "Request HK set of device sensor (not dedicated sensors) temperatures"
) )
REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures" REQUEST_DEVICE_SUS_SET = "Request HK set of the SUS temperatures"
class InfoAssy:
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on" TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off" TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
@ -48,57 +62,79 @@ class SetId(enum.IntEnum):
def add_tcs_cmds(defs: TmtcDefinitionWrapper): def add_tcs_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry() oce = OpCodeEntry()
oce.add( oce.add(
keys=OpCode.TCS_BOARD_ASS_NORMAL, keys=OpCodeAssy.TCS_BOARD_ASS_NORMAL,
info=Info.TCS_BOARD_ASS_NORMAL, info=InfoAssy.TCS_BOARD_ASS_NORMAL,
) )
oce.add( oce.add(
keys=OpCode.TCS_BOARD_ASS_OFF, keys=OpCodeAssy.TCS_BOARD_ASS_OFF,
info=Info.TCS_BOARD_ASS_OFF, info=InfoAssy.TCS_BOARD_ASS_OFF,
) )
oce.add(keys=OpCode.REQUEST_PRIMARY_TEMP_SET, info=Info.REQUEST_PRIMARY_TEMP_SET)
oce.add(keys=OpCode.REQUEST_DEVICE_TEMP_SET, info=Info.REQUEST_DEVICE_TEMP_SET)
oce.add(keys=OpCode.REQUEST_DEVICE_SUS_SET, info=Info.REQUEST_DEVICE_SUS_SET)
defs.add_service( defs.add_service(
name=CustomServiceList.TCS.value, name=CustomServiceList.TCS_ASS.value,
info="TCS Board Assembly", info="TCS Board Assembly",
op_code_entry=oce, op_code_entry=oce,
) )
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,
)
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str): def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCode.REQUEST_PRIMARY_TEMP_SET: if op_code in OpCodeSys.REQUEST_PRIMARY_TEMP_SET:
sensor_set_sid = make_sid(TCS_CONTROLLER, SetId.PRIMARY_SENSORS) sensor_set_sid = make_sid(TCS_CONTROLLER, SetId.PRIMARY_SENSORS)
q.add_log_cmd(Info.REQUEST_PRIMARY_TEMP_SET) q.add_log_cmd(InfoSys.REQUEST_PRIMARY_TEMP_SET)
q.add_pus_tc(generate_one_hk_command(sensor_set_sid)) q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
if op_code in OpCode.REQUEST_DEVICE_TEMP_SET: if op_code in OpCodeSys.REQUEST_DEVICE_TEMP_SET:
q.add_log_cmd(Info.REQUEST_DEVICE_TEMP_SET) q.add_log_cmd(InfoSys.REQUEST_DEVICE_TEMP_SET)
q.add_pus_tc( q.add_pus_tc(
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.DEVICE_SENSORS)) generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.DEVICE_SENSORS))
) )
if op_code in OpCode.REQUEST_DEVICE_SUS_SET: if op_code in OpCodeSys.REQUEST_DEVICE_SUS_SET:
q.add_log_cmd(Info.REQUEST_DEVICE_SUS_SET) q.add_log_cmd(InfoSys.REQUEST_DEVICE_SUS_SET)
q.add_pus_tc( q.add_pus_tc(
generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.SUS_TEMP_SENSORS)) generate_one_hk_command(make_sid(TCS_CONTROLLER, SetId.SUS_TEMP_SENSORS))
) )
if op_code in OpCodeSys.OFF:
q.add_log_cmd(InfoSys.OFF)
q.add_pus_tc(
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)
q.add_pus_tc(
pack_mode_cmd_with_info(TCS_SUBSYSTEM_ID, Mode.NORMAL, 0, q, InfoSys.OFF)
)
pack_tcs_ass_cmds(q, op_code) pack_tcs_ass_cmds(q, op_code)
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str): def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCode.TCS_BOARD_ASS_NORMAL: if op_code in OpCodeAssy.TCS_BOARD_ASS_NORMAL:
pack_mode_cmd_with_info( pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Mode.NORMAL, mode=Mode.NORMAL,
submode=0, submode=0,
q=q, q=q,
info=Info.TCS_BOARD_ASS_NORMAL, info=InfoAssy.TCS_BOARD_ASS_NORMAL,
) )
if op_code in OpCode.TCS_BOARD_ASS_OFF: if op_code in OpCodeAssy.TCS_BOARD_ASS_OFF:
pack_mode_cmd_with_info( pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Mode.OFF, mode=Mode.OFF,
submode=0, submode=0,
q=q, q=q,
info=Info.TCS_BOARD_ASS_OFF, info=InfoAssy.TCS_BOARD_ASS_OFF,
) )