ACS CTRL Set Handling #120
@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="PLOC MPSoC" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<configuration default="false" name="PLOC MPSoC with Listener" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -d 6" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
@ -0,0 +1 @@
|
||||
recursive-include eive_tmtc/config *.csv
|
2
deps/tmtccmd
vendored
2
deps/tmtccmd
vendored
@ -1 +1 @@
|
||||
Subproject commit ddf3127e8ab184afb73b6835ac05c7c406d3a187
|
||||
Subproject commit a37ae33bf4417611ffcf6fad3f5b2802c84d6b0b
|
@ -1,5 +1,3 @@
|
||||
from eive_tmtc.pus_tc.devs.bpx_batt import BpxOpCodes
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
@ -121,23 +119,6 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
|
||||
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
|
||||
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
|
||||
oce.add(
|
||||
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
from eive_tmtc.pus_tc.system.time import OpCodes, Info
|
||||
|
@ -1,9 +1,18 @@
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.config.object_ids import BPX_HANDLER_ID
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservices as ModeSubservices
|
||||
|
||||
|
||||
class BpxSetIds:
|
||||
@ -20,12 +29,33 @@ class BpxActionIds:
|
||||
|
||||
class BpxOpCodes:
|
||||
HK = ["0", "hk"]
|
||||
OFF = ["off"]
|
||||
ON = ["on"]
|
||||
RST_BOOT_CNT = ["1", "rst_boot_cnt"]
|
||||
REQUEST_CFG = ["2", "cfg"]
|
||||
REQUEST_CFG_HK = ["3", "cfg_hk"]
|
||||
REBOOT = ["4", "reboot"]
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=BpxOpCodes.ON, info="On command")
|
||||
oce.add(keys=BpxOpCodes.OFF, info="Off command")
|
||||
oce.add(keys=BpxOpCodes.HK, info="Request BPX HK")
|
||||
oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count")
|
||||
oce.add(keys=BpxOpCodes.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
|
||||
oce.add(
|
||||
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
op_code_entry=oce,
|
||||
)
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.BPX_BATTERY.value)
|
||||
def pack_bpx_commands(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
@ -34,6 +64,26 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("Requesting BPX battery HK set")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCodes.OFF:
|
||||
q.add_log_cmd("Off mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.OFF, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=ModeSubservices.TC_MODE_COMMAND,
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.ON:
|
||||
q.add_log_cmd("On mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.ON, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
subservice=ModeSubservices.TC_MODE_COMMAND,
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.RST_BOOT_CNT:
|
||||
q.add_log_cmd("Resetting reboot counters")
|
||||
q.add_pus_tc(
|
||||
|
@ -64,6 +64,22 @@ class CommandIds(enum.IntEnum):
|
||||
RELEASE_UART_TX = 21
|
||||
|
||||
|
||||
class OpCodes:
|
||||
ON = ["on"]
|
||||
OFF = ["off"]
|
||||
NORMAL = ["normal"]
|
||||
VERIFY_BOOT = ["verify_boot"]
|
||||
MODE_REPLAY = ["mode_replay"]
|
||||
|
||||
|
||||
class Info:
|
||||
ON = "On"
|
||||
OFF = "Off"
|
||||
NORMAL = "Normal"
|
||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||
MODE_REPLAY = "Switch to REPLAY mode"
|
||||
|
||||
|
||||
class MemAddresses(enum.IntEnum):
|
||||
DEADBEEF = 0x40000004
|
||||
|
||||
@ -76,9 +92,9 @@ class PlocReplyIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "Ploc MPSoC: Set mode off")
|
||||
oce.add("1", "Ploc MPSoC: Set mode on")
|
||||
oce.add("2", "Ploc MPSoC: Set mode normal")
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.ON, Info.ON)
|
||||
oce.add(OpCodes.NORMAL, Info.NORMAL)
|
||||
oce.add("3", "Ploc MPSoC: Memory write")
|
||||
oce.add("4", "Ploc MPSoC: Memory read")
|
||||
oce.add("5", "Ploc MPSoC: Flash write")
|
||||
@ -89,9 +105,9 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
||||
oce.add("11", "Ploc MPSoC: Replay write sequence")
|
||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||
oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add("14", "Ploc MPSoC: Mode replay")
|
||||
oce.add("15", "Ploc MPSoC: Mode idle")
|
||||
oce.add(OpCodes.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add(OpCodes.MODE_REPLAY, Info.MODE_REPLAY)
|
||||
oce.add("15", "Ploc MPSoC: Mode IDLE")
|
||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
||||
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
||||
@ -102,21 +118,22 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||
q = p.queue_helper
|
||||
prefix = "PLOC SUPV:"
|
||||
op_code = p.op_code
|
||||
q.add_log_cmd(
|
||||
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode off")
|
||||
if op_code in OpCodes.OFF:
|
||||
q.add_log_cmd(f"{prefix} {Info.OFF}")
|
||||
command = pack_mode_data(obyt, Modes.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode on")
|
||||
if op_code in OpCodes.ON:
|
||||
q.add_log_cmd(f"{prefix} {Info.ON}")
|
||||
data = pack_mode_data(obyt, Modes.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "2":
|
||||
q.add_log_cmd("PLOC MPSoC: Mode Normal")
|
||||
if op_code in OpCodes.NORMAL:
|
||||
q.add_log_cmd(f"{prefix} {Info.NORMAL}")
|
||||
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "3":
|
||||
@ -167,9 +184,9 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "13":
|
||||
if op_code in OpCodes.VERIFY_BOOT:
|
||||
num_words = 1
|
||||
q.add_log_cmd("PLOC MPSoC: Read DEADBEEF address")
|
||||
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
||||
data = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", CommandIds.TC_MEM_READ)
|
||||
@ -282,7 +299,6 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
|
||||
|
||||
|
||||
def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
null_terminator = 0
|
||||
use_decoding = int(input("Use decoding (set to 1): "))
|
||||
file = get_sequence_file()
|
||||
command = (
|
||||
@ -290,6 +306,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
||||
+ struct.pack("!I", CommandIds.TC_REPLAY_WRITE_SEQUENCE)
|
||||
+ struct.pack("!B", use_decoding)
|
||||
+ bytearray(file, "utf-8")
|
||||
# + bytes([0])
|
||||
)
|
||||
return bytearray(command)
|
||||
|
||||
|
@ -28,10 +28,10 @@ from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class P60OpCodes:
|
||||
STACK_3V3_ON = ["stack-3v3-on", "1"]
|
||||
STACK_3V3_OFF = ["stack-3v3-off", "2"]
|
||||
STACK_5V_ON = ["stack-5v-on", "3"]
|
||||
STACK_5V_OFF = ["stack-5v-off", "4"]
|
||||
STACK_3V3_ON = ["stack_3v3_on", "1"]
|
||||
STACK_3V3_OFF = ["stack_3v3_off", "2"]
|
||||
STACK_5V_ON = ["stack_5v_on", "3"]
|
||||
STACK_5V_OFF = ["stack_5v_off", "4"]
|
||||
TEST = ["test", "0"]
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
tmtccmd >= 3.0.0rc2
|
||||
.
|
||||
|
Loading…
x
Reference in New Issue
Block a user