eive-tmtc/pus_tc/system/acs.py

124 lines
3.9 KiB
Python
Raw Normal View History

import enum
2022-03-22 19:29:55 +01:00
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_200_mode import Modes
2022-03-22 10:14:22 +01:00
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
2022-03-22 19:29:55 +01:00
from .common import command_assembly
2022-03-07 11:07:54 +01:00
class AcsOpCodes:
2022-03-22 09:54:57 +01:00
ACS_ASS_A_SIDE = ["0", "acs-a"]
ACS_ASS_B_SIDE = ["1", "acs-b"]
ACS_ASS_DUAL_MODE = ["2", "acs-d"]
ACS_ASS_OFF = ["3", "acs-off"]
ACS_ASS_A_ON = ["4", "acs-ao"]
ACS_ASS_B_ON = ["5", "acs-bo"]
ACS_ASS_DUAL_ON = ["6", "acs-do"]
2022-03-22 10:14:22 +01:00
class SusOpCodes:
SUS_ASS_NOM_SIDE = ["0", "sus-nom"]
SUS_ASS_RED_SIDE = ["1", "sus-red"]
SUS_ASS_DUAL_MODE = ["2", "sus-d"]
SUS_ASS_OFF = ["3", "sus-off"]
2022-03-22 09:54:57 +01:00
class DualSideSubmodes(enum.IntEnum):
A_SIDE = 0
B_SIDE = 1
DUAL_SIDE = 2
def pack_acs_command(tc_queue: TcQueueT, op_code: str):
2022-03-07 11:07:54 +01:00
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
info="Switching to ACS board assembly A side",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
info="Switching to ACS board assembly B side",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE,
tc_queue=tc_queue,
info="Switching to ACS board assembly dual mode",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_A_ON:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.ON,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
info="Switching ACS board assembly A side on",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_B_ON:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
info="Switching ACS board assembly B side on",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
info="Switching ACS board assembly dual side on",
)
2022-03-07 17:02:44 +01:00
if op_code in AcsOpCodes.ACS_ASS_OFF:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=ACS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info="Switching to ACS board assembly off",
)
2022-03-22 10:14:22 +01:00
def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=SUS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
info="Switching to SUS board to nominal side",
)
2022-03-22 10:14:22 +01:00
if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=SUS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
info="Switching to SUS board to redundant side",
)
2022-03-22 10:14:22 +01:00
if op_code in SusOpCodes.SUS_ASS_OFF:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 10:14:22 +01:00
object_id=SUS_BOARD_ASS_ID,
2022-03-22 09:54:57 +01:00
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info="Switching SUS board off",
2022-03-07 11:07:54 +01:00
)
2022-03-22 11:05:48 +01:00
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
2022-03-22 19:29:55 +01:00
command_assembly(
2022-03-22 11:05:48 +01:00
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE,
tc_queue=tc_queue,
info="Switching to SUS board to dual side",
)