ploc supervisor mode commands

This commit is contained in:
Robin Müller 2022-03-28 11:40:13 +02:00
commit 0a47ab2508
14 changed files with 283 additions and 88 deletions

View File

@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s ploc_mpsoc -l -t 6" /> <option name="PARAMETERS" value="-s ploc_mpsoc -t 6 -l" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="PLOC SUPV Test" type="PythonConfigurationType" factoryName="Python" folderName="Devices"> <configuration default="false" name="PLOC SUPV" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<module name="tmtc" /> <module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />

View File

@ -43,3 +43,5 @@ class CustomServiceList(enum.Enum):
STR_IMG_HELPER = "str_img_helper" STR_IMG_HELPER = "str_img_helper"
SYRLINKS = "syrlinks" SYRLINKS = "syrlinks"
ACS_ASS = "acs-ass" ACS_ASS = "acs-ass"
SUS_ASS = "sus-ass"
TCS_ASS = "tcs-ass"

View File

@ -144,16 +144,16 @@
12016;0x2ef0;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h 12016;0x2ef0;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;linux/devices/startracker/StrHelper.h
12100;0x2f44;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h 12100;0x2f44;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/devices/ploc/PlocMPSoCHelper.h
12101;0x2f45;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h 12101;0x2f45;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/devices/ploc/PlocMPSoCHelper.h
12102;0x2f46;SENDING_COMMAND_FAILED;LOW;Communication interface returned failure when trying to send the command ot the PLOCP1: Return value returned by the communication interface sendMessage functionP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12102;0x2f46;SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocMPSoCHelper.h
12103;0x2f47;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failedP1: Return value returned by the communication interface requestReceiveMessage functionP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12103;0x2f47;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12104;0x2f48;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failedP1: Return value returned by the communication interface readingReceivedMessage functionP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12104;0x2f48;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12105;0x2f49;MISSING_ACK;LOW;Did not receive acknowledgement reportP1: Number of bytes missingP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12105;0x2f49;MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12106;0x2f4a;MISSING_EXE;LOW;Did not receive execution reportP1: Number of bytes missingP2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h 12106;0x2f4a;MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocMPSoCHelper.h
12107;0x2f4b;ACK_FAILURE_REPORT;LOW;Received acknowledgement failure reportP1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12107;0x2f4b;ACK_FAILURE_REPORT;LOW;Received acknowledgement failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12108;0x2f4c;EXE_FAILURE_REPORT;LOW;Received execution failure reportP1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12108;0x2f4c;EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12109;0x2f4d;ACK_INVALID_APID;LOW;Expected acknowledgement report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12109;0x2f4d;ACK_INVALID_APID;LOW;Expected acknowledgement report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12110;0x2f4e;EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h 12110;0x2f4e;EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/devices/ploc/PlocMPSoCHelper.h
12111;0x2f4f;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence countP1: Expected sequence countP2: Received sequence count;linux/devices/ploc/PlocMPSoCHelper.h 12111;0x2f4f;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHelper.h
12200;0x2fa8;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h 12200;0x2fa8;TRANSITION_OTHER_SIDE_FAILED;HIGH;;mission/system/AcsBoardAssembly.h
12201;0x2fa9;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h 12201;0x2fa9;NOT_ENOUGH_DEVICES_DUAL_MODE;HIGH;;mission/system/AcsBoardAssembly.h
12202;0x2faa;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.h 12202;0x2faa;POWER_STATE_MACHINE_TIMEOUT;MEDIUM;;mission/system/AcsBoardAssembly.h

1 2200 0x0898 STORE_SEND_WRITE_FAILED LOW fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
144 12016 0x2ef0 STR_HELPER_REQUESTING_MSG_FAILED LOW linux/devices/startracker/StrHelper.h
145 12100 0x2f44 MPSOC_FLASH_WRITE_FAILED LOW Flash write fails linux/devices/ploc/PlocMPSoCHelper.h
146 12101 0x2f45 MPSOC_FLASH_WRITE_SUCCESSFUL LOW Flash write successful linux/devices/ploc/PlocMPSoCHelper.h
147 12102 0x2f46 SENDING_COMMAND_FAILED LOW Communication interface returned failure when trying to send the command ot the PLOCP1: Return value returned by the communication interface sendMessage functionP2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
148 12103 0x2f47 MPSOC_HELPER_REQUESTING_REPLY_FAILED LOW Request receive message of communication interface failedP1: Return value returned by the communication interface requestReceiveMessage functionP2: Internal state of MPSoC helper Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
149 12104 0x2f48 MPSOC_HELPER_READING_REPLY_FAILED LOW Reading receive message of communication interface failedP1: Return value returned by the communication interface readingReceivedMessage functionP2: Internal state of MPSoC helper Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
150 12105 0x2f49 MISSING_ACK LOW Did not receive acknowledgement reportP1: Number of bytes missingP2: Internal state of MPSoC helper Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
151 12106 0x2f4a MISSING_EXE LOW Did not receive execution reportP1: Number of bytes missingP2: Internal state of MPSoC helper Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/devices/ploc/PlocMPSoCHelper.h
152 12107 0x2f4b ACK_FAILURE_REPORT LOW Received acknowledgement failure reportP1: Internal state of MPSoC Received acknowledgement failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
153 12108 0x2f4c EXE_FAILURE_REPORT LOW Received execution failure reportP1: Internal state of MPSoC Received execution failure report P1: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
154 12109 0x2f4d ACK_INVALID_APID LOW Expected acknowledgement report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC Expected acknowledgement report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
155 12110 0x2f4e EXE_INVALID_APID LOW Expected execution report but received space packet with other apidP1: Apid of received space packetP2: Internal state of MPSoC Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/devices/ploc/PlocMPSoCHelper.h
156 12111 0x2f4f MPSOC_HELPER_SEQ_CNT_MISMATCH LOW Received sequence count does not match expected sequence countP1: Expected sequence countP2: Received sequence count Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count linux/devices/ploc/PlocMPSoCHelper.h
157 12200 0x2fa8 TRANSITION_OTHER_SIDE_FAILED HIGH mission/system/AcsBoardAssembly.h
158 12201 0x2fa9 NOT_ENOUGH_DEVICES_DUAL_MODE HIGH mission/system/AcsBoardAssembly.h
159 12202 0x2faa POWER_STATE_MACHINE_TIMEOUT MEDIUM mission/system/AcsBoardAssembly.h

View File

@ -68,6 +68,8 @@ PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00])
# System and Assembly Objects # System and Assembly Objects
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01]) ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])
def get_object_ids() -> ObjectIdDictT: def get_object_ids() -> ObjectIdDictT:

View File

@ -470,6 +470,7 @@
0x57e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);0xE1;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h;DWLPWRON_CMD 0x57e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);0xE1;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h;DWLPWRON_CMD
0x60a0;PLMEMDUMP_MramAddressTooHigh;The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.;0xA0;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER 0x60a0;PLMEMDUMP_MramAddressTooHigh;The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.;0xA0;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER
0x60a1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;0xA1;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER 0x60a1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;0xA1;linux/devices/ploc/PlocMemoryDumper.h;PLOC_MEMORY_DUMPER
0x67a0; PLMPHLP_FileClosedAccidentally;File accidentally close;0xA0;linux/devices/ploc/PlocMPSoCHelper.h;PLOC_MPSOC_HELPER
0x5da0;PLUD_UpdaterBusy;Updater is already performing an update;0xA0;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da0;PLUD_UpdaterBusy;Updater is already performing an update;0xA0;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER
0x5da1;PLUD_NameTooLong;Received update command with invalid path string (too long).;0xA1;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da1;PLUD_NameTooLong;Received update command with invalid path string (too long).;0xA1;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER
0x5da2;PLUD_SdNotMounted;Received command to initiate update but SD card with update image not mounted.;0xA2;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER 0x5da2;PLUD_SdNotMounted;Received command to initiate update but SD card with update image not mounted.;0xA2;linux/devices/ploc/PlocUpdater.h;PLOC_UPDATER

Can't render this file because it has a wrong number of fields in line 18.

View File

@ -485,9 +485,9 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
) )
op_code_dict_srv_ploc_supv = { op_code_dict_srv_ploc_supv = {
"0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), "1": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}), "3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -602,7 +602,8 @@ def add_ploc_supv_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, SusOpCodes
import pus_tc.system.tcs as tcs
default_opts = generate_op_code_options( default_opts = generate_op_code_options(
enter_listener_mode=False, custom_timeout=8.0 enter_listener_mode=False, custom_timeout=8.0
@ -656,3 +657,55 @@ def add_system_cmds(cmd_dict: ServiceOpCodeDictT):
info="ACS Assemblies", info="ACS Assemblies",
op_code_entry=op_code_dict, op_code_entry=op_code_dict,
) )
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_NOM_SIDE,
info="Switch SUS board to nominal side",
options=default_opts,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_RED_SIDE,
info="Switch SUS board to redundant side",
options=default_opts,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_OFF,
info="Switch off SUS board",
options=default_opts,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=SusOpCodes.SUS_ASS_DUAL_MODE,
info="Switch SUS board to dual mode",
options=default_opts,
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.SUS_ASS.value,
info="SUS Assembly",
op_code_entry=op_code_dict,
)
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=tcs.OpCodes.TCS_BOARD_ASS_NORMAL,
info=tcs.Info.TCS_BOARD_ASS_NORMAL,
options=default_opts,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=tcs.OpCodes.TCS_BOARD_ASS_OFF,
info=tcs.Info.TCS_BOARD_ASS_OFF,
options=default_opts,
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.TCS_ASS.value,
info="TCS Board Assembly",
op_code_entry=op_code_dict,
)

View File

@ -25,6 +25,11 @@ flash_write_file_dict = {
} }
mpsoc_file_dict = { mpsoc_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/flash", "0:/flash"],
}
sequence_file_dict = {
MANUAL_INPUT: ["manual input", ""], MANUAL_INPUT: ["manual input", ""],
"2": ["0:/EM16/231", "0:/EM16/231"], "2": ["0:/EM16/231", "0:/EM16/231"],
} }
@ -45,7 +50,7 @@ class CommandIds(enum.IntEnum):
class MemAddresses(enum.IntEnum): class MemAddresses(enum.IntEnum):
DEADBEEF = 0x40000000 DEADBEEF = 0x40000004
class PlocReplyIds: class PlocReplyIds:
@ -123,12 +128,12 @@ def pack_ploc_mpsoc_commands(
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Read DEADBEEF address")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Read DEADBEEF address"))
command = object_id + struct.pack('!I', CommandIds.TC_MEM_READ) + struct.pack("!I", MemAddresses.DEADBEEF) + \ command = object_id + struct.pack('!I', CommandIds.TC_MEM_READ) + struct.pack("!I", MemAddresses.DEADBEEF) + \
struct.pack('!H', num_words) struct.pack('!H', num_words)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11": elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode replay")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode replay"))
command = object_id + struct.pack('!I', CommandIds.TC_MODE_REPLAY) command = object_id + struct.pack('!I', CommandIds.TC_MODE_REPLAY)
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
@ -163,10 +168,10 @@ def prepare_mem_read_command(object_id: bytearray) -> bytearray:
def prepare_flash_write_cmd(object_id: bytearray) -> bytearray: def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
obcFile = get_flash_write_file() obcFile = get_obc_file()
mpsocFile = get_mpsoc_file() mpsocFile = get_mpsoc_file()
command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(obcFile, 'utf-8') + \ command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(obcFile, 'utf-8') + bytearray(mpsocFile,
struct.pack('B', 0) + bytearray(mpsocFile, 'utf-8') 'utf-8')
return command return command
@ -177,7 +182,7 @@ def prepare_flash_delete_cmd(object_id: bytearray) -> bytearray:
def prepare_replay_start_cmd(object_id: bytearray) -> bytearray: def prepare_replay_start_cmd(object_id: bytearray) -> bytearray:
replay = int(input("Specify replay mode (0 - repeated, 1 - once): ")) replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_START) + struct.pack('!B', replay) command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_START) + struct.pack('!B', replay)
return command return command
@ -193,14 +198,14 @@ def prepare_downlink_pwr_on_cmd(object_id: bytearray) -> bytearray:
def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray: def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray:
null_terminator = 0 null_terminator = 0
use_decoding = int(input("Use decoding (set to 1): ")) use_decoding = int(input("Use decoding (set to 1): "))
file = get_mpsoc_file() file = get_sequence_file()
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_WRITE_SEQUENCE) + struct.pack('!B', use_decoding) + \ command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_WRITE_SEQUENCE) + struct.pack('!B', use_decoding) + \
bytearray(file, 'utf-8') + struct.pack('!B', null_terminator) bytearray(file, 'utf-8')
return command return command
def get_flash_write_file() -> str: def get_obc_file() -> str:
LOGGER.info("Specify flash file") LOGGER.info("Specify OBC file ")
input_helper = InputHelper(flash_write_file_dict) input_helper = InputHelper(flash_write_file_dict)
key = input_helper.get_key() key = input_helper.get_key()
if key == MANUAL_INPUT: if key == MANUAL_INPUT:
@ -211,7 +216,7 @@ def get_flash_write_file() -> str:
def get_mpsoc_file() -> str: def get_mpsoc_file() -> str:
LOGGER.info("Specify flash file to write to") LOGGER.info("Specify MPSoC file")
input_helper = InputHelper(mpsoc_file_dict) input_helper = InputHelper(mpsoc_file_dict)
key = input_helper.get_key() key = input_helper.get_key()
if key == MANUAL_INPUT: if key == MANUAL_INPUT:
@ -219,3 +224,14 @@ def get_mpsoc_file() -> str:
else: else:
file = mpsoc_file_dict[key][1] file = mpsoc_file_dict[key][1]
return file return file
def get_sequence_file() -> str:
LOGGER.info("Specify sequence file")
input_helper = InputHelper(sequence_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name file: ")
else:
file = mpsoc_file_dict[key][1]
return file

View File

@ -12,6 +12,7 @@ from spacepackets.ecss.tc import PusTelecommand
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.utility.logger import get_console_logger from tmtccmd.utility.logger import get_console_logger
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -84,7 +85,25 @@ def pack_ploc_supv_commands(
"Testing PLOC Supervisor with object id: 0x" + object_id.hex(), "Testing PLOC Supervisor with object id: 0x" + object_id.hex(),
) )
) )
if op_code == "0":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set mode off")
)
command = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set mode on")
)
command = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mode Normal"))
command = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report"))
command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT) command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT)

View File

@ -1,21 +1,29 @@
import enum import enum
from tmtccmd.tc.definitions import TcQueueT, QueueCommands from tmtccmd.tc.definitions import TcQueueT
from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc.service_200_mode import Modes
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
from config.object_ids import ACS_BOARD_ASS_ID
from .common import command_assembly
class AcsOpCodes: class AcsOpCodes:
ACS_ASS_A_SIDE = ["0", "a"] ACS_ASS_A_SIDE = ["0", "acs-a"]
ACS_ASS_B_SIDE = ["1", "b"] ACS_ASS_B_SIDE = ["1", "acs-b"]
ACS_ASS_DUAL_MODE = ["2", "d"] ACS_ASS_DUAL_MODE = ["2", "acs-d"]
ACS_ASS_OFF = ["3", "off"] ACS_ASS_OFF = ["3", "acs-off"]
ACS_ASS_A_ON = ["4", "ao"] ACS_ASS_A_ON = ["4", "acs-ao"]
ACS_ASS_B_ON = ["5", "bo"] ACS_ASS_B_ON = ["5", "acs-bo"]
ACS_ASS_DUAL_ON = ["6", "do"] ACS_ASS_DUAL_ON = ["6", "acs-do"]
class AcsBoardSubmodes(enum.IntEnum): 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):
A_SIDE = 0 A_SIDE = 0
B_SIDE = 1 B_SIDE = 1
DUAL_SIDE = 2 DUAL_SIDE = 2
@ -23,61 +31,93 @@ class AcsBoardSubmodes(enum.IntEnum):
def pack_acs_command(tc_queue: TcQueueT, op_code: str): def pack_acs_command(tc_queue: TcQueueT, op_code: str):
if op_code in AcsOpCodes.ACS_ASS_A_SIDE: if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching to ACS board assembly A side") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.NORMAL,
command_acs_board( submode=DualSideSubmodes.A_SIDE,
mode=Modes.NORMAL, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching to ACS board assembly A side",
) )
if op_code in AcsOpCodes.ACS_ASS_B_SIDE: if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching to ACS board assembly B side") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.NORMAL,
command_acs_board( submode=DualSideSubmodes.B_SIDE,
mode=Modes.NORMAL, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching to ACS board assembly B side",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE: if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching to ACS board assembly dual mode") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.NORMAL,
command_acs_board( submode=DualSideSubmodes.DUAL_SIDE,
mode=Modes.NORMAL, submode=AcsBoardSubmodes.DUAL_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching to ACS board assembly dual mode",
) )
if op_code in AcsOpCodes.ACS_ASS_A_ON: if op_code in AcsOpCodes.ACS_ASS_A_ON:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching ACS board assembly A side on") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.ON,
command_acs_board( submode=DualSideSubmodes.A_SIDE,
mode=Modes.ON, submode=AcsBoardSubmodes.A_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching ACS board assembly A side on",
) )
if op_code in AcsOpCodes.ACS_ASS_B_ON: if op_code in AcsOpCodes.ACS_ASS_B_ON:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching ACS board assembly B side on") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.ON,
command_acs_board( submode=DualSideSubmodes.B_SIDE,
mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching ACS board assembly B side on",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON: if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching ACS board assembly dual side on") object_id=ACS_BOARD_ASS_ID,
) mode=Modes.ON,
command_acs_board( submode=DualSideSubmodes.B_SIDE,
mode=Modes.ON, submode=AcsBoardSubmodes.B_SIDE, tc_queue=tc_queue tc_queue=tc_queue,
info="Switching ACS board assembly dual side on",
) )
if op_code in AcsOpCodes.ACS_ASS_OFF: if op_code in AcsOpCodes.ACS_ASS_OFF:
tc_queue.appendleft( command_assembly(
(QueueCommands.PRINT, "Switching to ACS board assembly off") object_id=ACS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info="Switching to ACS board assembly off",
) )
command_acs_board(mode=Modes.OFF, submode=0, tc_queue=tc_queue)
def command_acs_board(mode: Modes, submode: int, tc_queue: TcQueueT): def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
mode_data = pack_mode_data( if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
object_id=ACS_BOARD_ASS_ID, command_assembly(
mode=mode, object_id=SUS_BOARD_ASS_ID,
submode=submode, mode=Modes.NORMAL,
) submode=DualSideSubmodes.A_SIDE,
cmd = PusTelecommand( tc_queue=tc_queue,
service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data info="Switching to SUS board to nominal side",
) )
tc_queue.appendleft(cmd.pack_command_tuple()) if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
command_assembly(
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 SusOpCodes.SUS_ASS_OFF:
command_assembly(
object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info="Switching SUS board off",
)
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
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",
)

18
pus_tc/system/common.py Normal file
View File

@ -0,0 +1,18 @@
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
def command_assembly(
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())

34
pus_tc/system/tcs.py Normal file
View File

@ -0,0 +1,34 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from tmtccmd.tc.service_200_mode import Modes
from .common import command_assembly
from config.object_ids import TCS_BOARD_ASS_ID
class OpCodes:
TCS_BOARD_ASS_NORMAL = ["0", "tcs-normal"]
TCS_BOARD_ASS_OFF = ["1", "tcs-off"]
class Info:
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
command_assembly(
object_id=TCS_BOARD_ASS_ID,
mode=Modes.NORMAL,
submode=0,
tc_queue=tc_queue,
info=Info.TCS_BOARD_ASS_NORMAL,
)
if op_code in OpCodes.TCS_BOARD_ASS_OFF:
command_assembly(
object_id=TCS_BOARD_ASS_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info=Info.TCS_BOARD_ASS_OFF,
)

View File

@ -31,9 +31,10 @@ from pus_tc.system.core import pack_core_commands
from pus_tc.devs.star_tracker import pack_star_tracker_commands from pus_tc.devs.star_tracker import pack_star_tracker_commands
from pus_tc.devs.syrlinks_hk_handler import pack_syrlinks_command from pus_tc.devs.syrlinks_hk_handler import pack_syrlinks_command
from pus_tc.devs.gps import pack_gps_command from pus_tc.devs.gps import pack_gps_command
from pus_tc.system.acs import pack_acs_command from pus_tc.system.acs import pack_acs_command, pack_sus_cmds
from pus_tc.devs.plpcdu import pack_pl_pcdu_commands from pus_tc.devs.plpcdu import pack_pl_pcdu_commands
from pus_tc.devs.str_img_helper import pack_str_img_helper_command from pus_tc.devs.str_img_helper import pack_str_img_helper_command
from pus_tc.system.tcs import pack_tcs_sys_commands
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import ( from config.object_ids import (
P60_DOCK_HANDLER, P60_DOCK_HANDLER,
@ -120,7 +121,9 @@ def pack_service_queue_user(
) )
if service == CustomServiceList.PLOC_MPSOC.value: if service == CustomServiceList.PLOC_MPSOC.value:
object_id = PLOC_MPSOC_ID object_id = PLOC_MPSOC_ID
return pack_ploc_mpsoc_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_ploc_mpsoc_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_1.value: if service == CustomServiceList.REACTION_WHEEL_1.value:
object_id = RW1_ID object_id = RW1_ID
return pack_single_rw_test_into( return pack_single_rw_test_into(
@ -199,10 +202,14 @@ def pack_service_queue_user(
return pack_solar_array_deployment_test_into( return pack_solar_array_deployment_test_into(
object_id=SOLAR_ARRAY_DEPLOYMENT_ID, tc_queue=service_queue object_id=SOLAR_ARRAY_DEPLOYMENT_ID, tc_queue=service_queue
) )
if service == CustomServiceList.SUS_ASS.value:
return pack_sus_cmds(tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PL_PCDU.value: if service == CustomServiceList.PL_PCDU.value:
return pack_pl_pcdu_commands(tc_queue=service_queue, op_code=op_code) return pack_pl_pcdu_commands(tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.ACS_ASS.value: if service == CustomServiceList.ACS_ASS.value:
return pack_acs_command(tc_queue=service_queue, op_code=op_code) return pack_acs_command(tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.TCS_ASS.value:
return pack_tcs_sys_commands(tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

View File

@ -69,8 +69,11 @@ def handle_ploc_replies(action_id: int, custom_data: bytearray) -> DataReplyUnpa
"PLOC Mem Len", "PLOC Mem Len",
"PLOC Read Memory Data", "PLOC Read Memory Data",
] ]
reply.content_list = ["0x" + custom_data[:4].hex(), struct.unpack('!H', custom_data[4:6])[0], reply.content_list = [
"0x" + custom_data[6:10].hex()] "0x" + custom_data[:4].hex(),
struct.unpack("!H", custom_data[4:6])[0],
"0x" + custom_data[6:10].hex(),
]
return reply return reply