2022-08-11 19:18:01 +02:00
|
|
|
import enum
|
|
|
|
|
2022-11-29 16:53:29 +01:00
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
2022-08-12 10:18:21 +02:00
|
|
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
|
|
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
2022-08-08 16:32:18 +02:00
|
|
|
from tmtccmd.tc import DefaultPusQueueHelper
|
2022-05-05 16:15:53 +02:00
|
|
|
from tmtccmd.tc.pus_200_fsfw_modes import Modes
|
2022-08-11 19:18:01 +02:00
|
|
|
from tmtccmd.tc.pus_3_fsfw_hk import (
|
|
|
|
make_sid,
|
|
|
|
generate_one_hk_command,
|
|
|
|
)
|
2022-03-22 19:29:55 +01:00
|
|
|
|
2022-11-29 16:53:29 +01:00
|
|
|
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
|
|
|
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID, TCS_CONTROLLER
|
2022-03-22 19:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
class OpCodes:
|
2022-09-30 14:22:13 +02:00
|
|
|
TCS_BOARD_ASS_NORMAL = ["0", "normal"]
|
|
|
|
TCS_BOARD_ASS_OFF = ["1", "off"]
|
|
|
|
REQUEST_SENSOR_TEMP_SET = ["2", "temps"]
|
2022-03-22 19:29:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Info:
|
2022-08-11 19:18:01 +02:00
|
|
|
REQUEST_SENSOR_TEMP_SET = "Request HK set of primary sensor temperatures"
|
2022-03-22 19:29:55 +01:00
|
|
|
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
|
|
|
|
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
|
|
|
|
|
|
|
|
|
2022-08-11 19:18:01 +02:00
|
|
|
class SetIds(enum.IntEnum):
|
|
|
|
PRIMARY_SENSORS = 0
|
|
|
|
DEVICE_SENSORS = 1
|
|
|
|
SUS_TEMP_SENSORS = 2
|
|
|
|
|
|
|
|
|
2022-08-12 10:18:21 +02:00
|
|
|
@tmtc_definitions_provider
|
|
|
|
def add_tcs_cmds(defs: TmtcDefinitionWrapper):
|
2022-08-12 08:45:51 +02:00
|
|
|
oce = OpCodeEntry()
|
|
|
|
oce.add(
|
|
|
|
keys=OpCodes.TCS_BOARD_ASS_NORMAL,
|
|
|
|
info=Info.TCS_BOARD_ASS_NORMAL,
|
|
|
|
)
|
|
|
|
oce.add(
|
|
|
|
keys=OpCodes.TCS_BOARD_ASS_OFF,
|
|
|
|
info=Info.TCS_BOARD_ASS_OFF,
|
|
|
|
)
|
|
|
|
oce.add(keys=OpCodes.REQUEST_SENSOR_TEMP_SET, info=Info.REQUEST_SENSOR_TEMP_SET)
|
|
|
|
defs.add_service(
|
|
|
|
name=CustomServiceList.TCS.value,
|
|
|
|
info="TCS Board Assembly",
|
|
|
|
op_code_entry=oce,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-08-08 16:32:18 +02:00
|
|
|
def pack_tcs_sys_commands(q: DefaultPusQueueHelper, op_code: str):
|
2022-08-12 08:45:51 +02:00
|
|
|
if op_code in OpCodes.REQUEST_SENSOR_TEMP_SET:
|
2022-08-11 19:18:01 +02:00
|
|
|
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))
|
2022-08-12 08:45:51 +02:00
|
|
|
pack_tcs_ass_cmds(q, op_code)
|
|
|
|
|
|
|
|
|
|
|
|
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
|
2022-03-22 19:29:55 +01:00
|
|
|
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
|
2022-10-04 14:46:00 +02:00
|
|
|
pack_mode_cmd_with_info(
|
2022-03-22 19:29:55 +01:00
|
|
|
object_id=TCS_BOARD_ASS_ID,
|
|
|
|
mode=Modes.NORMAL,
|
|
|
|
submode=0,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 19:29:55 +01:00
|
|
|
info=Info.TCS_BOARD_ASS_NORMAL,
|
|
|
|
)
|
|
|
|
if op_code in OpCodes.TCS_BOARD_ASS_OFF:
|
2022-10-04 14:46:00 +02:00
|
|
|
pack_mode_cmd_with_info(
|
2022-03-22 19:29:55 +01:00
|
|
|
object_id=TCS_BOARD_ASS_ID,
|
2022-03-22 20:35:24 +01:00
|
|
|
mode=Modes.OFF,
|
2022-03-22 19:29:55 +01:00
|
|
|
submode=0,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 19:29:55 +01:00
|
|
|
info=Info.TCS_BOARD_ASS_OFF,
|
|
|
|
)
|