added commands to request HKs from GOmSpace devices

This commit is contained in:
Robin Müller 2022-03-14 10:03:50 +01:00
parent 3f1ee29d1f
commit 7898dc2c16
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 80 additions and 45 deletions

View File

@ -23,7 +23,16 @@ class GomspaceDeviceActionIds(enum.IntEnum):
class GomspaceOpCodes(enum.Enum): class GomspaceOpCodes(enum.Enum):
PRINT_SWITCH_V_I = "32" # Request HK
REQUEST_HK_ONCE = "128"
PRINT_SWITCH_V_I = "129"
class SetIds:
PDU_1 = 0x01
PDU_2 = 0x02
P60_DOCK = 0x03
ACU = 0x04
class TableIds: class TableIds:

View File

@ -187,6 +187,11 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
keys=P60OpCodes.STACK_5V_OFF.value, keys=P60OpCodes.STACK_5V_OFF.value,
info="P60 Dock: Turn stack 5V off", info="P60 Dock: Turn stack 5V off",
) )
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_HK_ONCE.value,
info="P60 Dock: Request HK once",
)
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value,
@ -272,15 +277,17 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=Pdu1OpCodes.REQUEST_HK_ONCE.value, keys=GomspaceOpCodes.REQUEST_HK_ONCE.value,
info="PDU1: Request HK once" info="PDU1: Request HK once",
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value,
info="PDU1: Print Switches, Voltages, Currents", info="PDU1: Print Switches, Voltages, Currents",
) )
add_op_code_entry(op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests") add_op_code_entry(
op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests"
)
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,
name=CustomServiceList.PDU1.value, name=CustomServiceList.PDU1.value,
@ -333,9 +340,8 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=Pdu2OpCodes.Q7S_OFF.value, keys=GomspaceOpCodes.REQUEST_HK_ONCE.value,
info="Q7S Off", info="PDU2: Request HK once",
options={OpCodeDictKeys.TIMEOUT: 2.0},
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
@ -525,49 +531,52 @@ def add_ploc_cmds(cmd_dict: ServiceOpCodeDictT):
def add_system_cmds(cmd_dict: ServiceOpCodeDictT): def add_system_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.system.acs import AcsOpCodes from pus_tc.system.acs import AcsOpCodes
default_opts = generate_op_code_options(enter_listener_mode=False, custom_timeout=8.0)
default_opts = generate_op_code_options(
enter_listener_mode=False, custom_timeout=8.0
)
op_code_dict = dict() op_code_dict = dict()
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_A_SIDE, keys=AcsOpCodes.ACS_ASS_A_SIDE,
info="Switch to ACS board A side", info="Switch to ACS board A side",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_B_SIDE, keys=AcsOpCodes.ACS_ASS_B_SIDE,
info="Switch to ACS board B side", info="Switch to ACS board B side",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_DUAL_MODE, keys=AcsOpCodes.ACS_ASS_DUAL_MODE,
info="Switch to ACS board dual mode", info="Switch to ACS board dual mode",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_A_ON, keys=AcsOpCodes.ACS_ASS_A_ON,
info="Switch ACS board A side on", info="Switch ACS board A side on",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_B_ON, keys=AcsOpCodes.ACS_ASS_B_ON,
info="Switch ACS board B side on", info="Switch ACS board B side on",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_DUAL_ON, keys=AcsOpCodes.ACS_ASS_DUAL_ON,
info="Switch ACS board dual mode on", info="Switch ACS board dual mode on",
options=default_opts options=default_opts,
) )
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, op_code_dict=op_code_dict,
keys=AcsOpCodes.ACS_ASS_OFF, keys=AcsOpCodes.ACS_ASS_OFF,
info="Switch off ACS board", info="Switch off ACS board",
options=default_opts options=default_opts,
) )
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,

View File

@ -7,7 +7,9 @@
""" """
from tmtccmd.config.definitions import QueueCommands from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc.packer import TcQueueT
from tmtccmd.tc.service_3_housekeeping import generate_one_hk_command, make_sid
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from config.object_ids import P60_DOCK_HANDLER
class P60OpCodes(enum.Enum): class P60OpCodes(enum.Enum):
@ -110,6 +112,11 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.REQUEST_HK_ONCE.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Requesting HK Table Once"))
hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_DOCK)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents") (QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")

View File

@ -28,18 +28,9 @@ class Pdu1OpCodes(enum.Enum):
SCEX_ON = "12" SCEX_ON = "12"
SCEX_OFF = "13" SCEX_OFF = "13"
# Request HK
REQUEST_HK_ONCE = "16"
TESTS = "32" TESTS = "32"
class SetIds:
PDU_1 = 0x01
PDU_2 = 0x02
P60_DOCK = 0x03
ACU = 0x04
class PDU1TestProcedure: class PDU1TestProcedure:
""" """
@brief Use this class to define the tests to perform for the PDU2. @brief Use this class to define the tests to perform for the PDU2.
@ -163,19 +154,6 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.REQUEST_HK_ONCE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Requesting HK Table Once"))
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
)
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SYRLINKS_ON.value: if op_code == Pdu1OpCodes.SYRLINKS_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on"))
command = pack_set_param_command( command = pack_set_param_command(
@ -212,6 +190,19 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.REQUEST_HK_ONCE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Requesting HK Table Once"))
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
)
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping: if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

View File

@ -8,8 +8,10 @@
""" """
from tmtccmd.config.definitions import QueueCommands from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc.packer import TcQueueT
from tmtccmd.tc.service_3_housekeeping import generate_one_hk_command, make_sid
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from gomspace.gomspace_pdu_definitions import * from gomspace.gomspace_pdu_definitions import *
from config.object_ids import PDU_2_HANDLER_ID
class Pdu2OpCodes(enum.Enum): class Pdu2OpCodes(enum.Enum):
@ -118,6 +120,11 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
Channel.off, Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.REQUEST_HK_ONCE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting HK Table Once"))
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes") (QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")

View File

@ -26,32 +26,44 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching to ACS board assembly A side") (QueueCommands.PRINT, "Switching to ACS board assembly A side")
) )
command_acs_board(mode=Modes.NORMAL, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.NORMAL, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_B_SIDE: if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching to ACS board assembly B side") (QueueCommands.PRINT, "Switching to ACS board assembly B side")
) )
command_acs_board(mode=Modes.NORMAL, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.NORMAL, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE: if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching to ACS board assembly dual mode") (QueueCommands.PRINT, "Switching to ACS board assembly dual mode")
) )
command_acs_board(mode=Modes.NORMAL, submode=AcsBoardSubmodes.DUAL_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.NORMAL, submode=AcsBoardSubmodes.DUAL_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_A_ON: if op_code in AcsOpCodes.ACS_ASS_A_ON:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching ACS board assembly A side on") (QueueCommands.PRINT, "Switching ACS board assembly A side on")
) )
command_acs_board(mode=Modes.ON, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.ON, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_B_ON: if op_code in AcsOpCodes.ACS_ASS_B_ON:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching ACS board assembly B side on") (QueueCommands.PRINT, "Switching ACS board assembly B side on")
) )
command_acs_board(mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON: if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching ACS board assembly dual side on") (QueueCommands.PRINT, "Switching ACS board assembly dual side on")
) )
command_acs_board(mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue) command_acs_board(
mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue
)
if op_code in AcsOpCodes.ACS_ASS_OFF: if op_code in AcsOpCodes.ACS_ASS_OFF:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "Switching to ACS board assembly off") (QueueCommands.PRINT, "Switching to ACS board assembly off")

View File

@ -23,7 +23,7 @@ class ActionIds(enum.IntEnum):
class SetIds(enum.IntEnum): class SetIds(enum.IntEnum):
HK = 5 HK = 5
class OpCodes: class OpCodes:

View File

@ -15,7 +15,7 @@ from config.object_ids import (
GPS_HANDLER_0_ID, GPS_HANDLER_0_ID,
GPS_HANDLER_1_ID, GPS_HANDLER_1_ID,
BPX_HANDLER_ID, BPX_HANDLER_ID,
CORE_CONTROLLER_ID CORE_CONTROLLER_ID,
) )
LOGGER = get_console_logger() LOGGER = get_console_logger()