From de68ad9341fbe5570b84305f33562702e3486364 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 9 Mar 2022 19:05:39 +0100 Subject: [PATCH 01/14] del obj info struct --- config/object_ids.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/object_ids.py b/config/object_ids.py index b2c9756..35bc405 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -70,11 +70,6 @@ PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00]) ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01]) -class ObjectInfo: - id: int = 0 - name: str = "" - - def get_object_ids() -> ObjectIdDictT: global __OBJECT_ID_DICT if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH): From eedb45e4f34bd77d328745808e9acfe4668a1e35 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 9 Mar 2022 19:21:35 +0100 Subject: [PATCH 02/14] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index 86cf0bf..1aeb44e 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 86cf0bf9530f0d31784ff96b025f8b778d1732b1 +Subproject commit 1aeb44e37f04ec6605a787e28ec8c5d1273ae7c1 From b6360b9c5c28bd1b78c5a8ceef2fbae0799d967a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 09:38:31 +0100 Subject: [PATCH 03/14] bump tmtccmd --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index 1aeb44e..47c69a0 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 1aeb44e37f04ec6605a787e28ec8c5d1273ae7c1 +Subproject commit 47c69a0c945ae3f81bfadbff18a4521de03992bd From 3f1ee29d1f518da67a2fe0f6323a50b4f8b6fb87 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 09:56:34 +0100 Subject: [PATCH 04/14] added OpCode to request PDU1 HK --- pus_tc/cmd_definitions.py | 7 +++++- pus_tc/devs/pdu1.py | 47 ++++++++++++++++++++++++++------------- tmtccmd | 2 +- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 5ea1a2d..40a0ec8 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -200,7 +200,6 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): ) op_code_dict = dict() - add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU1 Tests") add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu1OpCodes.TCS_BOARD_ON.value, @@ -271,11 +270,17 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): keys=Pdu1OpCodes.SCEX_OFF.value, info="PDU1: Turn Solar Cell Experiment off", ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu1OpCodes.REQUEST_HK_ONCE.value, + info="PDU1: Request HK once" + ) add_op_code_entry( op_code_dict=op_code_dict, keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, info="PDU1: Print Switches, Voltages, Currents", ) + add_op_code_entry(op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests") add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.PDU1.value, diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index 333002d..121ecf7 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -5,27 +5,39 @@ """ from tmtccmd.config.definitions import QueueCommands 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_pdu_definitions import * +from config.object_ids import PDU_1_HANDLER_ID class Pdu1OpCodes(enum.Enum): - TESTS = "0" - TCS_BOARD_ON = "1" - TCS_BOARD_OFF = "2" - STAR_TRACKER_ON = "3" - STAR_TRACKER_OFF = "4" - SUS_NOMINAL_ON = "5" - SUS_NOMINAL_OFF = "6" - ACS_A_SIDE_ON = "7" - ACS_A_SIDE_OFF = "8" - SYRLINKS_ON = "9" - SYRLINKS_OFF = "10" - MGT_ON = "11" - MGT_OFF = "12" + TCS_BOARD_ON = "0" + TCS_BOARD_OFF = "1" + STAR_TRACKER_ON = "2" + STAR_TRACKER_OFF = "3" + SUS_NOMINAL_ON = "4" + SUS_NOMINAL_OFF = "5" + ACS_A_SIDE_ON = "6" + ACS_A_SIDE_OFF = "7" + SYRLINKS_ON = "8" + SYRLINKS_OFF = "9" + MGT_ON = "10" + MGT_OFF = "11" # Solar Cell Experiment - SCEX_ON = "13" - SCEX_OFF = "14" + SCEX_ON = "12" + SCEX_OFF = "13" + + # Request HK + REQUEST_HK_ONCE = "16" + TESTS = "32" + + +class SetIds: + PDU_1 = 0x01 + PDU_2 = 0x02 + P60_DOCK = 0x03 + ACU = 0x04 class PDU1TestProcedure: @@ -151,6 +163,11 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): Channel.off, ) 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") diff --git a/tmtccmd b/tmtccmd index 47c69a0..42e9431 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 47c69a0c945ae3f81bfadbff18a4521de03992bd +Subproject commit 42e943108f42c8d51333f11f325e356791d460b1 From 7898dc2c16841d09962e31ce3a6479ab005b7198 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 10:03:50 +0100 Subject: [PATCH 05/14] added commands to request HKs from GOmSpace devices --- gomspace/gomspace_common.py | 11 ++++++++++- pus_tc/cmd_definitions.py | 37 +++++++++++++++++++++++-------------- pus_tc/devs/p60dock.py | 7 +++++++ pus_tc/devs/pdu1.py | 35 +++++++++++++---------------------- pus_tc/devs/pdu2.py | 7 +++++++ pus_tc/system/acs.py | 24 ++++++++++++++++++------ pus_tc/system/core.py | 2 +- pus_tm/hk_handling.py | 2 +- 8 files changed, 80 insertions(+), 45 deletions(-) diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py index 38242c9..54d80bf 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -23,7 +23,16 @@ class GomspaceDeviceActionIds(enum.IntEnum): 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: diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 40a0ec8..21019a9 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -187,6 +187,11 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): keys=P60OpCodes.STACK_5V_OFF.value, 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( op_code_dict=op_code_dict, keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, @@ -272,15 +277,17 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): ) add_op_code_entry( op_code_dict=op_code_dict, - keys=Pdu1OpCodes.REQUEST_HK_ONCE.value, - info="PDU1: Request HK once" + keys=GomspaceOpCodes.REQUEST_HK_ONCE.value, + info="PDU1: Request HK once", ) add_op_code_entry( op_code_dict=op_code_dict, keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, 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( srv_op_code_dict=cmd_dict, name=CustomServiceList.PDU1.value, @@ -333,9 +340,8 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): ) add_op_code_entry( op_code_dict=op_code_dict, - keys=Pdu2OpCodes.Q7S_OFF.value, - info="Q7S Off", - options={OpCodeDictKeys.TIMEOUT: 2.0}, + keys=GomspaceOpCodes.REQUEST_HK_ONCE.value, + info="PDU2: Request HK once", ) add_op_code_entry( op_code_dict=op_code_dict, @@ -525,49 +531,52 @@ def add_ploc_cmds(cmd_dict: ServiceOpCodeDictT): def add_system_cmds(cmd_dict: ServiceOpCodeDictT): 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() add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_A_SIDE, info="Switch to ACS board A side", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_B_SIDE, info="Switch to ACS board B side", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_DUAL_MODE, info="Switch to ACS board dual mode", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_A_ON, info="Switch ACS board A side on", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_B_ON, info="Switch ACS board B side on", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_DUAL_ON, info="Switch ACS board dual mode on", - options=default_opts + options=default_opts, ) add_op_code_entry( op_code_dict=op_code_dict, keys=AcsOpCodes.ACS_ASS_OFF, info="Switch off ACS board", - options=default_opts + options=default_opts, ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, diff --git a/pus_tc/devs/p60dock.py b/pus_tc/devs/p60dock.py index d4ccdca..1d48504 100644 --- a/pus_tc/devs/p60dock.py +++ b/pus_tc/devs/p60dock.py @@ -7,7 +7,9 @@ """ from tmtccmd.config.definitions import QueueCommands 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 config.object_ids import P60_DOCK_HANDLER class P60OpCodes(enum.Enum): @@ -110,6 +112,11 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st Channel.off, ) 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: tc_queue.appendleft( (QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents") diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index 121ecf7..02026c6 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -28,18 +28,9 @@ class Pdu1OpCodes(enum.Enum): SCEX_ON = "12" SCEX_OFF = "13" - # Request HK - REQUEST_HK_ONCE = "16" TESTS = "32" -class SetIds: - PDU_1 = 0x01 - PDU_2 = 0x02 - P60_DOCK = 0x03 - ACU = 0x04 - - class PDU1TestProcedure: """ @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, ) 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: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on")) command = pack_set_param_command( @@ -212,6 +190,19 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): Channel.off, ) 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: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index 6b2b83c..d2619c3 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -8,8 +8,10 @@ """ from tmtccmd.config.definitions import QueueCommands 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_pdu_definitions import * +from config.object_ids import PDU_2_HANDLER_ID class Pdu2OpCodes(enum.Enum): @@ -118,6 +120,11 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): Channel.off, ) 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: tc_queue.appendleft( (QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes") diff --git a/pus_tc/system/acs.py b/pus_tc/system/acs.py index 8b8cc6d..3b97caf 100644 --- a/pus_tc/system/acs.py +++ b/pus_tc/system/acs.py @@ -26,32 +26,44 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str): tc_queue.appendleft( (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: tc_queue.appendleft( (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: tc_queue.appendleft( (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: tc_queue.appendleft( (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: tc_queue.appendleft( (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: tc_queue.appendleft( (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: tc_queue.appendleft( (QueueCommands.PRINT, "Switching to ACS board assembly off") diff --git a/pus_tc/system/core.py b/pus_tc/system/core.py index f98742c..61103f9 100644 --- a/pus_tc/system/core.py +++ b/pus_tc/system/core.py @@ -23,7 +23,7 @@ class ActionIds(enum.IntEnum): class SetIds(enum.IntEnum): - HK = 5 + HK = 5 class OpCodes: diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index aab0366..6e23ac0 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -15,7 +15,7 @@ from config.object_ids import ( GPS_HANDLER_0_ID, GPS_HANDLER_1_ID, BPX_HANDLER_ID, - CORE_CONTROLLER_ID + CORE_CONTROLLER_ID, ) LOGGER = get_console_logger() From fd0afdbd4dca399be5c8980dc9b0938da06cbec9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 10:04:18 +0100 Subject: [PATCH 06/14] bump tmtccmd --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index 42e9431..a317237 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 42e943108f42c8d51333f11f325e356791d460b1 +Subproject commit a31723786f4d85e82ba8e685f1652cb59cdb707b From 60e938a896c63f6dcef5167dbf7e48d2e14dac92 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 11:04:40 +0100 Subject: [PATCH 07/14] minor tweaks --- pus_tc/devs/pdu1.py | 4 ++-- pus_tc/devs/pdu2.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index 02026c6..893eb7d 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -56,7 +56,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): command = pack_set_param_command( object_id, PDUConfigTable.out_en_0.parameter_address, - PDUConfigTable.out_en_2.parameter_size, + PDUConfigTable.out_en_0.parameter_size, Channel.on, ) tc_queue.appendleft(command.pack_command_tuple()) @@ -65,7 +65,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): command = pack_set_param_command( object_id, PDUConfigTable.out_en_0.parameter_address, - PDUConfigTable.out_en_2.parameter_size, + PDUConfigTable.out_en_0.parameter_size, Channel.off, ) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index d2619c3..27ef4bc 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -22,7 +22,7 @@ class Pdu2OpCodes(enum.Enum): RW_ON = "5" RW_OFF = "6" # There is not really a point of the on command, the SW can not be commanded if the OBC is off - Q7S_OFF = "7" + Q7S_OFF = "32" class PDU2TestProcedure: From 2251c8cbf441e31e35c1ae6703d47ef2046f9b17 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 14:46:00 +0100 Subject: [PATCH 08/14] add latchup print commands --- gomspace/gomspace_common.py | 2 ++ pus_tc/cmd_definitions.py | 5 +++++ pus_tc/devs/p60dock.py | 9 ++++++++- pus_tc/devs/pdu1.py | 8 ++++++++ pus_tc/devs/pdu2.py | 9 ++++++++- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py index 54d80bf..4130665 100644 --- a/gomspace/gomspace_common.py +++ b/gomspace/gomspace_common.py @@ -20,12 +20,14 @@ class GomspaceDeviceActionIds(enum.IntEnum): WDT_RESET = 9 REQUEST_HK_TABLE = 16 PRINT_SWITCH_V_I = 32 + PRINT_LATCHUPS = 33 class GomspaceOpCodes(enum.Enum): # Request HK REQUEST_HK_ONCE = "128" PRINT_SWITCH_V_I = "129" + PRINT_LATCHUPS = "130" class SetIds: diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 21019a9..02ccd01 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -197,6 +197,11 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, info="P60 Dock: Print Switches, Voltages, Currents", ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=GomspaceOpCodes.PRINT_LATCHUPS.value, + info="P60 Dock: Print Latchups", + ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.P60DOCK.value, diff --git a/pus_tc/devs/p60dock.py b/pus_tc/devs/p60dock.py index 1d48504..a0ff436 100644 --- a/pus_tc/devs/p60dock.py +++ b/pus_tc/devs/p60dock.py @@ -125,7 +125,14 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) - return + if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: + tc_queue.appendleft( + (QueueCommands.PRINT, "P60 Dock: Print Latchups") + ) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS + ) + tc_queue.appendleft(command.pack_command_tuple()) if P60DockTestProcedure.all or P60DockTestProcedure.reboot: tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot")) command = pack_reboot_command(object_id) diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index 893eb7d..d0e5ed2 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -203,6 +203,14 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == GomspaceOpCodes.PRINT_LATCHUPS: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU1: Print Latchups") + ) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS + ) + tc_queue.appendleft(command.pack_command_tuple()) if PDU1TestProcedure.all or PDU1TestProcedure.ping: tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index 27ef4bc..4e60ea2 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -133,7 +133,14 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) - + if op_code == GomspaceOpCodes.PRINT_LATCHUPS: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU2: Print Latchups") + ) + command = generate_action_command( + object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS + ) + tc_queue.appendleft(command.pack_command_tuple()) if PDU2TestProcedure.all or PDU2TestProcedure.reboot: tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reboot")) command = pack_reboot_command(object_id) From 20fc1ab39218137e6f8ac39b86f4f021abadfad8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 15:13:39 +0100 Subject: [PATCH 09/14] some fixes --- pus_tc/cmd_definitions.py | 11 ++++++++++- pus_tc/devs/pdu1.py | 2 +- pus_tc/devs/pdu2.py | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 02ccd01..4e9e848 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -290,6 +290,11 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value, info="PDU1: Print Switches, Voltages, Currents", ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=GomspaceOpCodes.PRINT_LATCHUPS.value, + info="PDU1: Print Latchups", + ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests" ) @@ -354,7 +359,11 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): info="PDU2: Print Switches, Voltages, Currents", options={OpCodeDictKeys.TIMEOUT: 2.0}, ) - + add_op_code_entry( + op_code_dict=op_code_dict, + keys=GomspaceOpCodes.PRINT_LATCHUPS.value, + info="PDU2: Print Latchups", + ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name="pdu2", diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index d0e5ed2..649dfd1 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -203,7 +203,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == GomspaceOpCodes.PRINT_LATCHUPS: + if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: tc_queue.appendleft( (QueueCommands.PRINT, "PDU1: Print Latchups") ) diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index 4e60ea2..b527655 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -133,7 +133,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I ) tc_queue.appendleft(command.pack_command_tuple()) - if op_code == GomspaceOpCodes.PRINT_LATCHUPS: + if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: tc_queue.appendleft( (QueueCommands.PRINT, "PDU2: Print Latchups") ) From d188b10f6409fe7a957d6ed2c5769fc7cb32578e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Mar 2022 17:40:01 +0100 Subject: [PATCH 10/14] plpcdu tmtc fixes --- pus_tc/devs/plpcdu.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pus_tc/devs/plpcdu.py b/pus_tc/devs/plpcdu.py index b11be7d..9473db8 100644 --- a/pus_tc/devs/plpcdu.py +++ b/pus_tc/devs/plpcdu.py @@ -82,14 +82,14 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU on")) mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=Modes.ON, submode=0) mode_cmd = PusTelecommand( - service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data ) tc_queue.appendleft(mode_cmd.pack_command_tuple()) if op_code in OpCodes.SWITCH_OFF: tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU off")) mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=Modes.OFF, submode=0) mode_cmd = PusTelecommand( - service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data ) tc_queue.appendleft(mode_cmd.pack_command_tuple()) if op_code in OpCodes.SWITCH_ADC_NORMAL: @@ -100,7 +100,7 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ADC_ON ) mode_cmd = PusTelecommand( - service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data ) tc_queue.appendleft(mode_cmd.pack_command_tuple()) if op_code in OpCodes.SWITCH_ALL_NORMAL: @@ -114,7 +114,7 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ALL_ON ) mode_cmd = PusTelecommand( - service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data + service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data ) tc_queue.appendleft(mode_cmd.pack_command_tuple()) if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT: From 6e14e1b2687bef60a1a6f14840deac31e6285a56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 16 Mar 2022 18:44:28 +0100 Subject: [PATCH 11/14] added various useful commands --- pus_tc/cmd_definitions.py | 43 ++++++++++++++++------- pus_tc/devs/heater.py | 7 ++-- pus_tc/devs/p60dock.py | 4 +-- pus_tc/devs/pdu1.py | 4 +-- pus_tc/devs/pdu2.py | 72 +++++++++++++++++++++++++++++++++++++-- 5 files changed, 106 insertions(+), 24 deletions(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 4e9e848..e517b33 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -306,47 +306,66 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): ) op_code_dict = dict() - add_op_code_entry( - op_code_dict=op_code_dict, - keys="0", - info="PDU2 Tests", - options={OpCodeDictKeys.TIMEOUT: 2.0}, - ) + add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU2 Tests") add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.ACS_SIDE_B_ON.value, info="PDU2: Turn ACS Side B on", - options={OpCodeDictKeys.TIMEOUT: 2.0}, ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value, info="PDU2: Turn ACS Side B off", - options={OpCodeDictKeys.TIMEOUT: 2.0}, ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value, info="PDU2: Turn SUS redundant on", - options={OpCodeDictKeys.TIMEOUT: 2.0}, ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value, info="PDU2: Turn SUS redundant off", - options={OpCodeDictKeys.TIMEOUT: 2.0}, ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.RW_ON.value, info="PDU2: Turn reaction wheels on", - options={OpCodeDictKeys.TIMEOUT: 2.0}, ) add_op_code_entry( op_code_dict=op_code_dict, keys=Pdu2OpCodes.RW_OFF.value, info="PDU2: Turn reaction wheels off", - options={OpCodeDictKeys.TIMEOUT: 2.0}, + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value, + info="PDU2: PL PCDU Switch Channel Nominal (1) on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value, + info="PDU2: PL PCDU Switch Channel Nominal (1) off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value, + info="PDU2: PL PCDU Switch Channel Redundant (1) on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value, + info="PDU2: PL PCDU Switch Channel Redundant (1) off", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value, + info="PDU2: Switch TCS Heater Input on", + ) + add_op_code_entry( + op_code_dict=op_code_dict, + keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value, + info="PDU2: Switch TCS Heater Input off", ) add_op_code_entry( op_code_dict=op_code_dict, diff --git a/pus_tc/devs/heater.py b/pus_tc/devs/heater.py index 36de073..e04b5b0 100644 --- a/pus_tc/devs/heater.py +++ b/pus_tc/devs/heater.py @@ -29,8 +29,8 @@ class ActionIds: def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT): tc_queue.appendleft((QueueCommands.PRINT, "Testing Heater Switching")) - heater_number = int(input("Type number of heater to switch: ")) - if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES: + heater_number = int(input("Type number of heater to switch [0-7]: ")) + if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0: print("Invalid heater switch number") return action = int(input("Turn switch on or off? (0 - off, 1 - on): ")) @@ -52,7 +52,8 @@ def pack_switch_heater_command( @param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on. """ action_id = ActionIds.SWITCH_HEATER - command = object_id + action_id + command = bytearray() + command += object_id + action_id command.append(switch_nr) command.append(switch_action) return command diff --git a/pus_tc/devs/p60dock.py b/pus_tc/devs/p60dock.py index a0ff436..e9d08ee 100644 --- a/pus_tc/devs/p60dock.py +++ b/pus_tc/devs/p60dock.py @@ -126,9 +126,7 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: - tc_queue.appendleft( - (QueueCommands.PRINT, "P60 Dock: Print Latchups") - ) + tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Latchups")) command = generate_action_command( object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS ) diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index 649dfd1..fd94230 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -204,9 +204,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: - tc_queue.appendleft( - (QueueCommands.PRINT, "PDU1: Print Latchups") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Latchups")) command = generate_action_command( object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS ) diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index b527655..27b51eb 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -21,6 +21,12 @@ class Pdu2OpCodes(enum.Enum): SUS_REDUNDANT_OFF = "4" RW_ON = "5" RW_OFF = "6" + PL_PCDU_VBAT_NOM_ON = "7" + PL_PCDU_VBAT_NOM_OFF = "8" + PL_PCDU_VBAT_RED_ON = "9" + PL_PCDU_VBAT_RED_OFF = "10" + TCS_HEATER_IN_ON = "11" + TCS_HEATER_IN_OFF = "12" # There is not really a point of the on command, the SW can not be commanded if the OBC is off Q7S_OFF = "32" @@ -120,6 +126,68 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): Channel.off, ) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 on") + ) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_1.parameter_address, + PDUConfigTable.out_en_1.parameter_size, + Channel.on, + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 off") + ) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_1.parameter_address, + PDUConfigTable.out_en_1.parameter_size, + Channel.off, + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 on") + ) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_6.parameter_address, + PDUConfigTable.out_en_6.parameter_size, + Channel.off, + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value: + tc_queue.appendleft( + (QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 off") + ) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_6.parameter_address, + PDUConfigTable.out_en_6.parameter_size, + Channel.off, + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value: + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input on")) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_3.parameter_address, + PDUConfigTable.out_en_3.parameter_size, + Channel.on, + ) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value: + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input off")) + command = pack_set_param_command( + object_id, + PDUConfigTable.out_en_3.parameter_address, + PDUConfigTable.out_en_3.parameter_size, + Channel.off, + ) + 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) @@ -134,9 +202,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value: - tc_queue.appendleft( - (QueueCommands.PRINT, "PDU2: Print Latchups") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Latchups")) command = generate_action_command( object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS ) From 36b53098c002735ce5cf621334dc02a33f19a781 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 16 Mar 2022 19:07:47 +0100 Subject: [PATCH 12/14] update launch cfgs --- .idea/runConfigurations/Heater_Test.xml | 2 +- .../{S_A_Deployment_Test_UDP.xml => S_A_Deployment_Test.xml} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename .idea/runConfigurations/{S_A_Deployment_Test_UDP.xml => S_A_Deployment_Test.xml} (81%) diff --git a/.idea/runConfigurations/Heater_Test.xml b/.idea/runConfigurations/Heater_Test.xml index 8336926..65618ba 100644 --- a/.idea/runConfigurations/Heater_Test.xml +++ b/.idea/runConfigurations/Heater_Test.xml @@ -13,7 +13,7 @@