Compare commits
30 Commits
69fda96d7a
...
v7.0.0
Author | SHA1 | Date | |
---|---|---|---|
9a06c64dfa | |||
cc7837a55b | |||
9cc4fa702c | |||
ada099cab1 | |||
376f94b167 | |||
5e1b12fa52 | |||
de34952df5 | |||
5da55c3c99 | |||
3b903e5639 | |||
da35c7fdf1 | |||
8c7cbd1bd6 | |||
ba0a3e35d2 | |||
fc2667c150 | |||
f9041f215a | |||
a59aceda75 | |||
c50f8c2ce2 | |||
dfa45dbdba
|
|||
36d9323b57
|
|||
e04b5bf9d7
|
|||
3c0ac91227 | |||
f61c485979 | |||
2ebbf750bd
|
|||
847fccbe66 | |||
c8292f4ee1 | |||
3700769e46 | |||
1cafdc817f
|
|||
5967dede97
|
|||
344f16099e | |||
baf1b44d23 | |||
342a3bbcc9 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -10,10 +10,18 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
# [v7.0.0] 2024-04-17
|
# [v7.0.0] 2024-05-06
|
||||||
|
|
||||||
- Reworked PLOC MPSoC commanding to be inline with OBSW update.
|
- Reworked PLOC MPSoC commanding to be inline with OBSW update.
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- GNSS commands working again (again).
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- Added handling for new clock events.
|
||||||
|
|
||||||
# [v6.2.0] 2024-04-10
|
# [v6.2.0] 2024-04-10
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
@@ -15,6 +15,10 @@ TM_DB_PATH = "tm.db"
|
|||||||
# Separate DB or not? Not sure..
|
# Separate DB or not? Not sure..
|
||||||
# RAW_TM_PATH = "raw_tm.db"
|
# RAW_TM_PATH = "raw_tm.db"
|
||||||
|
|
||||||
|
# TODO: The cleanest way would be to load those from the config file..
|
||||||
|
PRINT_RAW_HK_B64_STR = False
|
||||||
|
PRINT_RAW_EVENTS_B64_STR = False
|
||||||
|
|
||||||
PUS_APID = 0x65
|
PUS_APID = 0x65
|
||||||
CFDP_APID = 0x66
|
CFDP_APID = 0x66
|
||||||
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
PUS_PACKET_ID = PacketId(PacketType.TM, True, PUS_APID)
|
||||||
|
@@ -135,7 +135,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
|||||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h
|
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h
|
||||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h
|
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h
|
||||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h
|
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h
|
||||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/plocMpsocHelpers.h
|
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;SUPV reply timeout.;linux/payload/plocMpsocHelpers.h
|
||||||
|
11609;0x2d59;CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE;LOW;Camera must be commanded on first.;linux/payload/plocMpsocHelpers.h
|
||||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||||
|
|
@@ -227,7 +227,7 @@ def handle_acs_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: Lis
|
|||||||
object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2]
|
object_id=RW4_ID, rw_idx=4, q=queue_helper, cmd_str=cmd_path_list[2]
|
||||||
)
|
)
|
||||||
|
|
||||||
if cmd_path_list[0] == "gnss_devs":
|
if cmd_path_list[0] == "gnss_ctrl":
|
||||||
return pack_gps_command(
|
return pack_gps_command(
|
||||||
object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1]
|
object_id=oids.GPS_CONTROLLER, q=queue_helper, cmd_str=cmd_path_list[1]
|
||||||
)
|
)
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
|
import base64
|
||||||
|
|
||||||
|
from eive_tmtc.config.definitions import PRINT_RAW_EVENTS_B64_STR
|
||||||
from eive_tmtc.config.events import get_event_dict
|
from eive_tmtc.config.events import get_event_dict
|
||||||
from eive_tmtc.config.object_ids import get_object_ids
|
from eive_tmtc.config.object_ids import get_object_ids
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
@@ -21,6 +23,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
def handle_event_packet( # noqa C901: Complexity okay here
|
def handle_event_packet( # noqa C901: Complexity okay here
|
||||||
raw_tm: bytes, pw: PrintWrapper
|
raw_tm: bytes, pw: PrintWrapper
|
||||||
): # noqa C901: Complexity okay here
|
): # noqa C901: Complexity okay here
|
||||||
|
if PRINT_RAW_EVENTS_B64_STR:
|
||||||
|
print(f"PUS Event TM Base64: {base64.b64encode(raw_tm)}")
|
||||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||||
event_dict = get_event_dict()
|
event_dict = get_event_dict()
|
||||||
event_def = tm.event_definition
|
event_def = tm.event_definition
|
||||||
@@ -36,6 +40,7 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
|||||||
obj_name = event_def.reporter_id.hex(sep=",")
|
obj_name = event_def.reporter_id.hex(sep=",")
|
||||||
else:
|
else:
|
||||||
obj_name = obj_id_obj.name
|
obj_name = obj_id_obj.name
|
||||||
|
assert tm.time_provider is not None
|
||||||
generic_event_string = (
|
generic_event_string = (
|
||||||
f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x})"
|
f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x})"
|
||||||
f" at {tm.time_provider.as_date_time()}"
|
f" at {tm.time_provider.as_date_time()}"
|
||||||
@@ -128,12 +133,16 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
|||||||
time = event_def.param1 + event_def.param2 / 1000.0
|
time = event_def.param1 + event_def.param2 / 1000.0
|
||||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||||
pw.dlog(f"Current time: {time_dt}")
|
pw.dlog(f"Current time: {time_dt}")
|
||||||
if info.name == "CLOCK_DUMP":
|
if (
|
||||||
|
info.name == "CLOCK_DUMP"
|
||||||
|
or info.name == "CLOCK_DUMP_BEFORE_SETTING_TIME"
|
||||||
|
or info.name == "CLOCK_DUMP_AFTER_SETTING_TIME"
|
||||||
|
):
|
||||||
specific_handler = True
|
specific_handler = True
|
||||||
# param 1 is timeval seconds, param 2 is timeval subsecond microseconds
|
# param 1 is timeval seconds, param 2 is timeval subsecond microseconds
|
||||||
time = event_def.param1 + event_def.param2 / 1000000.0
|
time = event_def.param1 + event_def.param2 / 1000000.0
|
||||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||||
pw.dlog(f"Current time: {time_dt}")
|
pw.dlog(f"Clock dump event {info.name}. Current time: {time_dt}")
|
||||||
if info.name == "ACTIVE_SD_INFO":
|
if info.name == "ACTIVE_SD_INFO":
|
||||||
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
|
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
|
||||||
sd_1_state = event_def.param2 & 0xFFFF
|
sd_1_state = event_def.param2 & 0xFFFF
|
||||||
|
@@ -6,6 +6,7 @@ import base64 # noqa
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from typing import List, cast
|
from typing import List, cast
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
from eive_tmtc.config.definitions import PRINT_RAW_HK_B64_STR
|
||||||
from eive_tmtc.pus_tm.hk import HkTmInfo
|
from eive_tmtc.pus_tm.hk import HkTmInfo
|
||||||
|
|
||||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
||||||
@@ -74,7 +75,8 @@ def handle_hk_packet(
|
|||||||
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||||
hk_data = tm_packet.tm_data[8:]
|
hk_data = tm_packet.tm_data[8:]
|
||||||
if named_obj_id.as_bytes in hk_filter.object_ids:
|
if named_obj_id.as_bytes in hk_filter.object_ids:
|
||||||
# print(f"PUS TM Base64: {base64.b64encode(raw_tm)}")
|
if PRINT_RAW_HK_B64_STR:
|
||||||
|
print(f"PUS TM Base64: {base64.b64encode(raw_tm)}")
|
||||||
handle_regular_hk_print(
|
handle_regular_hk_print(
|
||||||
printer=printer,
|
printer=printer,
|
||||||
packet_uuid=packet_uuid,
|
packet_uuid=packet_uuid,
|
||||||
|
@@ -23,7 +23,11 @@ class GpsInfo:
|
|||||||
MAX_SATELLITES = 30
|
MAX_SATELLITES = 30
|
||||||
|
|
||||||
|
|
||||||
class GnssChip(enum.IntEnum):
|
class ActIds:
|
||||||
|
RESET_GNSS = 5
|
||||||
|
|
||||||
|
|
||||||
|
class AcsBoardSides(enum.IntEnum):
|
||||||
A_SIDE = 0
|
A_SIDE = 0
|
||||||
B_SIDE = 1
|
B_SIDE = 1
|
||||||
|
|
||||||
@@ -37,7 +41,7 @@ class OpCode:
|
|||||||
REQ_SKYVIEW_HK = "skyview_hk_request"
|
REQ_SKYVIEW_HK = "skyview_hk_request"
|
||||||
ENABLE_SKYVIEW_HK = "skyview_hk_enable"
|
ENABLE_SKYVIEW_HK = "skyview_hk_enable"
|
||||||
DISABLE_SKYVIEW_HK = "skyview_hk_disable"
|
DISABLE_SKYVIEW_HK = "skyview_hk_disable"
|
||||||
RESET_GNSS = "reset"
|
RESET_GNSS = "reset_gnss"
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
@@ -63,7 +67,7 @@ def create_gnss_node() -> CmdTreeNode:
|
|||||||
]
|
]
|
||||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||||
node = CmdTreeNode("gnss_devs", "GNSS Controller", hide_children_for_print=True)
|
node = CmdTreeNode("gnss_ctrl", "GNSS Ctrl", hide_children_for_print=True)
|
||||||
for op_code, info in combined_dict.items():
|
for op_code, info in combined_dict.items():
|
||||||
node.add_child(CmdTreeNode(op_code, info))
|
node.add_child(CmdTreeNode(op_code, info))
|
||||||
return node
|
return node
|
||||||
@@ -73,16 +77,17 @@ def pack_gps_command( # noqa: C901
|
|||||||
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
|
object_id: bytes, q: DefaultPusQueueHelper, cmd_str: str
|
||||||
): # noqa: C901:
|
): # noqa: C901:
|
||||||
if cmd_str == OpCode.RESET_GNSS:
|
if cmd_str == OpCode.RESET_GNSS:
|
||||||
for val in GnssChip:
|
for val in AcsBoardSides:
|
||||||
print("{:<2}: {:<20}".format(val, val.name))
|
print("{:<2}: {:<20}".format(val, val.name))
|
||||||
chip: str = ""
|
board_side = int(input("Select Board Side \n" ""))
|
||||||
while chip not in ["0", "1"]:
|
q.add_log_cmd(f"GPS: {Info.RESET_GNSS}")
|
||||||
chip = input("Please specify which chip to reset: ")
|
|
||||||
q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}")
|
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(
|
||||||
create_action_cmd(object_id=object_id, action_id=5, user_data=chip.encode())
|
create_action_cmd(
|
||||||
|
object_id=object_id,
|
||||||
|
action_id=ActIds.RESET_GNSS,
|
||||||
|
user_data=bytearray([board_side]),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
_LOGGER.warning("Reset pin handling needs to be re-implemented")
|
|
||||||
if cmd_str == OpCode.ENABLE_CORE_HK:
|
if cmd_str == OpCode.ENABLE_CORE_HK:
|
||||||
interval = float(input("Please specify interval in floating point seconds: "))
|
interval = float(input("Please specify interval in floating point seconds: "))
|
||||||
if interval <= 0:
|
if interval <= 0:
|
||||||
|
@@ -27,6 +27,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
MANUAL_INPUT = "1"
|
MANUAL_INPUT = "1"
|
||||||
|
|
||||||
|
CRIT_CMD_APID_DICT = {"1": ("flash_mkfs", 0x12A)}
|
||||||
|
|
||||||
OBC_WRITE_FILE_DICT = {
|
OBC_WRITE_FILE_DICT = {
|
||||||
MANUAL_INPUT: ("manual input", ""),
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
|
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
|
||||||
@@ -88,8 +90,10 @@ class ActionId(enum.IntEnum):
|
|||||||
TC_FLASH_DIR_GET_CONTENT = 28
|
TC_FLASH_DIR_GET_CONTENT = 28
|
||||||
TM_FLASH_DIRECTORY_CONTENT = 29
|
TM_FLASH_DIRECTORY_CONTENT = 29
|
||||||
TC_FLASH_READ_FULL_FILE = 30
|
TC_FLASH_READ_FULL_FILE = 30
|
||||||
TC_SIMPLEX_STORE_FILE = 31
|
TC_SPLIT_FILE = 31
|
||||||
TC_VERIFY_BOOT = 32
|
TC_VERIFY_BOOT = 32
|
||||||
|
TC_ENABLE_TC_EXECUTION = 33
|
||||||
|
TC_FLASH_MKFS = 34
|
||||||
|
|
||||||
|
|
||||||
class Submode(enum.IntEnum):
|
class Submode(enum.IntEnum):
|
||||||
@@ -121,13 +125,15 @@ class OpCode:
|
|||||||
CAM_CMD_SEND = "cam_cmd_send"
|
CAM_CMD_SEND = "cam_cmd_send"
|
||||||
CAM_TAKE_PIC = "cam_take_pic"
|
CAM_TAKE_PIC = "cam_take_pic"
|
||||||
SIMPLEX_STREAM_FILE = "simplex_stream_file"
|
SIMPLEX_STREAM_FILE = "simplex_stream_file"
|
||||||
SIMPLEX_STORE_FILE = "simplex_store_file"
|
SPLIT_FILE = "split_file"
|
||||||
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
|
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
|
||||||
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
|
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
|
||||||
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
|
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
|
||||||
MODE_IDLE = "mode_idle"
|
MODE_IDLE = "mode_idle"
|
||||||
MODE_REPLAY = "mode_replay"
|
MODE_REPLAY = "mode_replay"
|
||||||
MODE_SNAPSHOT = "mode_snapshot"
|
MODE_SNAPSHOT = "mode_snapshot"
|
||||||
|
ENABLE_TC_EXECUTION = "enable_tc_exec"
|
||||||
|
FLASH_MKFS = "flash_mkfs"
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
@@ -147,7 +153,7 @@ class Info:
|
|||||||
CAM_TAKE_PIC = "Cam Take Picture"
|
CAM_TAKE_PIC = "Cam Take Picture"
|
||||||
CAM_CMD_SEND = "Send Camera Command"
|
CAM_CMD_SEND = "Send Camera Command"
|
||||||
SIMPLEX_STREAM_FILE = "Simplex Stream File with E-Band"
|
SIMPLEX_STREAM_FILE = "Simplex Stream File with E-Band"
|
||||||
SIMPLEX_STORE_FILE = "Simplex Store File on MPSoC"
|
SPLIT_FILE = "Split file on MPSoC Flash"
|
||||||
FLASH_READ_FILE = "Copy file from MPSoC to OBC"
|
FLASH_READ_FILE = "Copy file from MPSoC to OBC"
|
||||||
FLASH_WRITE_FILE = "Copy file from OBC to MPSoC"
|
FLASH_WRITE_FILE = "Copy file from OBC to MPSoC"
|
||||||
FLASH_DELETE_FILE = "Delete file on MPSoC"
|
FLASH_DELETE_FILE = "Delete file on MPSoC"
|
||||||
@@ -158,6 +164,8 @@ class Info:
|
|||||||
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
|
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
|
||||||
"Disable PLOC SUPV commanding when switching ON"
|
"Disable PLOC SUPV commanding when switching ON"
|
||||||
)
|
)
|
||||||
|
ENABLE_TC_EXECUTION = "Enable execution of critical commands"
|
||||||
|
FLASH_MKFS = "Flash MKFS command"
|
||||||
|
|
||||||
|
|
||||||
class MemAddresses(enum.IntEnum):
|
class MemAddresses(enum.IntEnum):
|
||||||
@@ -271,6 +279,44 @@ def pack_ploc_mpsoc_commands(
|
|||||||
+ bytearray(cam_cmd, "utf-8")
|
+ bytearray(cam_cmd, "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 == OpCode.ENABLE_TC_EXECUTION:
|
||||||
|
q.add_log_cmd(Info.ENABLE_TC_EXECUTION)
|
||||||
|
while True:
|
||||||
|
for key, val in CRIT_CMD_APID_DICT.items():
|
||||||
|
print(f"{key}: {val[0]} with APID {val[1]}")
|
||||||
|
key = input("Please specify the command to enable by key: ")
|
||||||
|
if key not in CRIT_CMD_APID_DICT:
|
||||||
|
print("invalid key")
|
||||||
|
continue
|
||||||
|
apid = CRIT_CMD_APID_DICT[key][1]
|
||||||
|
break
|
||||||
|
app_data = struct.pack("!H", apid)
|
||||||
|
q.add_pus_tc(
|
||||||
|
create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_TC_EXECUTION, app_data)
|
||||||
|
)
|
||||||
|
if cmd_str == OpCode.FLASH_MKFS:
|
||||||
|
q.add_log_cmd(Info.FLASH_MKFS)
|
||||||
|
while True:
|
||||||
|
flash_select = int(input("Please select the flash ID (0 or 1): "))
|
||||||
|
if flash_select != 0 and flash_select != 1:
|
||||||
|
_LOGGER.warn("invalid flash select")
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
q.add_pus_tc(
|
||||||
|
create_action_cmd(
|
||||||
|
PLOC_MPSOC_ID, ActionId.TC_FLASH_MKFS, bytes([flash_select])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if cmd_str == OpCode.SPLIT_FILE:
|
||||||
|
q.add_log_cmd(Info.SPLIT_FILE)
|
||||||
|
q.add_pus_tc(
|
||||||
|
create_action_cmd(
|
||||||
|
PLOC_MPSOC_ID,
|
||||||
|
ActionId.TC_SPLIT_FILE,
|
||||||
|
user_data=prepare_simplex_store_file_user_data(),
|
||||||
|
)
|
||||||
|
)
|
||||||
if cmd_str == "17":
|
if cmd_str == "17":
|
||||||
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
||||||
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
|
||||||
@@ -285,8 +331,12 @@ def pack_ploc_mpsoc_commands(
|
|||||||
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 == OpCode.SIMPLEX_STREAM_FILE:
|
if cmd_str == OpCode.SIMPLEX_STREAM_FILE:
|
||||||
q.add_log_cmd(Info.SIMPLEX_STREAM_FILE)
|
q.add_log_cmd(Info.SIMPLEX_STREAM_FILE)
|
||||||
data = prepare_simplex_stream_file_cmd(object_id.as_bytes)
|
data = prepare_simplex_stream_file_user_data()
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(
|
||||||
|
create_action_cmd(
|
||||||
|
PLOC_MPSOC_ID, ActionId.TC_SIMPLEX_STREAM_FILE, user_data=data
|
||||||
|
)
|
||||||
|
)
|
||||||
if cmd_str == OpCode.DOWNLINK_DATA_MODULATE:
|
if cmd_str == OpCode.DOWNLINK_DATA_MODULATE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
||||||
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
||||||
@@ -444,10 +494,10 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
|||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytes:
|
||||||
selection = input("Use default parameter? (Y/N): ")
|
filename = input("Specify target filename: ")
|
||||||
|
selection = input("Use default parameter? (y/n): ")
|
||||||
if selection.lower() in ["y", "1", "yes"]:
|
if selection.lower() in ["y", "1", "yes"]:
|
||||||
filename = "0:/test"
|
|
||||||
encoder_setting_y = 7
|
encoder_setting_y = 7
|
||||||
quantization_y = 0
|
quantization_y = 0
|
||||||
encoder_setting_cb = 7
|
encoder_setting_cb = 7
|
||||||
@@ -456,7 +506,6 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
|||||||
quantization_cr = 0
|
quantization_cr = 0
|
||||||
bypass_compressor = 0
|
bypass_compressor = 0
|
||||||
else:
|
else:
|
||||||
filename = input("Specify filename: ")
|
|
||||||
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
|
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
|
||||||
quantization_y = int(input("Specify quantization_Y: "))
|
quantization_y = int(input("Specify quantization_Y: "))
|
||||||
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
|
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
|
||||||
@@ -467,7 +516,7 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
|||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
|
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
|
||||||
+ bytearray(filename, "utf-8")
|
+ filename.encode()
|
||||||
+ bytes([0])
|
+ bytes([0])
|
||||||
+ struct.pack("!B", encoder_setting_y)
|
+ struct.pack("!B", encoder_setting_y)
|
||||||
+ struct.pack("!Q", quantization_y)
|
+ struct.pack("!Q", quantization_y)
|
||||||
@@ -477,30 +526,21 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
|||||||
+ struct.pack("!Q", quantization_cr)
|
+ struct.pack("!Q", quantization_cr)
|
||||||
+ struct.pack("!B", bypass_compressor)
|
+ struct.pack("!B", bypass_compressor)
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_simplex_stream_file_cmd(object_id: bytes) -> bytes:
|
|
||||||
filename = input("Specify filename: ")
|
|
||||||
command = (
|
|
||||||
object_id
|
|
||||||
+ struct.pack("!I", ActionId.TC_SIMPLEX_STREAM_FILE)
|
|
||||||
+ bytearray(filename, "utf-8")
|
|
||||||
+ bytes([0])
|
|
||||||
)
|
|
||||||
return command
|
return command
|
||||||
|
|
||||||
|
|
||||||
def prepare_simplex_store_file_cmd(object_id: bytes) -> bytes:
|
def prepare_simplex_stream_file_user_data() -> bytes:
|
||||||
|
filename = input("Specify filename: ")
|
||||||
|
command = filename.encode() + bytes([0])
|
||||||
|
return command
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_simplex_store_file_user_data() -> bytes:
|
||||||
num_of_chunks = int(input("Please specify the number of chunks: "))
|
num_of_chunks = int(input("Please specify the number of chunks: "))
|
||||||
assert num_of_chunks >= 0
|
assert num_of_chunks >= 0
|
||||||
filename = input("Specify filename: ")
|
filename = input("Specify filename: ")
|
||||||
command = (
|
command = (
|
||||||
object_id
|
struct.pack("!I", num_of_chunks) + bytearray(filename, "utf-8") + bytes([0])
|
||||||
+ struct.pack("!I", ActionId.TC_SIMPLEX_STORE_FILE)
|
|
||||||
+ struct.pack("!I", num_of_chunks)
|
|
||||||
+ bytearray(filename, "utf-8")
|
|
||||||
+ bytes([0])
|
|
||||||
)
|
)
|
||||||
return command
|
return command
|
||||||
|
|
||||||
@@ -705,11 +745,13 @@ def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytea
|
|||||||
"PLOC MPSoC flash directory data shorter than minimum 16 bytes"
|
"PLOC MPSoC flash directory data shorter than minimum 16 bytes"
|
||||||
)
|
)
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
dir_name_short = custom_data[current_idx : current_idx + 12].decode("utf-8")
|
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
|
||||||
|
dir_name_short = custom_data[current_idx : current_idx + end_of_str].decode()
|
||||||
current_idx += 12
|
current_idx += 12
|
||||||
num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[
|
num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
|
current_idx += 4
|
||||||
elem_names = []
|
elem_names = []
|
||||||
elem_attrs = []
|
elem_attrs = []
|
||||||
elem_sizes = []
|
elem_sizes = []
|
||||||
@@ -725,9 +767,7 @@ def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytea
|
|||||||
# It is as weird as it looks..
|
# It is as weird as it looks..
|
||||||
for _ in range(num_elements):
|
for _ in range(num_elements):
|
||||||
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
|
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
|
||||||
elem_name = custom_data[current_idx : current_idx + end_of_str].decode(
|
elem_name = custom_data[current_idx : current_idx + end_of_str].decode()
|
||||||
"utf-8"
|
|
||||||
)
|
|
||||||
current_idx += 12
|
current_idx += 12
|
||||||
elem_names.append(elem_name)
|
elem_names.append(elem_name)
|
||||||
for _ in range(num_elements):
|
for _ in range(num_elements):
|
||||||
|
@@ -112,7 +112,7 @@ class SupvActionId(enum.IntEnum):
|
|||||||
REQUEST_ADC_REPORT = 57
|
REQUEST_ADC_REPORT = 57
|
||||||
RESET_PL = 58
|
RESET_PL = 58
|
||||||
ENABLE_NVMS = 59
|
ENABLE_NVMS = 59
|
||||||
CONTINUE_UPDATE = 60
|
RESUME_UPDATE = 60
|
||||||
MEM_CHECK = 61
|
MEM_CHECK = 61
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ class OpCode:
|
|||||||
SET_TIME_REF = "set_time_ref"
|
SET_TIME_REF = "set_time_ref"
|
||||||
FACTORY_FLASH = "factory_flash"
|
FACTORY_FLASH = "factory_flash"
|
||||||
START_UPDATE = "start_update"
|
START_UPDATE = "start_update"
|
||||||
PERFORM_UPDATE = "update"
|
RESUME_UPDATE = "resum_update"
|
||||||
FACTORY_RESET = "factory_reset"
|
FACTORY_RESET = "factory_reset"
|
||||||
MEM_CHECK = "mem_check"
|
MEM_CHECK = "mem_check"
|
||||||
RESET_MPSOC = "reset_mpsoc"
|
RESET_MPSOC = "reset_mpsoc"
|
||||||
@@ -156,7 +156,7 @@ class Info(str, enum.Enum):
|
|||||||
SHUTDOWN_MPSOC = "Shutdown MPSoC"
|
SHUTDOWN_MPSOC = "Shutdown MPSoC"
|
||||||
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"
|
RESUME_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
||||||
START_UPDATE = "Start new MPSoC SW update"
|
START_UPDATE = "Start new MPSoC SW update"
|
||||||
FACTORY_RESET = "Factory Reset of loggers"
|
FACTORY_RESET = "Factory Reset of loggers"
|
||||||
MEM_CHECK = "Memory Check"
|
MEM_CHECK = "Memory Check"
|
||||||
@@ -331,7 +331,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
|
|||||||
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
||||||
command = pack_update_command(object_id.as_bytes, True)
|
command = pack_update_command(object_id.as_bytes, True)
|
||||||
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.PERFORM_UPDATE:
|
if cmd_str in OpCode.RESUME_UPDATE:
|
||||||
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
||||||
command = pack_update_command(object_id.as_bytes, False)
|
command = pack_update_command(object_id.as_bytes, False)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||||
@@ -370,7 +370,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))
|
||||||
if cmd_str == "58":
|
if cmd_str == "58":
|
||||||
q.add_log_cmd("PLOC Supervisor: Continue update")
|
q.add_log_cmd("PLOC Supervisor: Continue update")
|
||||||
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
|
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESUME_UPDATE)
|
||||||
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.MEM_CHECK:
|
if cmd_str == OpCode.MEM_CHECK:
|
||||||
custom_data = bytearray()
|
custom_data = bytearray()
|
||||||
@@ -650,8 +650,10 @@ def get_event_buffer_path() -> str:
|
|||||||
class SocState(enum.IntEnum):
|
class SocState(enum.IntEnum):
|
||||||
OFF = 0
|
OFF = 0
|
||||||
BOOTING = 1
|
BOOTING = 1
|
||||||
OPERATIONAL = 2
|
UPDATE = 2
|
||||||
SHUTDOWN = 3
|
OPERATIONAL = 3
|
||||||
|
RESET = 4
|
||||||
|
FAULTY = 5
|
||||||
|
|
||||||
|
|
||||||
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):
|
||||||
@@ -691,7 +693,10 @@ def handle_hk_report(hk_data: bytes, pw: PrintWrapper):
|
|||||||
pw.dlog(f"Temp PS {temp_ps} C | Temp PL {temp_pl} C | Temp SUP {temp_sup} C")
|
pw.dlog(f"Temp PS {temp_ps} C | Temp PL {temp_pl} C | Temp SUP {temp_sup} C")
|
||||||
pw.dlog(f"Uptime {uptime} | CPU Load {cpu_load} | Avail Heap {avail_heap}")
|
pw.dlog(f"Uptime {uptime} | CPU Load {cpu_load} | Avail Heap {avail_heap}")
|
||||||
pw.dlog(f"Number TCs {num_tcs} | Number TMs {num_tms}")
|
pw.dlog(f"Number TCs {num_tcs} | Number TMs {num_tms}")
|
||||||
pw.dlog(f"SOC state {SocState(soc_state)}")
|
try:
|
||||||
|
pw.dlog(f"SOC state {SocState(soc_state)}")
|
||||||
|
except ValueError:
|
||||||
|
pw.dlog(f"Invalid SOC state {soc_state}")
|
||||||
pw.dlog(f"NVM 01 State {nvm_0_1_state}")
|
pw.dlog(f"NVM 01 State {nvm_0_1_state}")
|
||||||
pw.dlog(f"NVM 3 State {nvm_3_state}")
|
pw.dlog(f"NVM 3 State {nvm_3_state}")
|
||||||
pw.dlog(f"Mission IO state {mission_io_state}")
|
pw.dlog(f"Mission IO state {mission_io_state}")
|
||||||
|
@@ -29,10 +29,10 @@ classifiers = [
|
|||||||
"Topic :: Scientific/Engineering"
|
"Topic :: Scientific/Engineering"
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tmtccmd ~= 8.0.0rc1",
|
"tmtccmd == 8.0.0rc1",
|
||||||
"cfdp-py~=0.1.0",
|
"cfdp-py~=0.1.0",
|
||||||
# "tmtccmd @ git+https://github.com/robamu-org/tmtccmd@main",
|
# "tmtccmd @ git+https://github.com/robamu-org/tmtccmd@main",
|
||||||
"python-dateutil ~= 2.8",
|
"python-dateutil ~= 2.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
14
scripts/raw-analysis.py
Executable file
14
scripts/raw-analysis.py
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from base64 import b64decode
|
||||||
|
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||||
|
from spacepackets.ecss.tm import PusTelemetry
|
||||||
|
from spacepackets.ecss.pus_1_verification import Service1Tm, UnpackParams
|
||||||
|
|
||||||
|
bruh = "CGX6cQAdIAEIOzcAAEBedwUTOzkYZe5WAAEAAAAAAAAAAF4z"
|
||||||
|
data = b64decode(bruh)
|
||||||
|
tm = PusTelemetry.unpack(data, CdsShortTimestamp.empty())
|
||||||
|
srv1_tm = Service1Tm.from_tm(
|
||||||
|
tm, UnpackParams(time_reader=CdsShortTimestamp.empty(), bytes_err_code=2)
|
||||||
|
)
|
||||||
|
print(f"service {tm.service} subservice {tm.subservice}")
|
||||||
|
print(f"error code: {srv1_tm.error_code}")
|
Reference in New Issue
Block a user