2022-03-07 10:24:45 +01:00
|
|
|
import enum
|
2022-07-04 17:59:09 +02:00
|
|
|
|
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-03-22 10:14:22 +01:00
|
|
|
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
|
2022-03-07 10:24:45 +01:00
|
|
|
|
2022-05-17 10:41:45 +02:00
|
|
|
from .common import command_mode
|
2022-03-07 10:24:45 +01:00
|
|
|
|
2022-05-19 13:20:22 +02:00
|
|
|
|
2022-03-07 11:07:54 +01:00
|
|
|
class AcsOpCodes:
|
2022-10-18 11:41:14 +02:00
|
|
|
ACS_ASS_A_SIDE = ["0", "a"]
|
|
|
|
ACS_ASS_B_SIDE = ["1", "b"]
|
|
|
|
ACS_ASS_DUAL_MODE = ["2", "dual"]
|
|
|
|
ACS_ASS_OFF = ["3", "off"]
|
|
|
|
ACS_ASS_A_ON = ["4", "a_on"]
|
|
|
|
ACS_ASS_B_ON = ["5", "b_on"]
|
|
|
|
ACS_ASS_DUAL_ON = ["6", "dual_on"]
|
2022-03-22 10:14:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
class SusOpCodes:
|
2022-10-18 11:41:14 +02:00
|
|
|
SUS_ASS_NOM_SIDE = ["0", "nom"]
|
|
|
|
SUS_ASS_RED_SIDE = ["1", "red"]
|
|
|
|
SUS_ASS_DUAL_MODE = ["2", "dual"]
|
|
|
|
SUS_ASS_OFF = ["3", "off"]
|
2022-03-07 10:24:45 +01:00
|
|
|
|
|
|
|
|
2022-03-22 09:54:57 +01:00
|
|
|
class DualSideSubmodes(enum.IntEnum):
|
2022-03-07 10:24:45 +01:00
|
|
|
A_SIDE = 0
|
|
|
|
B_SIDE = 1
|
|
|
|
DUAL_SIDE = 2
|
|
|
|
|
|
|
|
|
2022-08-08 16:32:18 +02:00
|
|
|
def pack_acs_command(q: DefaultPusQueueHelper, op_code: str):
|
2022-03-07 11:07:54 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching to ACS board assembly A side",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching to ACS board assembly B side",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching to ACS board assembly dual mode",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_A_ON:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching ACS board assembly A side on",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_B_ON:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching ACS board assembly B side on",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching ACS board assembly dual side on",
|
2022-03-14 10:03:50 +01:00
|
|
|
)
|
2022-03-07 17:02:44 +01:00
|
|
|
if op_code in AcsOpCodes.ACS_ASS_OFF:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
info="Switching to ACS board assembly off",
|
|
|
|
)
|
2022-03-22 10:14:22 +01:00
|
|
|
|
|
|
|
|
2022-08-08 16:32:18 +02:00
|
|
|
def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str):
|
2022-03-22 10:14:22 +01:00
|
|
|
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
|
2022-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
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-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
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-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
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,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 09:54:57 +01:00
|
|
|
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-05-17 10:41:45 +02:00
|
|
|
command_mode(
|
2022-03-22 11:05:48 +01:00
|
|
|
object_id=SUS_BOARD_ASS_ID,
|
|
|
|
mode=Modes.NORMAL,
|
|
|
|
submode=DualSideSubmodes.DUAL_SIDE,
|
2022-07-04 17:59:09 +02:00
|
|
|
q=q,
|
2022-03-22 11:05:48 +01:00
|
|
|
info="Switching to SUS board to dual side",
|
|
|
|
)
|