eive-tmtc/pus_tc/system/tcs.py

54 lines
1.5 KiB
Python

import enum
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import Modes
from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid,
generate_one_diag_command,
generate_one_hk_command,
)
from .common import command_mode
from config.object_ids import TCS_BOARD_ASS_ID, TCS_CONTROLLER
class OpCodes:
TCS_BOARD_ASS_NORMAL = ["0", "tcs-normal"]
TCS_BOARD_ASS_OFF = ["1", "tcs-off"]
REQUEST_ALL_TEMP_HK = ["temp-hk"]
class Info:
REQUEST_SENSOR_TEMP_SET = "Request HK set of primary sensor temperatures"
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
class SetIds(enum.IntEnum):
PRIMARY_SENSORS = 0
DEVICE_SENSORS = 1
SUS_TEMP_SENSORS = 2
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.REQUEST_ALL_TEMP_HK:
sensor_set_sid = make_sid(TCS_CONTROLLER, SetIds.PRIMARY_SENSORS)
q.add_log_cmd(Info.REQUEST_SENSOR_TEMP_SET)
q.add_pus_tc(generate_one_hk_command(sensor_set_sid))
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
command_mode(
object_id=TCS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=0,
q=q,
info=Info.TCS_BOARD_ASS_NORMAL,
)
if op_code in OpCodes.TCS_BOARD_ASS_OFF:
command_mode(
object_id=TCS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
q=q,
info=Info.TCS_BOARD_ASS_OFF,
)