sus cmds working now

This commit is contained in:
2022-03-22 10:14:22 +01:00
parent e4caa77068
commit 6e816c4a9c
9 changed files with 404 additions and 370 deletions

View File

@ -2,7 +2,7 @@ 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
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
class AcsOpCodes:
@ -13,10 +13,13 @@ class AcsOpCodes:
ACS_ASS_A_ON = ["4", "acs-ao"]
ACS_ASS_B_ON = ["5", "acs-bo"]
ACS_ASS_DUAL_ON = ["6", "acs-do"]
SUS_ASS_NOM_SIDE = ["10", "sus-nom"]
SUS_ASS_RED_SIDE = ["11", "sus-red"]
SUS_ASS_DUAL_MODE = ["12", "sus-d"]
SUS_ASS_OFF = ["13", "sus-off"]
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"]
class DualSideSubmodes(enum.IntEnum):
@ -28,6 +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(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
@ -35,6 +39,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
@ -42,6 +47,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE,
tc_queue=tc_queue,
@ -49,6 +55,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_A_ON:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
@ -56,6 +63,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_B_ON:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
@ -63,6 +71,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
@ -70,27 +79,34 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
if op_code in AcsOpCodes.ACS_ASS_OFF:
command_acs_board(
object_id=ACS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info="Switching to ACS board assembly off",
)
if op_code in AcsOpCodes.SUS_ASS_NOM_SIDE:
def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
command_acs_board(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE,
tc_queue=tc_queue,
info="Switching to SUS board to nominal side",
)
if op_code in AcsOpCodes.SUS_ASS_RED_SIDE:
if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
command_acs_board(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE,
tc_queue=tc_queue,
info="Switching to SUS board to redundant side",
)
if op_code in AcsOpCodes.SUS_ASS_OFF:
if op_code in SusOpCodes.SUS_ASS_OFF:
command_acs_board(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
@ -98,10 +114,10 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
)
def command_acs_board(mode: Modes, submode: int, tc_queue: TcQueueT, info: str):
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=ACS_BOARD_ASS_ID,
object_id=object_id,
mode=mode,
submode=submode,
)