eive-tmtc/pus_tc/system/acs.py

34 lines
1011 B
Python

import enum
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices
from config.object_ids import ACS_BOARD_ASS_ID
class AcsOpCodes:
ACS_ASS_A_SIDE = ["0", "a"]
ACS_ASS_B_SIDE = ["1", "b"]
ACS_ASS_DUAL_MODE = ["2", "d"]
class AcsBoardSubmodes(enum.IntEnum):
A_SIDE = 0
B_SIDE = 1
DUAL_SIDE = 2
def pack_acs_command(tc_queue: TcQueueT, op_code: str):
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
tc_queue.appendleft(
(QueueCommands.PRINT, "Switching to ACS board assembly A side")
)
mode_data = pack_mode_data(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=AcsBoardSubmodes.A_SIDE,
)
cmd = PusTelecommand(
service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data
)
tc_queue.appendleft(cmd.pack_command_tuple())