added TCS board ASS CMDS

This commit is contained in:
2022-03-22 19:29:55 +01:00
parent 46c327101e
commit cb479cc2f4
9 changed files with 142 additions and 51 deletions

View File

@ -1,9 +1,10 @@
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 tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_200_mode import Modes
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
from .common import command_assembly
class AcsOpCodes:
ACS_ASS_A_SIDE = ["0", "acs-a"]
@ -30,7 +31,7 @@ class DualSideSubmodes(enum.IntEnum):
def pack_acs_command(tc_queue: TcQueueT, op_code: str):
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
@ -38,7 +39,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly A side",
)
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
@ -46,7 +47,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly B side",
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE,
@ -54,7 +55,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly dual mode",
)
if op_code in AcsOpCodes.ACS_ASS_A_ON:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.A_SIDE,
@ -62,7 +63,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly A side on",
)
if op_code in AcsOpCodes.ACS_ASS_B_ON:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
@ -70,7 +71,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly B side on",
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
@ -78,7 +79,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly dual side on",
)
if op_code in AcsOpCodes.ACS_ASS_OFF:
command_acs_board(
command_assembly(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
@ -89,7 +90,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
command_acs_board(
command_assembly(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
@ -97,7 +98,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching to SUS board to nominal side",
)
if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
command_acs_board(
command_assembly(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
@ -105,7 +106,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching to SUS board to redundant side",
)
if op_code in SusOpCodes.SUS_ASS_OFF:
command_acs_board(
command_assembly(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
@ -113,25 +114,10 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching SUS board off",
)
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
command_acs_board(
command_assembly(
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",
)
def command_acs_board(
object_id: bytes, mode: Modes, submode: int, tc_queue: TcQueueT, info: str
):
tc_queue.appendleft((QueueCommands.PRINT, info))
mode_data = pack_mode_data(
object_id=object_id,
mode=mode,
submode=submode,
)
cmd = PusTelecommand(
service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data
)
tc_queue.appendleft(cmd.pack_command_tuple())