update supv cmds
This commit is contained in:
parent
77a4f49305
commit
8dfe9e63fb
@ -6,11 +6,13 @@
|
||||
@author J. Meier
|
||||
@date 10.07.2021
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from config.object_ids import PLOC_SUPV_ID, get_object_ids
|
||||
from config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.config import TmtcDefinitionWrapper
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider, OpCodeEntry
|
||||
from tmtccmd.logging import get_console_logger
|
||||
@ -105,6 +107,10 @@ class SupvActionIds:
|
||||
CONTINUE_UPDATE = 60
|
||||
|
||||
|
||||
class SetIds:
|
||||
HK_REPORT = 102
|
||||
|
||||
|
||||
class SupvHkIds:
|
||||
HK_REPORT = 52
|
||||
BOOT_STATUS_REPORT = 53
|
||||
@ -114,9 +120,19 @@ class OpCodes:
|
||||
OFF = ["0", "off"]
|
||||
ON = ["1", "on"]
|
||||
NORMAL = ["2", "nml"]
|
||||
HK_REPORT = ["3", "hk"]
|
||||
START_MPSOC = ["4", "mpsoc-start"]
|
||||
STOP_MPSOC = ["5", "mpsoc-stop"]
|
||||
HK_TO_OBC = ["3", "hk-to-obc"]
|
||||
REQUEST_HK = ["4", "req-hk"]
|
||||
START_MPSOC = ["5", "mpsoc-start"]
|
||||
STOP_MPSOC = ["6", "mpsoc-stop"]
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
value: str
|
||||
OFF = "Switch Off"
|
||||
ON = "Switch On"
|
||||
NML = "Switch Normal"
|
||||
HK_TO_OBC = "Request HK from PLOC SUPV"
|
||||
REQUEST_HK = "Request HK set from PLOC Handler"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
@ -127,10 +143,11 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
CustomServiceList.PLOC_MEMORY_DUMPER.value, "PLOC Memory Dumper", oce
|
||||
)
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCodes.OFF, "Mode Off")
|
||||
oce.add(OpCodes.ON, "Mode On")
|
||||
oce.add(OpCodes.NORMAL, "Mode Normal")
|
||||
oce.add(OpCodes.HK_REPORT, "HK Report")
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.ON, Info.ON)
|
||||
oce.add(OpCodes.NORMAL, Info.NML)
|
||||
oce.add(OpCodes.HK_TO_OBC, Info.HK_TO_OBC)
|
||||
oce.add(OpCodes.REQUEST_HK, Info.REQUEST_HK)
|
||||
oce.add(OpCodes.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
||||
oce.add(OpCodes.STOP_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
||||
oce.add("7", "PLOC Supervisor: Select MPSoC boot image")
|
||||
@ -181,22 +198,28 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
||||
q.add_log_cmd(f"Testing PLOC Supervisor with object id: {object_id.as_hex_string}")
|
||||
obyt = object_id.as_bytes
|
||||
prefix = "PLOC Supervisor"
|
||||
if op_code in OpCodes.OFF:
|
||||
q.add_log_cmd("PLOC Supervisor: Set mode off")
|
||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.ON:
|
||||
q.add_log_cmd("PLOC Supervisor: Set mode on")
|
||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.NORMAL:
|
||||
q.add_log_cmd("PLOC Supervisor: Mode Normal")
|
||||
q.add_log_cmd(f"{prefix}: {Info.NML}")
|
||||
command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code in OpCodes.HK_REPORT:
|
||||
q.add_log_cmd("PLOC Supervisor: TC Get Hk Report")
|
||||
if op_code in OpCodes.HK_TO_OBC:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.HK_REPORT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.REQUEST_HK:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}")
|
||||
sid = make_sid(object_id.as_bytes, SetIds.HK_REPORT)
|
||||
cmd = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(cmd)
|
||||
elif op_code == "5":
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC)
|
||||
|
Loading…
Reference in New Issue
Block a user