MPSoC Overhaul #296

Merged
muellerr merged 18 commits from mpsoc-overhaul into main 2024-05-06 14:18:04 +02:00
Showing only changes of commit 18860ec2c6 - Show all commits

View File

@ -11,14 +11,10 @@ import logging
import struct
import enum
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID
from eive_tmtc.pus_tm.defs import PrintWrapper
from tmtccmd.config.tmtc import (
CmdTreeNode,
tmtc_definitions_provider,
OpCodeEntry,
TmtcDefinitionWrapper,
)
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tmtc import DefaultPusQueueHelper
@ -109,8 +105,6 @@ class OpCode:
OFF = "off"
NORMAL = "normal"
VERIFY_BOOT = "verify_boot"
MODE_REPLAY_LEGACY = "mode_replay_legacy"
MODE_IDLE_LEGACY = "mode_idle_legacy"
REPLAY_WRITE_SEQ = "replay_write"
DOWNLINK_PWR_ON = "downlink_pwr_on"
MEM_WRITE = "memory_write"
@ -126,7 +120,6 @@ class OpCode:
CAM_TAKE_PIC = "cam_take_pic"
SIMPLEX_SEND_FILE = "simplex_send_file"
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
MODE_SNAPSHOT_LEGACY = "mode_snapshot_legacy"
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
MODE_IDLE = "mode_idle"
@ -271,14 +264,6 @@ def pack_ploc_mpsoc_commands(
+ struct.pack("!H", num_words)
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_REPLAY_LEGACY:
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_REPLAY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_IDLE_LEGACY:
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_IDLE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.CAM_CMD_SEND:
q.add_log_cmd(Info.CAM_CMD_SEND)
cam_cmd = input("Specify cam command string: ")
@ -308,10 +293,6 @@ def pack_ploc_mpsoc_commands(
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_SNAPSHOT_LEGACY:
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_SNAPSHOT:
q.add_log_cmd(Info.MODE_SNAPSHOT)
mode = prompt_mode_for_submode_change()
@ -346,10 +327,10 @@ def pack_ploc_mpsoc_commands(
def prompt_mode_for_submode_change() -> int:
while True:
mode = input("Please specify primary mode: [0: ON, 1: NORMAL]")
if mode == 0:
mode = input("Please specify primary mode [0: ON, 1: NORMAL]: ")
if mode == "0":
mode = Mode.ON
elif mode == 1:
elif mode == "1":
mode = Mode.NORMAL
else:
print("Invalid mode")