Merge remote-tracking branch 'origin/main' into bump-tmtccmd
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-11-29 15:12:48 +01:00
commit 6f86e72042
Signed by: muellerr
GPG Key ID: A649FB78196E3849
8 changed files with 387 additions and 147 deletions

View File

@ -12,7 +12,10 @@ list yields a list of all related PRs for each release.
## Added ## Added
- Added new commands to disable channel order checks partially for the payload PCDU normal modes.
- Core controller auto switch enable and disable command. - Core controller auto switch enable and disable command.
- Star Tracker JSON reload command. Reboot still required.
- PLOC SUPV ADC and Counters report TM handling.
# [v5.10.1] 2023-10-27 # [v5.10.1] 2023-10-27

View File

@ -143,14 +143,16 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;mission/acs/str/StarTrackerHandler.h 11901;0x2e7d;BOOTING_FIRMWARE_FAILED_EVENT;LOW;Failed to boot firmware;mission/acs/str/StarTrackerHandler.h
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;mission/acs/str/StarTrackerHandler.h 11902;0x2e7e;BOOTING_BOOTLOADER_FAILED_EVENT;LOW;Failed to boot star tracker into bootloader mode;mission/acs/str/StarTrackerHandler.h
11903;0x2e7f;COM_ERROR_REPLY_RECEIVED;LOW;Received COM error. P1: Communication Error ID (datasheet p32);mission/acs/str/StarTrackerHandler.h 11903;0x2e7f;COM_ERROR_REPLY_RECEIVED;LOW;Received COM error. P1: Communication Error ID (datasheet p32);mission/acs/str/StarTrackerHandler.h
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/payload/PlocSupervisorHandler.h 12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/payload/plocSupvDefs.h
12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/payload/PlocSupervisorHandler.h 12002;0x2ee2;SUPV_UNKNOWN_TM;LOW;Unhandled event. P1: APID, P2: Service ID;linux/payload/plocSupvDefs.h
12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/payload/PlocSupervisorHandler.h 12003;0x2ee3;SUPV_UNINIMPLEMENTED_TM;LOW;No description;linux/payload/plocSupvDefs.h
12004;0x2ee4;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/payload/PlocSupervisorHandler.h 12004;0x2ee4;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/payload/plocSupvDefs.h
12005;0x2ee5;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler;linux/payload/PlocSupervisorHandler.h 12005;0x2ee5;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler;linux/payload/plocSupvDefs.h
12006;0x2ee6;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/payload/PlocSupervisorHandler.h 12006;0x2ee6;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/payload/plocSupvDefs.h
12007;0x2ee7;SUPV_HELPER_EXECUTING;LOW;Supervisor helper currently executing a command;linux/payload/PlocSupervisorHandler.h 12007;0x2ee7;SUPV_HELPER_EXECUTING;LOW;Supervisor helper currently executing a command;linux/payload/plocSupvDefs.h
12008;0x2ee8;SUPV_MPSOC_SHUTDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/payload/PlocSupervisorHandler.h 12008;0x2ee8;SUPV_MPSOC_SHUTDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/payload/plocSupvDefs.h
12009;0x2ee9;SUPV_ACK_UNKNOWN_COMMAND;LOW;Received ACK, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID.;linux/payload/plocSupvDefs.h
12010;0x2eea;SUPV_EXE_ACK_UNKNOWN_COMMAND;LOW;Received ACK EXE, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID.;linux/payload/plocSupvDefs.h
12100;0x2f44;SANITIZATION_FAILED;LOW;No description;bsp_q7s/fs/SdCardManager.h 12100;0x2f44;SANITIZATION_FAILED;LOW;No description;bsp_q7s/fs/SdCardManager.h
12101;0x2f45;MOUNTED_SD_CARD;INFO;No description;bsp_q7s/fs/SdCardManager.h 12101;0x2f45;MOUNTED_SD_CARD;INFO;No description;bsp_q7s/fs/SdCardManager.h
12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/payload/PlocMemoryDumper.h 12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/payload/PlocMemoryDumper.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
143 11901 0x2e7d BOOTING_FIRMWARE_FAILED_EVENT LOW Failed to boot firmware mission/acs/str/StarTrackerHandler.h
144 11902 0x2e7e BOOTING_BOOTLOADER_FAILED_EVENT LOW Failed to boot star tracker into bootloader mode mission/acs/str/StarTrackerHandler.h
145 11903 0x2e7f COM_ERROR_REPLY_RECEIVED LOW Received COM error. P1: Communication Error ID (datasheet p32) mission/acs/str/StarTrackerHandler.h
146 12001 0x2ee1 SUPV_MEMORY_READ_RPT_CRC_FAILURE LOW PLOC supervisor crc failure in telemetry packet linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
147 12002 0x2ee2 SUPV_UNKNOWN_TM LOW Unhandled event. P1: APID, P2: Service ID linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
148 12003 0x2ee3 SUPV_UNINIMPLEMENTED_TM LOW No description linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
149 12004 0x2ee4 SUPV_ACK_FAILURE LOW PLOC supervisor received acknowledgment failure report linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
150 12005 0x2ee5 SUPV_EXE_FAILURE LOW PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
151 12006 0x2ee6 SUPV_CRC_FAILURE_EVENT LOW PLOC supervisor reply has invalid crc linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
152 12007 0x2ee7 SUPV_HELPER_EXECUTING LOW Supervisor helper currently executing a command linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
153 12008 0x2ee8 SUPV_MPSOC_SHUTDOWN_BUILD_FAILED LOW Failed to build the command to shutdown the MPSoC linux/payload/PlocSupervisorHandler.h linux/payload/plocSupvDefs.h
154 12009 0x2ee9 SUPV_ACK_UNKNOWN_COMMAND LOW Received ACK, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID. linux/payload/plocSupvDefs.h
155 12010 0x2eea SUPV_EXE_ACK_UNKNOWN_COMMAND LOW Received ACK EXE, but no related command is unknown or has not been sent by this software instance. P1: Module APID. P2: Service ID. linux/payload/plocSupvDefs.h
156 12100 0x2f44 SANITIZATION_FAILED LOW No description bsp_q7s/fs/SdCardManager.h
157 12101 0x2f45 MOUNTED_SD_CARD INFO No description bsp_q7s/fs/SdCardManager.h
158 12300 0x300c SEND_MRAM_DUMP_FAILED LOW Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command linux/payload/PlocMemoryDumper.h

View File

@ -167,6 +167,9 @@ NOT_OK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x03])
HK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x04]) HK_TM_STORE = bytes([0x73, 0x02, 0x00, 0x04])
CFDP_TM_STORE = bytes([0x73, 0x03, 0x00, 0x00]) CFDP_TM_STORE = bytes([0x73, 0x03, 0x00, 0x00])
SUPV_FILTER_SET = [PLOC_SUPV_ID, PDU_2_HANDLER_ID, PDU_1_HANDLER_ID]
ObjectIdDict = Dict[bytes, ObjectIdU32] ObjectIdDict = Dict[bytes, ObjectIdU32]

View File

@ -100,9 +100,10 @@ class StarTrackerActionId(enum.IntEnum):
ADD_SECONDARY_TM_TO_NORMAL_MODE = 95 ADD_SECONDARY_TM_TO_NORMAL_MODE = 95
RESET_SECONDARY_TM_SET = 96 RESET_SECONDARY_TM_SET = 96
READ_SECONDARY_TM_SET = 97 READ_SECONDARY_TM_SET = 97
RELOAD_JSON_CFG_FILE = 100
class OpCodes: class OpCode:
ON_BOOTLOADER = "on_bootloader" ON_BOOTLOADER = "on_bootloader"
ON_FIRMWARE = "on_firmware" ON_FIRMWARE = "on_firmware"
NORMAL = "nml" NORMAL = "nml"
@ -120,6 +121,7 @@ class OpCodes:
SET_IMG_PROCESSOR_MODE = "set_img_proc_mode" SET_IMG_PROCESSOR_MODE = "set_img_proc_mode"
FW_UPDATE = "fw_update" FW_UPDATE = "fw_update"
SET_TIME_FROM_SYS_TIME = "set_time" SET_TIME_FROM_SYS_TIME = "set_time"
RELOAD_JSON_CFG_FILE = "reload_json_cfg"
class Info: class Info:
@ -135,6 +137,7 @@ class Info:
SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode" SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode"
FW_UPDATE = "Firmware Update" FW_UPDATE = "Firmware Update"
SET_TIME_FROM_SYS_TIME = "Set time from system time" SET_TIME_FROM_SYS_TIME = "Set time from system time"
RELOAD_JSON_CFG_FILE = "Reload JSON configuration file. Reboot still required."
class SetId(enum.IntEnum): class SetId(enum.IntEnum):
@ -244,36 +247,36 @@ def pack_star_tracker_commands( # noqa C901
f"Generate command for star tracker with object id: {object_id.as_hex_string}" f"Generate command for star tracker with object id: {object_id.as_hex_string}"
) )
obyt = object_id.as_bytes obyt = object_id.as_bytes
if cmd_str == OpCodes.ON_BOOTLOADER: if cmd_str == OpCode.ON_BOOTLOADER:
q.add_log_cmd("Star tracker: Mode On, Submode Bootloader") q.add_log_cmd("Star tracker: Mode On, Submode Bootloader")
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.BOOTLOADER) data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.BOOTLOADER)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if cmd_str == OpCodes.ON_FIRMWARE: if cmd_str == OpCode.ON_FIRMWARE:
q.add_log_cmd("Star tracker: Mode On, Submode Firmware") q.add_log_cmd("Star tracker: Mode On, Submode Firmware")
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.FIRMWARE) data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.ON, Submode.FIRMWARE)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if cmd_str == OpCodes.NORMAL: if cmd_str == OpCode.NORMAL:
q.add_log_cmd("Star tracker: Mode Normal") q.add_log_cmd("Star tracker: Mode Normal")
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.NORMAL, 0) data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if cmd_str == OpCodes.OFF: if cmd_str == OpCode.OFF:
q.add_log_cmd("Star tracker: Mode Off") q.add_log_cmd("Star tracker: Mode Off")
data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.OFF, 0) data = pack_mode_data(prompt_object_id_mode_cmd(), Mode.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if cmd_str == OpCodes.ONE_SHOOT_HK: if cmd_str == OpCode.ONE_SHOOT_HK:
q.add_log_cmd(Info.ONE_SHOOT_HK) q.add_log_cmd(Info.ONE_SHOOT_HK)
request_dataset(q, DataSetRequest.ONESHOT) request_dataset(q, DataSetRequest.ONESHOT)
if cmd_str == OpCodes.ENABLE_HK: if cmd_str == OpCode.ENABLE_HK:
q.add_log_cmd(Info.ENABLE_HK) q.add_log_cmd(Info.ENABLE_HK)
request_dataset(q, DataSetRequest.ENABLE) request_dataset(q, DataSetRequest.ENABLE)
if cmd_str == OpCodes.DISABLE_HK: if cmd_str == OpCode.DISABLE_HK:
q.add_log_cmd(Info.DISABLE_HK) q.add_log_cmd(Info.DISABLE_HK)
request_dataset(q, DataSetRequest.DISABLE) request_dataset(q, DataSetRequest.DISABLE)
if cmd_str == "4": if cmd_str == "4":
q.add_log_cmd("Star tracker: Mode Raw") q.add_log_cmd("Star tracker: Mode Raw")
data = pack_mode_data(obyt, Mode.RAW, 0) data = pack_mode_data(obyt, Mode.RAW, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if cmd_str == OpCodes.PING: if cmd_str == OpCode.PING:
q.add_log_cmd("Star tracker: Ping") q.add_log_cmd("Star tracker: Ping")
data = obyt + struct.pack("!I", StarTrackerActionId.PING) data = obyt + struct.pack("!I", StarTrackerActionId.PING)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@ -316,7 +319,7 @@ def pack_star_tracker_commands( # noqa C901
q.add_log_cmd("Star tracker: Request time") q.add_log_cmd("Star tracker: Request time")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TIME) data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TIME)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.UPLOAD_IMAGE: if cmd_str == OpCode.UPLOAD_IMAGE:
q.add_log_cmd("Star tracker: Upload image") q.add_log_cmd("Star tracker: Upload image")
image = get_upload_image() image = get_upload_image()
data = ( data = (
@ -325,7 +328,7 @@ def pack_star_tracker_commands( # noqa C901
+ bytearray(image, "utf-8") + bytearray(image, "utf-8")
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.DOWNLOAD_IMAGE: if cmd_str == OpCode.DOWNLOAD_IMAGE:
q.add_log_cmd(f"STR: {Info.DOWNLOAD_IMAGE}") q.add_log_cmd(f"STR: {Info.DOWNLOAD_IMAGE}")
path = input("Specify storage location (default - /mnt/sd0/startracker): ") path = input("Specify storage location (default - /mnt/sd0/startracker): ")
if not path: if not path:
@ -417,7 +420,7 @@ def pack_star_tracker_commands( # noqa C901
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.TAKE_IMAGE: if cmd_str == OpCode.TAKE_IMAGE:
q.add_log_cmd("Star tracker: Take image") q.add_log_cmd("Star tracker: Take image")
actionid = int( actionid = int(
input("Specify parameter ID (4: take image, 7: get histogram): ") input("Specify parameter ID (4: take image, 7: get histogram): ")
@ -475,7 +478,7 @@ def pack_star_tracker_commands( # noqa C901
q.add_log_cmd("Star tracker: Get checksum") q.add_log_cmd("Star tracker: Get checksum")
data = pack_checksum_command(obyt) data = pack_checksum_command(obyt)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.SET_TIME_FROM_SYS_TIME: if cmd_str == OpCode.SET_TIME_FROM_SYS_TIME:
q.add_log_cmd(Info.SET_TIME_FROM_SYS_TIME) q.add_log_cmd(Info.SET_TIME_FROM_SYS_TIME)
data = obyt + struct.pack("!I", StarTrackerActionId.SET_TIME_FROM_SYS_TIME) data = obyt + struct.pack("!I", StarTrackerActionId.SET_TIME_FROM_SYS_TIME)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@ -538,7 +541,7 @@ def pack_star_tracker_commands( # noqa C901
q.add_log_cmd("Star tracker: Request limits") q.add_log_cmd("Star tracker: Request limits")
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LIMITS) data = obyt + struct.pack("!I", StarTrackerActionId.REQ_LIMITS)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.SET_IMG_PROCESSOR_MODE: if cmd_str == OpCode.SET_IMG_PROCESSOR_MODE:
q.add_log_cmd(Info.SET_IMG_PROCESSOR_MODE) q.add_log_cmd(Info.SET_IMG_PROCESSOR_MODE)
json_file = get_config_file() json_file = get_config_file()
data = ( data = (
@ -639,7 +642,7 @@ def pack_star_tracker_commands( # noqa C901
+ bytearray(json_file, "utf-8") + bytearray(json_file, "utf-8")
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.FW_UPDATE: if cmd_str == OpCode.FW_UPDATE:
q.add_log_cmd(Info.FW_UPDATE) q.add_log_cmd(Info.FW_UPDATE)
firmware = get_firmware() firmware = get_firmware()
data = ( data = (
@ -648,7 +651,7 @@ def pack_star_tracker_commands( # noqa C901
+ firmware.encode() + firmware.encode()
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCodes.ADD_SECONDARY_TM_TO_NORMAL_MODE: if cmd_str == OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE:
q.add_log_cmd(Info.ADD_SECONDARY_TM_TO_NORMAL_MODE) q.add_log_cmd(Info.ADD_SECONDARY_TM_TO_NORMAL_MODE)
for val in SetId: for val in SetId:
print("{:<2}: {:<20}".format(val, val.name)) print("{:<2}: {:<20}".format(val, val.name))
@ -660,7 +663,7 @@ def pack_star_tracker_commands( # noqa C901
struct.pack("!I", set_id), struct.pack("!I", set_id),
) )
) )
if cmd_str == OpCodes.RESET_SECONDARY_TM_SET: if cmd_str == OpCode.RESET_SECONDARY_TM_SET:
q.add_log_cmd(Info.RESET_SECONDARY_TM_SET) q.add_log_cmd(Info.RESET_SECONDARY_TM_SET)
q.add_pus_tc( q.add_pus_tc(
create_action_cmd( create_action_cmd(
@ -668,13 +671,18 @@ def pack_star_tracker_commands( # noqa C901
StarTrackerActionId.RESET_SECONDARY_TM_SET, StarTrackerActionId.RESET_SECONDARY_TM_SET,
) )
) )
if cmd_str == OpCodes.READ_SECONDARY_TM_SET: if cmd_str == OpCode.READ_SECONDARY_TM_SET:
q.add_log_cmd(Info.READ_SECONDARY_TM_SET) q.add_log_cmd(Info.READ_SECONDARY_TM_SET)
q.add_pus_tc( q.add_pus_tc(
create_action_cmd( create_action_cmd(
STAR_TRACKER_ID, StarTrackerActionId.READ_SECONDARY_TM_SET STAR_TRACKER_ID, StarTrackerActionId.READ_SECONDARY_TM_SET
) )
) )
if cmd_str == OpCode.RELOAD_JSON_CFG_FILE:
q.add_log_cmd(Info.RELOAD_JSON_CFG_FILE)
q.add_pus_tc(
create_action_cmd(STAR_TRACKER_ID, StarTrackerActionId.RELOAD_JSON_CFG_FILE)
)
def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest): def request_dataset(q: DefaultPusQueueHelper, req_type: DataSetRequest):
@ -1148,7 +1156,9 @@ def handle_read_secondary_tm_set(pw: PrintWrapper, custom_data: bytes):
def create_str_node() -> CmdTreeNode: def create_str_node() -> CmdTreeNode:
node = CmdTreeNode("str", "Star Tracker Device", hide_children_which_are_leaves=True) node = CmdTreeNode(
"str", "Star Tracker Device", hide_children_which_are_leaves=True
)
node.add_child(CmdTreeNode(OpCodes.ON_BOOTLOADER, "Mode On, Submode Bootloader")) node.add_child(CmdTreeNode(OpCodes.ON_BOOTLOADER, "Mode On, Submode Bootloader"))
node.add_child(CmdTreeNode(OpCodes.ON_FIRMWARE, "Mode On, Submode Firmware")) node.add_child(CmdTreeNode(OpCodes.ON_FIRMWARE, "Mode On, Submode Firmware"))
node.add_child(CmdTreeNode(OpCodes.NORMAL, "Mode Normal")) node.add_child(CmdTreeNode(OpCodes.NORMAL, "Mode Normal"))
@ -1185,23 +1195,24 @@ def create_str_node() -> CmdTreeNode:
@tmtc_definitions_provider @tmtc_definitions_provider
def add_str_cmds(defs: TmtcDefinitionWrapper): def add_str_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry() oce = OpCodeEntry()
oce.add(OpCodes.ON_BOOTLOADER, "Mode On, Submode Bootloader") oce.add(OpCode.ON_BOOTLOADER, "Mode On, Submode Bootloader")
oce.add(OpCodes.ON_FIRMWARE, "Mode On, Submode Firmware") oce.add(OpCode.ON_FIRMWARE, "Mode On, Submode Firmware")
oce.add(OpCodes.NORMAL, "Mode Normal") oce.add(OpCode.NORMAL, "Mode Normal")
oce.add(OpCodes.OFF, "Mode Off") oce.add(OpCode.OFF, "Mode Off")
oce.add(OpCodes.PING, "Star Tracker: Ping") oce.add(OpCode.PING, "Star Tracker: Ping")
oce.add(OpCodes.TAKE_IMAGE, "Take Image") oce.add(OpCode.TAKE_IMAGE, "Take Image")
oce.add(OpCodes.UPLOAD_IMAGE, Info.UPLOAD_IMAGE) oce.add(OpCode.UPLOAD_IMAGE, Info.UPLOAD_IMAGE)
oce.add(OpCodes.DOWNLOAD_IMAGE, Info.DOWNLOAD_IMAGE) oce.add(OpCode.DOWNLOAD_IMAGE, Info.DOWNLOAD_IMAGE)
oce.add(OpCodes.ONE_SHOOT_HK, Info.ONE_SHOOT_HK) oce.add(OpCode.ONE_SHOOT_HK, Info.ONE_SHOOT_HK)
oce.add(OpCodes.ENABLE_HK, Info.ENABLE_HK) oce.add(OpCode.ENABLE_HK, Info.ENABLE_HK)
oce.add(OpCodes.DISABLE_HK, Info.DISABLE_HK) oce.add(OpCode.DISABLE_HK, Info.DISABLE_HK)
oce.add(OpCodes.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE) oce.add(OpCode.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE)
oce.add( oce.add(
OpCodes.ADD_SECONDARY_TM_TO_NORMAL_MODE, Info.ADD_SECONDARY_TM_TO_NORMAL_MODE OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE, Info.ADD_SECONDARY_TM_TO_NORMAL_MODE
) )
oce.add(OpCodes.READ_SECONDARY_TM_SET, Info.READ_SECONDARY_TM_SET) oce.add(OpCode.READ_SECONDARY_TM_SET, Info.READ_SECONDARY_TM_SET)
oce.add(OpCodes.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET) oce.add(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET)
oce.add(OpCodes.FW_UPDATE, Info.FW_UPDATE) oce.add(OpCode.FW_UPDATE, Info.FW_UPDATE)
oce.add(OpCodes.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME) oce.add(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
oce.add(OpCode.RELOAD_JSON_CFG_FILE, Info.RELOAD_JSON_CFG_FILE)
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce) defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)

View File

@ -37,27 +37,15 @@ HARDCODED = "0"
MANUAL_INPUT = "1" MANUAL_INPUT = "1"
HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin" HARDCODED_FILE = "/home/rmueller/EIVE/mpsoc_boot.bin"
update_file_dict = { UPDATE_FILE_DICT = {
HARDCODED: ["hardcoded", ""], HARDCODED: ("hardcoded", ""),
MANUAL_INPUT: ["manual input", ""], MANUAL_INPUT: ("manual input", ""),
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"], "2": ("/mnt/sd0/ploc/mpsoc/image.bin", "/mnt/sd0/ploc/mpsoc/image.bin"),
"3": [
"/mnt/sd0/ploc/supervisor/update-large.bin",
"/mnt/sd0/ploc/supervisor/update-large.bin",
],
"4": [
"/mnt/sd0/ploc/supervisor/update-small.bin",
"/mnt/sd0/ploc/supervisor/update-small.bin",
],
"5": [
"/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
"/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
],
} }
event_buffer_path_dict = { EVENT_BUFFER_PATH_DICT = {
MANUAL_INPUT: ["manual input", ""], MANUAL_INPUT: ("manual input", ""),
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"], "2": ("/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"),
} }
@ -81,7 +69,7 @@ FACTORY_RESET_OPS = {
class SupvActionId(enum.IntEnum): class SupvActionId(enum.IntEnum):
HK_REPORT = 1 REQUEST_HK_REPORT = 1
START_MPSOC = 3 START_MPSOC = 3
SHUTWOWN_MPSOC = 4 SHUTWOWN_MPSOC = 4
SEL_MPSOC_BOOT_IMAGE = 5 SEL_MPSOC_BOOT_IMAGE = 5
@ -108,7 +96,7 @@ class SupvActionId(enum.IntEnum):
SET_GPIO = 34 SET_GPIO = 34
READ_GPIO = 35 READ_GPIO = 35
RESTART_SUPERVISOR = 36 RESTART_SUPERVISOR = 36
LOGGING_REQUEST_COUNTERS = 38 REQUEST_LOGGING_COUNTERS = 38
FACTORY_RESET = 39 FACTORY_RESET = 39
START_MPSOC_QUIET = 45 START_MPSOC_QUIET = 45
SET_SHUTDOWN_TIMEOUT = 46 SET_SHUTDOWN_TIMEOUT = 46
@ -127,18 +115,22 @@ class SupvActionId(enum.IntEnum):
MEM_CHECK = 61 MEM_CHECK = 61
class SetIds(enum.IntEnum): class SetId(enum.IntEnum):
HK_REPORT = 102 HK_REPORT = 102
BOOT_STATUS_REPORT = 103 BOOT_STATUS_REPORT = 103
LATCHUP_REPORT = 104
COUNTERS_REPORT = 105
ADC_REPORT = 106
UPDATE_STATUS_REPORT = 107
class OpCode(str, enum.Enum): class OpCode:
value: str
OFF = "off" OFF = "off"
ON = "on" ON = "on"
NML = "nml" NORMAL = "nml"
HK_TO_OBC = "hk_to_obc" HK_TO_OBC = "hk_to_obc"
REQUEST_HK = "req_hk" REQUEST_HK_SET_FROM_DEV = "req_hk_from_dev"
REQUEST_HK_SET = "req_hk"
START_MPSOC = "start_mpsoc" START_MPSOC = "start_mpsoc"
SHUTDOWN_MPSOC = "stop_mpsoc" SHUTDOWN_MPSOC = "stop_mpsoc"
SEL_NVM = "sel_nvm" SEL_NVM = "sel_nvm"
@ -158,9 +150,10 @@ class Info(str, enum.Enum):
ON = "Switch On" ON = "Switch On"
NML = "Switch Normal" NML = "Switch Normal"
HK_TO_OBC = "Request HK from PLOC SUPV" HK_TO_OBC = "Request HK from PLOC SUPV"
REQUEST_HK = "Request HK set from PLOC Handler"
START_MPSOC = "Start MPSoC" START_MPSOC = "Start MPSoC"
SHUTDOWN_MPSOC = "Shutdown MPSoC" SHUTDOWN_MPSOC = "Shutdown MPSoC"
REQUEST_HK_SET_FROM_DEV = "Request HK set from the device to the PLOC Handler"
REQUEST_HK_SET = "Request HK set from PLOC Handler"
SET_TIME_REF = "Set time reference" SET_TIME_REF = "Set time reference"
FACTORY_FLASH = "Factory Flash Mode" FACTORY_FLASH = "Factory Flash Mode"
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes" PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
@ -198,19 +191,43 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
q.add_log_cmd(f"{prefix}: {Info.ON}") q.add_log_cmd(f"{prefix}: {Info.ON}")
command = pack_mode_data(object_id.as_bytes, Mode.ON, 0) command = pack_mode_data(object_id.as_bytes, Mode.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if cmd_str == OpCode.NML: if cmd_str == OpCode.NORMAL:
q.add_log_cmd(f"{prefix}: {Info.NML}") q.add_log_cmd(f"{prefix}: {Info.NML}")
command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0) command = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command)) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if cmd_str == OpCode.HK_TO_OBC: if cmd_str == OpCode.HK_TO_OBC:
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}") q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT) command = obyt + struct.pack("!I", SupvActionId.REQUEST_HK_REPORT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == OpCode.REQUEST_HK: elif cmd_str == OpCode.START_MPSOC:
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}") q.add_log_cmd("PLOC Supervisor: Start MPSoC")
sid = make_sid(object_id.as_bytes, SetIds.HK_REPORT) command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == OpCode.SHUTDOWN_MPSOC:
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SHUTWOWN_MPSOC)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == OpCode.REQUEST_HK_SET:
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET}")
sid = make_sid(object_id.as_bytes, prompt_set_id())
cmd = generate_one_hk_command(sid) cmd = generate_one_hk_command(sid)
q.add_pus_tc(cmd) q.add_pus_tc(cmd)
if cmd_str == OpCode.REQUEST_HK_SET_FROM_DEV:
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET_FROM_DEV}")
set_id = prompt_set_id()
action_cmd = None
if set_id == SetId.HK_REPORT:
action_cmd = create_action_cmd(PLOC_SUPV_ID, SupvActionId.REQUEST_HK_REPORT)
if set_id == SetId.ADC_REPORT:
action_cmd = create_action_cmd(
PLOC_SUPV_ID, SupvActionId.REQUEST_ADC_REPORT
)
if set_id == SetId.COUNTERS_REPORT:
action_cmd = create_action_cmd(
PLOC_SUPV_ID, SupvActionId.REQUEST_LOGGING_COUNTERS
)
assert action_cmd is not None
q.add_pus_tc(action_cmd)
elif cmd_str == OpCode.START_MPSOC: elif cmd_str == OpCode.START_MPSOC:
q.add_log_cmd("PLOC Supervisor: Start MPSoC") q.add_log_cmd("PLOC Supervisor: Start MPSoC")
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC) command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
@ -257,7 +274,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
q.add_log_cmd(Info.RESET_MPSOC) q.add_log_cmd(Info.RESET_MPSOC)
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC) command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_MPSOC)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str in OpCode.SET_TIME_REF: if cmd_str == OpCode.SET_TIME_REF:
q.add_log_cmd("PLOC Supervisor: Set time reference") q.add_log_cmd("PLOC Supervisor: Set time reference")
command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF) command = object_id.as_bytes + struct.pack("!I", SupvActionId.SET_TIME_REF)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -281,7 +298,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
q.add_wait_seconds(2.0) q.add_wait_seconds(2.0)
sid = make_sid(object_id.as_bytes, SetIds.BOOT_STATUS_REPORT) sid = make_sid(object_id.as_bytes, SetId.BOOT_STATUS_REPORT)
req_hk = generate_one_hk_command(sid) req_hk = generate_one_hk_command(sid)
q.add_pus_tc(req_hk) q.add_pus_tc(req_hk)
if cmd_str == "17": if cmd_str == "17":
@ -393,7 +410,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
if cmd_str == "54": if cmd_str == "54":
q.add_log_cmd("PLOC Supervisor: Logging request counters") q.add_log_cmd("PLOC Supervisor: Logging request counters")
command = object_id.as_bytes + struct.pack( command = object_id.as_bytes + struct.pack(
"!I", SupvActionId.LOGGING_REQUEST_COUNTERS "!I", SupvActionId.REQUEST_LOGGING_COUNTERS
) )
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == "55": if cmd_str == "55":
@ -440,6 +457,20 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
q.add_pus_tc(command) q.add_pus_tc(command)
def prompt_set_id() -> SetId:
for set_id in SetId:
print(f"{set_id}: {set_id.name}")
while True:
set_id = int(input("Please select the set ID to request: "))
try:
set_id_typed = SetId(set_id)
except ValueError:
_LOGGER.warning("invalid set ID, try again")
continue
break
return set_id_typed
def pack_sel_boot_image_cmd( def pack_sel_boot_image_cmd(
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
) -> bytearray: ) -> bytearray:
@ -635,10 +666,10 @@ def pack_set_gpio_cmd(object_id: bytes) -> bytearray:
port = int(input("Specify port: 0x"), 16) port = int(input("Specify port: 0x"), 16)
pin = int(input("Specify pin: 0x"), 16) pin = int(input("Specify pin: 0x"), 16)
val = int(input("Specify val: 0x"), 16) val = int(input("Specify val: 0x"), 16)
command = object_id + struct.pack("!I", SupvActionId.SET_GPIO) command = bytearray(object_id + struct.pack("!I", SupvActionId.SET_GPIO))
command = command + struct.pack("!B", port) command.append(port)
command = command + struct.pack("!B", pin) command.append(pin)
command = command + struct.pack("!B", val) command.append(val)
return bytearray(command) return bytearray(command)
@ -660,25 +691,25 @@ def pack_logging_set_topic(object_id: bytes) -> bytearray:
def get_update_file() -> str: def get_update_file() -> str:
_LOGGER.info("Specify update file ") _LOGGER.info("Specify update file ")
input_helper = InputHelper(update_file_dict) input_helper = InputHelper(UPDATE_FILE_DICT)
key = input_helper.get_key() key = input_helper.get_key()
if key == HARDCODED: if key == HARDCODED:
file = HARDCODED_FILE file = HARDCODED_FILE
elif key == MANUAL_INPUT: elif key == MANUAL_INPUT:
file = input("Ploc Supervisor: Specify absolute name of update file: ") file = input("Ploc Supervisor: Specify absolute name of update file: ")
else: else:
file = update_file_dict[key][1] file = UPDATE_FILE_DICT[key][1]
return file return file
def get_event_buffer_path() -> str: def get_event_buffer_path() -> str:
_LOGGER.info("Specify path where to store event buffer file ") _LOGGER.info("Specify path where to store event buffer file ")
input_helper = InputHelper(event_buffer_path_dict) input_helper = InputHelper(EVENT_BUFFER_PATH_DICT)
key = input_helper.get_key() key = input_helper.get_key()
if key == MANUAL_INPUT: if key == MANUAL_INPUT:
file = input("Ploc Supervisor: Specify path: ") file = input("Ploc Supervisor: Specify path: ")
else: else:
file = event_buffer_path_dict[key][1] file = EVENT_BUFFER_PATH_DICT[key][1]
return file return file
@ -690,8 +721,20 @@ class SocState(enum.IntEnum):
def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper): def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
current_idx = 0 if set_id == SetId.HK_REPORT:
if set_id == SetIds.HK_REPORT: handle_hk_report(hk_data, pw)
elif set_id == SetId.BOOT_STATUS_REPORT:
handle_boot_report(hk_data, pw)
elif set_id == SetId.ADC_REPORT:
handle_adc_report(hk_data)
elif set_id == SetId.COUNTERS_REPORT:
handle_counters_report(hk_data)
else:
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
def handle_hk_report(hk_data: bytes, pw: PrintWrapper):
fmt_str = "!IIIQIIIIIBBBB" fmt_str = "!IIIQIIIIIBBBB"
inc_len = struct.calcsize(fmt_str) inc_len = struct.calcsize(fmt_str)
( (
@ -718,7 +761,10 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
pw.dlog(f"Mission IO state {mission_io_state}") pw.dlog(f"Mission IO state {mission_io_state}")
pw.dlog(f"FMC state {fmc_state}") pw.dlog(f"FMC state {fmc_state}")
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 13)) pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[inc_len:], 13))
elif set_id == SetIds.BOOT_STATUS_REPORT:
def handle_boot_report(hk_data: bytes, pw: PrintWrapper):
current_idx = 0
fmt_str = "!BBIIBBBBBB" fmt_str = "!BBIIBBBBBB"
inc_len = struct.calcsize(fmt_str) inc_len = struct.calcsize(fmt_str)
( (
@ -741,11 +787,86 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
pw.dlog(f"Power Cycles {power_cycles}") pw.dlog(f"Power Cycles {power_cycles}")
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms") pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
pw.dlog(f"Active NVM: {active_nvm}") pw.dlog(f"Active NVM: {active_nvm}")
pw.dlog( pw.dlog(f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}")
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
)
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}") pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10) FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10)
else:
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]") def handle_adc_report(hk_data: bytes):
if len(hk_data) < 64:
_LOGGER.warning("ADC report smaller than 64 bytes")
current_idx = 0
adc_raw = []
adc_eng = []
for _ in range(16):
adc_raw.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
current_idx += 2
for _ in range(16):
adc_eng.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
current_idx += 2
print(f"{'Index'.ljust(10)} | {'ADC RAW'.ljust(10)} | {'ADC ENG'.ljust(10)}")
for i in range(16):
print(f"{i: >10} | {adc_raw[i]: >10} | {adc_eng[i]: >10}")
def handle_counters_report(hk_data: bytes):
current_idx = 0
signature = struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
current_idx += 4
latchup_counters = []
for _ in range(7):
latchup_counters.append(
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
)
current_idx += 4
fmt_str = "!IIIIIIIIIIIIIIIIIIII"
inc_len = struct.calcsize(fmt_str)
(
adc_deviation_triggers_cnt,
tc_received_cnt,
tm_available_cnt,
supervisor_boots,
mpsoc_boots,
mpsoc_boot_failed_attempts,
mpsoc_powerup,
mpsoc_updates,
mpsoc_heartbeat_resets,
cpu_wdt_resets,
ps_heartbeats_lost,
pl_heartbeats_lost,
eb_task_lost,
bm_task_lost,
lm_task_lost,
am_task_lost,
tctmm_task_lost,
mm_task_lost,
hk_task_lost,
dl_task_lost,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len
_redwire_tasks_lost = []
for _ in range(3):
_redwire_tasks_lost.append(
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
)
print(f"Signature: {signature}")
print(f"Latchup Counters: {latchup_counters}")
print(f"ADC Deviation Triggers Count: {adc_deviation_triggers_cnt}")
print(f"TCs received: {tc_received_cnt} | TMs Available: {tm_available_cnt}")
print(f"Supervisor Boots: {supervisor_boots} | MPSoC boots: {mpsoc_boots}")
print(f"MPSoC boot failed attempts: {mpsoc_boot_failed_attempts}")
print(f"MPSoC powerup: {mpsoc_powerup}")
print(f"MPSoC updates: {mpsoc_updates}")
print(f"MPSoC heartbeat resets: {mpsoc_heartbeat_resets}")
print(f"CPU WDT resets: {cpu_wdt_resets}")
print(f"PS heartbeats lost: {ps_heartbeats_lost}")
print(f"PL heartbeats lost: {pl_heartbeats_lost}")
print(f"EB task lost: {eb_task_lost}")
print(f"BM task lost: {bm_task_lost}")
print(f"LM task lost: {lm_task_lost}")
print(f"AM task lost: {am_task_lost}")
print(f"TCTMM task lost: {tctmm_task_lost}")
print(f"MM task lost: {mm_task_lost}")
print(f"HK task lost: {hk_task_lost}")
print(f"DL task lost: {dl_task_lost}")

View File

@ -42,11 +42,15 @@ class OpCode:
NORMAL_TX = "nml_tx" NORMAL_TX = "nml_tx"
NORMAL_MPA = "nml_mpa" NORMAL_MPA = "nml_mpa"
NORMAL_HPA = "nml_hpa" NORMAL_HPA = "nml_hpa"
NORMAL_CUSTOM = "nml_custom"
ENABLE_HK = "enable_hk" ENABLE_HK = "enable_hk"
DISABLE_HK = "disable_hk" DISABLE_HK = "disable_hk"
REQ_OS_HK = "hk_os" REQ_OS_HK = "hk_os"
DISABLE_ORDER_CHECKING = "disable_order_checking"
ENABLE_ORDER_CHECKING = "enable_order_checking"
UPDATE_I_UPPER_LIMIT = "update_i_upper_limit" UPDATE_I_UPPER_LIMIT = "update_i_upper_limit"
UPDATE_V_LOWER_LIMIT = "update_v_lower_limit" UPDATE_V_LOWER_LIMIT = "update_v_lower_limit"
UPDATE_V_UPPER_LIMIT = "update_v_upper_limit" UPDATE_V_UPPER_LIMIT = "update_v_upper_limit"
@ -69,6 +73,7 @@ class Info:
NORMAL_TX = f"{NORMAL}, TX on" NORMAL_TX = f"{NORMAL}, TX on"
NORMAL_MPA = f"{NORMAL}, MPA on" NORMAL_MPA = f"{NORMAL}, MPA on"
NORMAL_HPA = f"{NORMAL}, HPA on" NORMAL_HPA = f"{NORMAL}, HPA on"
NORMAL_CUSTOM = f"{NORMAL}, Custom Channel Settings"
REQ_OS_HK = "Request One Shot HK" REQ_OS_HK = "Request One Shot HK"
ENABLE_HK = "Enable HK" ENABLE_HK = "Enable HK"
DISABLE_HK = "Disable HK" DISABLE_HK = "Disable HK"
@ -81,6 +86,8 @@ class Info:
INJECT_TX_TO_MPA_FAILURE = "Inject TX to MPA failure" INJECT_TX_TO_MPA_FAILURE = "Inject TX to MPA failure"
INJECT_MPA_TO_HPA_FAILURE = "Inject MPA to HPA failure" INJECT_MPA_TO_HPA_FAILURE = "Inject MPA to HPA failure"
INJECT_ALL_ON_FAILURE = "Inject all on failure" INJECT_ALL_ON_FAILURE = "Inject all on failure"
DISABLE_ORDER_CHECKING = "Disable order checks"
ENABLE_ORDER_CHECKING = "Enable order checks"
class SetId(enum.IntEnum): class SetId(enum.IntEnum):
@ -167,6 +174,8 @@ class ParamId(enum.IntEnum):
INJECT_MPA_TO_HPA_FAILURE = 34 INJECT_MPA_TO_HPA_FAILURE = 34
INJECT_ALL_ON_FAILURE = 35 INJECT_ALL_ON_FAILURE = 35
DISABLE_ORDER_CHECK_CHANNELS = 40
class DevSelect(enum.IntEnum): class DevSelect(enum.IntEnum):
SSR_NEG_V = 0 SSR_NEG_V = 0
@ -200,6 +209,7 @@ def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCode.NORMAL_TX, info=Info.NORMAL_TX) oce.add(keys=OpCode.NORMAL_TX, info=Info.NORMAL_TX)
oce.add(keys=OpCode.NORMAL_MPA, info=Info.NORMAL_MPA) oce.add(keys=OpCode.NORMAL_MPA, info=Info.NORMAL_MPA)
oce.add(keys=OpCode.NORMAL_HPA, info=Info.NORMAL_HPA) oce.add(keys=OpCode.NORMAL_HPA, info=Info.NORMAL_HPA)
oce.add(keys=OpCode.NORMAL_CUSTOM, info=Info.NORMAL_CUSTOM)
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK) oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
oce.add(keys=OpCode.ENABLE_HK, info=Info.ENABLE_HK) oce.add(keys=OpCode.ENABLE_HK, info=Info.ENABLE_HK)
oce.add(keys=OpCode.UPDATE_V_LOWER_LIMIT, info=Info.UPDATE_V_LOWER_LIMIT) oce.add(keys=OpCode.UPDATE_V_LOWER_LIMIT, info=Info.UPDATE_V_LOWER_LIMIT)
@ -226,6 +236,8 @@ def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
info="Inject failure in MPA to HPA transition", info="Inject failure in MPA to HPA transition",
) )
oce.add(keys=OpCode.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode") oce.add(keys=OpCode.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
oce.add(keys=OpCode.DISABLE_ORDER_CHECKING, info=Info.DISABLE_ORDER_CHECKING)
oce.add(keys=OpCode.ENABLE_ORDER_CHECKING, info=Info.ENABLE_ORDER_CHECKING)
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce) defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
@ -296,6 +308,14 @@ def pack_pl_pcdu_commands( # noqa C901: Complexity is okay here.
mode=Mode.NORMAL, mode=Mode.NORMAL,
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON), submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
) )
if cmd_str == OpCode.NORMAL_CUSTOM:
pack_pl_pcdu_mode_cmd(
q=q,
info=Info.NORMAL_CUSTOM,
mode=Mode.NORMAL,
submode=prompt_custom_normal_submode(),
)
if cmd_str == OpCode.REQ_OS_HK: if cmd_str == OpCode.REQ_OS_HK:
q.add_log_cmd(f"PL PCDU: {Info.REQ_OS_HK}") q.add_log_cmd(f"PL PCDU: {Info.REQ_OS_HK}")
q.add_pus_tc( q.add_pus_tc(
@ -303,6 +323,26 @@ def pack_pl_pcdu_commands( # noqa C901: Complexity is okay here.
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetId.ADC) sid=make_sid(object_id=PL_PCDU_ID, set_id=SetId.ADC)
) )
) )
if cmd_str == OpCode.DISABLE_ORDER_CHECKING:
q.add_log_cmd(Info.DISABLE_ORDER_CHECKING)
q.add_pus_tc(
create_load_param_cmd(
create_scalar_boolean_parameter(
PL_PCDU_ID, 0, ParamId.DISABLE_ORDER_CHECK_CHANNELS, True
)
)
)
if cmd_str == OpCode.ENABLE_ORDER_CHECKING:
q.add_log_cmd(Info.ENABLE_ORDER_CHECKING)
q.add_pus_tc(
create_load_param_cmd(
create_scalar_boolean_parameter(
PL_PCDU_ID, 0, ParamId.DISABLE_ORDER_CHECK_CHANNELS, False
)
)
)
if cmd_str == OpCode.UPDATE_I_UPPER_LIMIT: if cmd_str == OpCode.UPDATE_I_UPPER_LIMIT:
q.add_log_cmd(Info.UPDATE_I_UPPER_LIMIT) q.add_log_cmd(Info.UPDATE_I_UPPER_LIMIT)
print("Select device to update lower current limit for: ") print("Select device to update lower current limit for: ")
@ -339,8 +379,6 @@ def pack_pl_pcdu_commands( # noqa C901: Complexity is okay here.
create_scalar_double_parameter(PL_PCDU_ID, 0, param_id, new_param_value) create_scalar_double_parameter(PL_PCDU_ID, 0, param_id, new_param_value)
) )
) )
if cmd_str == OpCode.SWITCH_HPA_ON_PROC:
hpa_on_procedure(q)
if cmd_str == OpCode.INJECT_ALL_ON_FAILURE: if cmd_str == OpCode.INJECT_ALL_ON_FAILURE:
pack_failure_injection_cmd( pack_failure_injection_cmd(
q=q, q=q,
@ -649,3 +687,31 @@ def dev_select_to_upper_u_update_param_id(dev_select: DevSelect) -> ParamId:
if param_id is None: if param_id is None:
raise ValueError("invalid parameter ID") raise ValueError("invalid parameter ID")
return param_id return param_id
def prompt_custom_normal_submode() -> int:
print("Prompting custom submode.")
submode = 0
def prompt_channel(submode: int, channel_str: str, mask: NormalSubmodesMask) -> int:
while True:
channel_on = input(f" {channel_str} ON? [y/n]: ")
if channel_on in ["y", "1", "yes"]:
submode |= 1 << mask
elif channel_on in ["n", "0", "no"]:
pass
else:
_LOGGER.warning("invalid input, try again")
continue
break
return submode
submode = prompt_channel(
submode, "SSR", NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
)
submode = prompt_channel(submode, "DRO", NormalSubmodesMask.DRO_ON)
submode = prompt_channel(submode, "X8", NormalSubmodesMask.X8_ON)
submode = prompt_channel(submode, "TX", NormalSubmodesMask.TX_ON)
submode = prompt_channel(submode, "MPA", NormalSubmodesMask.MPA_ON)
submode = prompt_channel(submode, "HPA", NormalSubmodesMask.HPA_ON)
return submode

View File

@ -33,6 +33,8 @@ class CmdString:
STACK_5V_ON = "stack_5v_on" STACK_5V_ON = "stack_5v_on"
STACK_5V_OFF = "stack_5v_off" STACK_5V_OFF = "stack_5v_off"
TEST = "test" TEST = "test"
ACU_OFF = "acu_off"
ACU_ON = "acu_on"
class CmdInfo: class CmdInfo:
@ -41,6 +43,8 @@ class CmdInfo:
STACK_3V3_OFF = f"{PREFIX}: Turn Stack 3V3 off" STACK_3V3_OFF = f"{PREFIX}: Turn Stack 3V3 off"
STACK_5V_ON = f"{PREFIX}: Turn Stack 5V on" STACK_5V_ON = f"{PREFIX}: Turn Stack 5V on"
STACK_5V_OFF = f"{PREFIX}: Turn Stack 5V off" STACK_5V_OFF = f"{PREFIX}: Turn Stack 5V off"
ACU_OFF = "Switch ACU off"
ACU_ON = "Switch ACU on"
class P60DockTestProcedure: class P60DockTestProcedure:

View File

@ -24,14 +24,20 @@ from eive_tmtc.config.object_ids import (
) )
class CustomSubservice(enum.IntEnum):
DELETE_BY_TIME_RANGE = 128
class OpCode: class OpCode:
RETRIEVAL_BY_TIME_RANGE = "retrieval_time_range" RETRIEVAL_BY_TIME_RANGE = "retrieval_time_range"
DELETE_UP_TO = "delete_up_to" DELETE_UP_TO = "delete_up_to"
DELETE_BY_TIME_RANGE = "delete_time_range"
class Info: class Info:
RETRIEVAL_BY_TIME_RANGE = "Dump Telemetry Packets by time range" RETRIEVAL_BY_TIME_RANGE = "Dump Telemetry Packets by time range"
DELETE_UP_TO = "Delete Telemetry Packets up to time" DELETE_UP_TO = "Delete Telemetry Packets up to time"
DELETE_BY_TIME_RANGE = "Delete Telemetry by time range"
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -54,7 +60,7 @@ def pack_tm_store_commands(q: DefaultPusQueueHelper, cmd_path: str):
) )
elif cmd_path == OpCode.RETRIEVAL_BY_TIME_RANGE: elif cmd_path == OpCode.RETRIEVAL_BY_TIME_RANGE:
q.add_log_cmd(Info.RETRIEVAL_BY_TIME_RANGE) q.add_log_cmd(Info.RETRIEVAL_BY_TIME_RANGE)
obj_id, store_string = store_select_prompt() obj_id, _ = store_select_prompt()
app_data = bytearray(obj_id.as_bytes) app_data = bytearray(obj_id.as_bytes)
start_of_dump_time = time_prompt("Determining retrieval start time") start_of_dump_time = time_prompt("Determining retrieval start time")
start_stamp = int(math.floor(start_of_dump_time.timestamp())) start_stamp = int(math.floor(start_of_dump_time.timestamp()))
@ -74,6 +80,28 @@ def pack_tm_store_commands(q: DefaultPusQueueHelper, cmd_path: str):
app_data=app_data, app_data=app_data,
) )
) )
elif cmd_path == OpCode.DELETE_BY_TIME_RANGE:
q.add_log_cmd(Info.DELETE_BY_TIME_RANGE)
obj_id, _ = store_select_prompt()
app_data = bytearray(obj_id.as_bytes)
start_of_dump_time = time_prompt("Determining deletion start time")
start_stamp = int(math.floor(start_of_dump_time.timestamp()))
end_of_dump_time = time_prompt("Determining deletion end time")
end_stamp = int(math.floor(end_of_dump_time.timestamp()))
app_data.extend(struct.pack("!I", start_stamp))
app_data.extend(struct.pack("!I", end_stamp))
q.add_log_cmd(Info.DELETE_BY_TIME_RANGE)
q.add_log_cmd(f"Selected Store: {obj_id}")
q.add_log_cmd(
f"Deletion from time {start_of_dump_time} up to time {end_of_dump_time}"
)
q.add_pus_tc(
PusTelecommand(
service=15,
subservice=CustomSubservice.DELETE_BY_TIME_RANGE,
app_data=app_data,
)
)
def create_persistent_tm_store_node() -> CmdTreeNode: def create_persistent_tm_store_node() -> CmdTreeNode:
@ -89,6 +117,7 @@ def add_persistent_tm_store_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry() oce = OpCodeEntry()
oce.add(keys=OpCode.DELETE_UP_TO, info=Info.DELETE_UP_TO) oce.add(keys=OpCode.DELETE_UP_TO, info=Info.DELETE_UP_TO)
oce.add(keys=OpCode.RETRIEVAL_BY_TIME_RANGE, info=Info.RETRIEVAL_BY_TIME_RANGE) oce.add(keys=OpCode.RETRIEVAL_BY_TIME_RANGE, info=Info.RETRIEVAL_BY_TIME_RANGE)
oce.add(keys=OpCode.DELETE_BY_TIME_RANGE, info=Info.DELETE_BY_TIME_RANGE)
defs.add_service( defs.add_service(
CustomServiceList.TM_STORE, "Persistent TM Store", op_code_entry=oce CustomServiceList.TM_STORE, "Persistent TM Store", op_code_entry=oce
) )
@ -181,5 +210,6 @@ def store_select_prompt() -> Tuple[ObjectIdU32, str]:
break break
obj_id_raw = desc_and_obj_id[0] obj_id_raw = desc_and_obj_id[0]
obj_id = obj_id_dict.get(obj_id_raw) obj_id = obj_id_dict.get(obj_id_raw)
assert obj_id is not None
print(f"Selected store: {obj_id} ({desc_and_obj_id[1]})") print(f"Selected store: {obj_id} ({desc_and_obj_id[1]})")
return obj_id_dict.get(obj_id_raw), desc_and_obj_id[1] return obj_id, desc_and_obj_id[1]