Merge branch 'main' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc
This commit is contained in:
commit
15fbfd0f95
26
CHANGELOG.md
26
CHANGELOG.md
@ -8,11 +8,29 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
||||
The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)
|
||||
list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
# [v2.3.0] 18.01.2023
|
||||
|
||||
- Handle ACS CTRL HK sets
|
||||
- Add reboot commands for PCDU modules
|
||||
- Extend MPSoC commands
|
||||
- Bumped `tmtccmd` version to new alpha release, use some new features
|
||||
and fix the breaking changes
|
||||
|
||||
# [v2.2.0] 16.01.2023
|
||||
|
||||
- A lot of consistency renaming: Single name for enums which are not flag enums,
|
||||
e.g `ActionId` instead of `ActionIds`
|
||||
- Updated required Python version to 3.10
|
||||
|
||||
# [v2.1.1] 12.01.2023
|
||||
|
||||
- Typo in `setup.cfg`, missing version prefix `v` for `tmtccmd`
|
||||
|
||||
# [v2.1.0] 12.01.2023
|
||||
|
||||
- Various refactoring and tweaks to allow easier integration into `eive-mib`.
|
||||
- Handle ACS CTRL HK sets.
|
||||
- Add reboot commands for PCDU modules.
|
||||
- Extend MPSoC commands.
|
||||
- Starting from now, more regular releases, especially on breaking changes. This is because
|
||||
this is now also a library with dependents.
|
||||
|
||||
# [v2.0.2] 01.12.2022
|
||||
|
||||
|
@ -2,10 +2,10 @@ from pathlib import Path
|
||||
|
||||
SW_NAME = "eive-tmtc"
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 0
|
||||
VERSION_REVISION = 2
|
||||
VERSION_MINOR = 2
|
||||
VERSION_REVISION = 0
|
||||
|
||||
__version__ = "2.0.2"
|
||||
__version__ = "2.2.0"
|
||||
|
||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||
PACKAGE_ROOT = EIVE_TMTC_ROOT.parent
|
||||
|
@ -1,33 +0,0 @@
|
||||
"""
|
||||
@brief This file transfers definitions of global variables to the user.
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
import argparse
|
||||
|
||||
|
||||
# All globals can be added here and will be part of a globals dictionary.
|
||||
from config.definitions import CustomServiceList, PUS_APID
|
||||
from config.custom_mode_op import CustomModeList
|
||||
from tmtccmd.config.definitions import CoreComInterfaces
|
||||
from tmtccmd.config.globals import set_default_globals_pre_args_parsing
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class CustomGlobalIds(enum.Enum):
|
||||
from enum import auto
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def set_globals_pre_args_parsing(gui: bool = False):
|
||||
set_default_globals_pre_args_parsing(
|
||||
gui=gui,
|
||||
tc_apid=PUS_APID,
|
||||
tm_apid=PUS_APID,
|
||||
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
|
||||
)
|
@ -12,11 +12,11 @@ from typing import Union
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.util import ObjectIdU32, ObjectIdBase
|
||||
|
||||
|
||||
class GomspaceDeviceActionIds(enum.IntEnum):
|
||||
class GomspaceDeviceActionId(enum.IntEnum):
|
||||
PING = 1
|
||||
REBOOT = 4
|
||||
PARAM_GET = 0
|
||||
@ -63,8 +63,8 @@ class Channel:
|
||||
|
||||
|
||||
def pack_request_config_command(object_id: bytes) -> PusTelecommand:
|
||||
return create_fsfw_action_cmd(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionId.REQUEST_CONFIG_TABLE
|
||||
)
|
||||
|
||||
|
||||
@ -88,9 +88,9 @@ def pack_get_param_command(
|
||||
else:
|
||||
app_data += memory_address
|
||||
app_data += struct.pack("!B", parameter_size)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id,
|
||||
action_id=GomspaceDeviceActionIds.PARAM_GET,
|
||||
action_id=GomspaceDeviceActionId.PARAM_GET,
|
||||
user_data=app_data,
|
||||
)
|
||||
|
||||
@ -98,12 +98,12 @@ def pack_get_param_command(
|
||||
def pack_set_float_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: float
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!f", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -111,12 +111,12 @@ def pack_set_float_param_command(
|
||||
def pack_set_u8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data.append(parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -124,12 +124,12 @@ def pack_set_u8_param_command(
|
||||
def pack_set_i8_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(1)
|
||||
app_data += struct.pack("!b", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -137,12 +137,12 @@ def pack_set_i8_param_command(
|
||||
def pack_set_u16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!H", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -150,34 +150,34 @@ def pack_set_u16_param_command(
|
||||
def pack_set_i16_param_command(
|
||||
object_id: bytes, memory_address: bytes, parameter: int
|
||||
) -> PusTelecommand:
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(2)
|
||||
app_data += struct.pack("!h", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_u32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!I", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
|
||||
def pack_set_i32_param_command(object_id: bytes, memory_address: bytes, parameter: int):
|
||||
action_id = GomspaceDeviceActionIds.PARAM_SET
|
||||
action_id = GomspaceDeviceActionId.PARAM_SET
|
||||
app_data = bytearray()
|
||||
app_data += memory_address
|
||||
app_data.append(4)
|
||||
app_data += struct.pack("!i", parameter)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -224,9 +224,9 @@ def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand
|
||||
@note The ping request sends the specified data to a gompsace device. These
|
||||
data are simply copied by the device and then sent back.
|
||||
"""
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes,
|
||||
action_id=GomspaceDeviceActionIds.PING,
|
||||
action_id=GomspaceDeviceActionId.PING,
|
||||
user_data=data,
|
||||
)
|
||||
|
||||
@ -235,8 +235,8 @@ def pack_gnd_wdt_reset_command(object_id: ObjectIdBase) -> PusTelecommand:
|
||||
""" " Function to generate the command to reset the watchdog of a gomspace device.
|
||||
@param object_id Object Id of the gomspace device handler.
|
||||
"""
|
||||
return create_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.WDT_RESET
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.WDT_RESET
|
||||
)
|
||||
|
||||
|
||||
@ -244,8 +244,8 @@ def pack_reboot_command(object_id: ObjectIdU32) -> PusTelecommand:
|
||||
"""Function to generate the command which triggers a reboot of a gomspace device
|
||||
@param object_id The object id of the gomspace device handler.
|
||||
"""
|
||||
return create_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REBOOT
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.REBOOT
|
||||
)
|
||||
|
||||
|
||||
@ -254,6 +254,6 @@ def pack_request_full_hk_table_command(object_id: ObjectIdU32) -> PusTelecommand
|
||||
device.
|
||||
@param object_id The object id of the gomspace device handler.
|
||||
"""
|
||||
return create_fsfw_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REQUEST_HK_TABLE
|
||||
return create_action_cmd(
|
||||
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionId.REQUEST_HK_TABLE
|
||||
)
|
||||
|
@ -121,11 +121,11 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_time_cmds(defs: TmtcDefinitionWrapper):
|
||||
from eive_tmtc.pus_tc.system.time import OpCodes, Info
|
||||
from eive_tmtc.pus_tc.system.time import OpCode, Info
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=OpCodes.SET_CURRENT_TIME,
|
||||
keys=OpCode.SET_CURRENT_TIME,
|
||||
info=Info.SET_CURRENT_TIME,
|
||||
)
|
||||
defs.add_service(
|
||||
@ -141,11 +141,11 @@ def add_system_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
oce = OpCodeEntry()
|
||||
oce.add(
|
||||
keys=controllers.OpCodes.THERMAL_CONTROLLER,
|
||||
keys=controllers.OpCode.THERMAL_CONTROLLER,
|
||||
info=controllers.Info.THERMAL_CONTROLLER,
|
||||
)
|
||||
oce.add(
|
||||
keys=controllers.OpCodes.CORE_CONTROLLER,
|
||||
keys=controllers.OpCode.CORE_CONTROLLER,
|
||||
info=controllers.Info.CORE_CONTROLLER,
|
||||
)
|
||||
defs.add_service(
|
||||
|
@ -9,25 +9,25 @@ from tmtccmd.config.tmtc import (
|
||||
)
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_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
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Subservice as ModeSubservices
|
||||
|
||||
|
||||
class BpxSetIds:
|
||||
class BpxSetId:
|
||||
GET_HK_SET = 0
|
||||
GET_CFG_SET = 5
|
||||
|
||||
|
||||
class BpxActionIds:
|
||||
class BpxActionId:
|
||||
REBOOT = 2
|
||||
RESET_COUNTERS = 3
|
||||
SET_CFG = 4
|
||||
GET_CFG = 5
|
||||
|
||||
|
||||
class BpxOpCodes:
|
||||
class BpxOpCode:
|
||||
HK = ["0", "hk"]
|
||||
OFF = ["off"]
|
||||
ON = ["on"]
|
||||
@ -40,15 +40,15 @@ class BpxOpCodes:
|
||||
@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=BpxOpCode.ON, info="On command")
|
||||
oce.add(keys=BpxOpCode.OFF, info="Off command")
|
||||
oce.add(keys=BpxOpCode.HK, info="Request BPX HK")
|
||||
oce.add(keys=BpxOpCode.RST_BOOT_CNT, info="Reset Boot Count")
|
||||
oce.add(keys=BpxOpCode.REQUEST_CFG, info="Request Configuration Struct (Step 1)")
|
||||
oce.add(
|
||||
keys=BpxOpCodes.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
keys=BpxOpCode.REQUEST_CFG_HK, info="Request Configuration Struct HK (Step 2)"
|
||||
)
|
||||
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
|
||||
oce.add(keys=BpxOpCode.REBOOT, info="Reboot Command")
|
||||
defs.add_service(
|
||||
name=CustomServiceList.BPX_BATTERY.value,
|
||||
info="BPX Battery Handler",
|
||||
@ -60,13 +60,13 @@ def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper):
|
||||
def pack_bpx_commands(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in BpxOpCodes.HK:
|
||||
if op_code in BpxOpCode.HK:
|
||||
q.add_log_cmd("Requesting BPX battery HK set")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_HK_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCodes.OFF:
|
||||
if op_code in BpxOpCode.OFF:
|
||||
q.add_log_cmd("Off mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.OFF, 0)
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.OFF, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
@ -74,9 +74,9 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.ON:
|
||||
if op_code in BpxOpCode.ON:
|
||||
q.add_log_cmd("On mode")
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Modes.ON, 0)
|
||||
mode_cmd = pack_mode_data(BPX_HANDLER_ID, Mode.ON, 0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200,
|
||||
@ -84,28 +84,24 @@ def pack_bpx_commands(p: ServiceProviderParams):
|
||||
app_data=mode_cmd,
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.RST_BOOT_CNT:
|
||||
if op_code in BpxOpCode.RST_BOOT_CNT:
|
||||
q.add_log_cmd("Resetting reboot counters")
|
||||
q.add_pus_tc(
|
||||
create_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
|
||||
create_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionId.RESET_COUNTERS
|
||||
)
|
||||
)
|
||||
if op_code in BpxOpCodes.REQUEST_CFG:
|
||||
if op_code in BpxOpCode.REQUEST_CFG:
|
||||
q.add_log_cmd("Requesting configuration struct")
|
||||
q.add_pus_tc(
|
||||
create_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
|
||||
)
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.GET_CFG)
|
||||
)
|
||||
if op_code in BpxOpCodes.REQUEST_CFG_HK:
|
||||
if op_code in BpxOpCode.REQUEST_CFG_HK:
|
||||
q.add_log_cmd("Requesting configuration struct HK")
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET)
|
||||
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetId.GET_CFG_SET)
|
||||
q.add_pus_tc(generate_one_hk_command(sid=sid))
|
||||
if op_code in BpxOpCodes.REBOOT:
|
||||
if op_code in BpxOpCode.REBOOT:
|
||||
q.add_log_cmd("Rebooting BPX battery")
|
||||
q.add_pus_tc(
|
||||
create_fsfw_action_cmd(
|
||||
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.REBOOT
|
||||
)
|
||||
create_action_cmd(object_id=BPX_HANDLER_ID, action_id=BpxActionId.REBOOT)
|
||||
)
|
||||
|
@ -5,6 +5,7 @@
|
||||
@author J. Meier
|
||||
@date 20.11.2021
|
||||
"""
|
||||
import enum
|
||||
import struct
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
@ -12,7 +13,7 @@ from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class CommandIds:
|
||||
class CommandId(enum.IntEnum):
|
||||
# Configures input rate of syrlinks to 400 Khz (results in downlink rate of 200 kbps)
|
||||
SET_LOW_RATE = 0
|
||||
# Configures input rate of syrlinks to 2000 Khz (results in downlink rate of 1000 kbps)
|
||||
@ -39,42 +40,42 @@ def pack_ccsds_handler_test(
|
||||
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("CCSDS Handler: Set low rate")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_LOW_RATE)
|
||||
command = obyt + struct.pack("!I", CommandId.SET_LOW_RATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("CCSDS Handler: Set high rate")
|
||||
command = obyt + struct.pack("!I", CommandIds.SET_HIGH_RATE)
|
||||
command = obyt + struct.pack("!I", CommandId.SET_HIGH_RATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "2":
|
||||
q.add_log_cmd("CCSDS Handler: Enables the transmitter")
|
||||
command = obyt + struct.pack("!I", CommandIds.EN_TRANSMITTER)
|
||||
command = obyt + struct.pack("!I", CommandId.EN_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "3":
|
||||
q.add_log_cmd("CCSDS Handler: Disables the transmitter")
|
||||
command = obyt + struct.pack("!I", CommandIds.DIS_TRANSMITTER)
|
||||
command = obyt + struct.pack("!I", CommandId.DIS_TRANSMITTER)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "4":
|
||||
q.add_log_cmd("CCSDS Handler: Set arbitrary bitrate")
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = (
|
||||
obyt
|
||||
+ struct.pack("!I", CommandIds.ARBITRARY_BITRATE)
|
||||
+ struct.pack("!I", CommandId.ARBITRARY_BITRATE)
|
||||
+ struct.pack("!I", bitrate)
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "5":
|
||||
q.add_log_cmd("CCSDS Handler: Enable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", CommandIds.ENABLE_TX_CLK_MANIPULATOR)
|
||||
command = obyt + struct.pack("!I", CommandId.ENABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "6":
|
||||
q.add_log_cmd("CCSDS Handler: Disable tx clock manipulator")
|
||||
command = obyt + struct.pack("!I", CommandIds.DISABLE_TX_CLK_MANIPULATOR)
|
||||
command = obyt + struct.pack("!I", CommandId.DISABLE_TX_CLK_MANIPULATOR)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "7":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on rising edge of tx clock")
|
||||
command = obyt + struct.pack("!I", CommandIds.UPDATE_ON_RISING_EDGE)
|
||||
command = obyt + struct.pack("!I", CommandId.UPDATE_ON_RISING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "8":
|
||||
q.add_log_cmd("CCSDS Handler: Update tx data on falling edge of tx clock")
|
||||
command = obyt + struct.pack("!I", CommandIds.UPDATE_ON_FALLING_EDGE)
|
||||
command = obyt + struct.pack("!I", CommandId.UPDATE_ON_FALLING_EDGE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
@ -11,7 +11,7 @@ from tmtccmd.logging import get_console_logger
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
REQ_OS_HK = ["0", "hk-os"]
|
||||
RESET_GNSS = ["5", "reset"]
|
||||
|
||||
@ -21,15 +21,15 @@ class Info:
|
||||
RESET_GNSS = "Reset GNSS using reset pin"
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId:
|
||||
HK = 0
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
oce.add(keys=OpCode.RESET_GNSS, info=Info.RESET_GNSS)
|
||||
oce.add(keys=OpCode.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.GPS_CTRL.value,
|
||||
info="GPS/GNSS Controller",
|
||||
@ -38,11 +38,11 @@ def add_gps_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
|
||||
def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.RESET_GNSS:
|
||||
if op_code in OpCode.RESET_GNSS:
|
||||
# TODO: This needs to be re-implemented
|
||||
LOGGER.warning("Reset pin handling needs to be re-implemented")
|
||||
if op_code in OpCodes.REQ_OS_HK:
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"GMSS: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetIds.HK))
|
||||
generate_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.HK))
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
import enum
|
||||
|
||||
|
||||
class AdisGyroSetIds(enum.IntEnum):
|
||||
class AdisGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
CFG_HK = 1
|
||||
|
||||
|
||||
class L3gGyroSetIds(enum.IntEnum):
|
||||
class L3gGyroSetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
@ -11,16 +11,16 @@ from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util.obj_id import ObjectIdU32
|
||||
from tmtccmd.tc.pus_201_fsfw_health import (
|
||||
from tmtccmd.pus.s201_fsfw_health import (
|
||||
pack_set_health_cmd_data,
|
||||
FsfwHealth,
|
||||
Subservices,
|
||||
Subservice,
|
||||
)
|
||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
|
||||
|
||||
class SwitchNumbers:
|
||||
class SwitchNumber(enum.IntEnum):
|
||||
HEATER_0_OBC_BRD = 0
|
||||
HEATER_1_PLOC_PROC_BRD = 1
|
||||
HEATER_2_ACS_BRD = 2
|
||||
@ -32,7 +32,7 @@ class SwitchNumbers:
|
||||
NUMBER_OF_SWITCHES = 8
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
HEATER_CMD = ["0", "switch-cmd"]
|
||||
HEATER_EXT_CTRL = ["1", "set-ext-ctrl"]
|
||||
HEATER_FAULTY_CMD = ["2", "set-faulty"]
|
||||
@ -57,10 +57,10 @@ class ActionIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_heater_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.HEATER_CMD, info=Info.HEATER_CMD)
|
||||
oce.add(keys=OpCodes.HEATER_HEALTHY_CMD, info=Info.HEATER_HEALTHY_CMD)
|
||||
oce.add(keys=OpCodes.HEATER_EXT_CTRL, info=Info.HEATER_EXT_CTRL)
|
||||
oce.add(keys=OpCodes.HEATER_FAULTY_CMD, info=Info.HEATER_FAULTY_CMD)
|
||||
oce.add(keys=OpCode.HEATER_CMD, info=Info.HEATER_CMD)
|
||||
oce.add(keys=OpCode.HEATER_HEALTHY_CMD, info=Info.HEATER_HEALTHY_CMD)
|
||||
oce.add(keys=OpCode.HEATER_EXT_CTRL, info=Info.HEATER_EXT_CTRL)
|
||||
oce.add(keys=OpCode.HEATER_FAULTY_CMD, info=Info.HEATER_FAULTY_CMD)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.HEATER.value,
|
||||
info="Heater Device",
|
||||
@ -69,7 +69,7 @@ def add_heater_cmds(defs: TmtcDefinitionWrapper):
|
||||
|
||||
|
||||
def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelper):
|
||||
if op_code in OpCodes.HEATER_CMD:
|
||||
if op_code in OpCode.HEATER_CMD:
|
||||
q.add_log_cmd("Heater Switching")
|
||||
heater_number = prompt_heater()
|
||||
while True:
|
||||
@ -89,7 +89,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
debug_string = f"Switching heater {heater_number} {act_str}"
|
||||
q.add_log_cmd(debug_string)
|
||||
q.add_pus_tc(pack_switch_heater_command(object_id, heater_number, action))
|
||||
if op_code in OpCodes.HEATER_EXT_CTRL:
|
||||
if op_code in OpCode.HEATER_EXT_CTRL:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -99,7 +99,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
health_str="External Control",
|
||||
heater_idx=heater_number,
|
||||
)
|
||||
if op_code in OpCodes.HEATER_FAULTY_CMD:
|
||||
if op_code in OpCode.HEATER_FAULTY_CMD:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -109,7 +109,7 @@ def pack_heater_cmds(object_id: bytearray, op_code: str, q: DefaultPusQueueHelpe
|
||||
health_str="Faulty",
|
||||
heater_idx=heater_number,
|
||||
)
|
||||
if op_code in OpCodes.HEATER_HEALTHY_CMD:
|
||||
if op_code in OpCode.HEATER_HEALTHY_CMD:
|
||||
heater_number = prompt_heater()
|
||||
obj_id = heater_idx_to_obj(heater_number)
|
||||
health_cmd(
|
||||
@ -165,7 +165,7 @@ def prompt_heater() -> int:
|
||||
print("Heater number not a digit")
|
||||
continue
|
||||
heater_number = int(heater_number)
|
||||
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0:
|
||||
if heater_number >= SwitchNumber.NUMBER_OF_SWITCHES or heater_number < 0:
|
||||
print("Invalid heater switch number")
|
||||
continue
|
||||
break
|
||||
@ -183,7 +183,7 @@ def health_cmd(
|
||||
app_data = pack_set_health_cmd_data(object_id=object_id.as_bytes, health=health)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=201, subservice=Subservices.TC_SET_HEALTH, app_data=app_data
|
||||
service=201, subservice=Subservice.TC_SET_HEALTH, app_data=app_data
|
||||
)
|
||||
)
|
||||
|
||||
@ -200,6 +200,6 @@ def pack_switch_heater_command(
|
||||
command.append(switch_nr)
|
||||
command.append(switch_action)
|
||||
command.append(COMMAND_SOURCE_PARAM_EXTERNAL)
|
||||
return create_fsfw_action_cmd(
|
||||
return create_action_cmd(
|
||||
object_id=object_id, action_id=ActionIds.SWITCH_HEATER, user_data=command
|
||||
)
|
||||
|
@ -1,9 +1,9 @@
|
||||
import enum
|
||||
|
||||
|
||||
class MgmLis3SetIds(enum.IntEnum):
|
||||
class MgmLis3SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
||||
|
||||
class MgmRm3100SetIds(enum.IntEnum):
|
||||
class MgmRm3100SetId(enum.IntEnum):
|
||||
CORE_HK = 0
|
||||
|
@ -9,7 +9,7 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
|
||||
|
||||
class CommandIds:
|
||||
class CommandId:
|
||||
# prints the clcw to the console. Useful for debugging
|
||||
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
|
||||
# Print PDEC monitor register
|
||||
@ -22,9 +22,9 @@ def pack_pdec_handler_test(
|
||||
q.add_log_cmd(f"Testing PDEC handler with object id: {object_id.hex()}")
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("PDEC Handler: Print CLCW")
|
||||
command = object_id + CommandIds.PRINT_CLCW
|
||||
command = object_id + CommandId.PRINT_CLCW
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("PDEC Handler: Print PDEC monitor register")
|
||||
command = object_id + CommandIds.PRINT_PDEC_MON
|
||||
command = object_id + CommandId.PRINT_PDEC_MON
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
@ -18,7 +18,7 @@ from tmtccmd.tc.pus_11_tc_sched import (
|
||||
create_enable_tc_sched_cmd,
|
||||
create_time_tagged_cmd,
|
||||
)
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Mode, Subservice
|
||||
from tmtccmd.tc.pus_20_params import (
|
||||
pack_scalar_double_param_app_data,
|
||||
pack_fsfw_load_param_cmd,
|
||||
@ -31,7 +31,7 @@ from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
SWITCH_HPA_ON_PROC = ["0", "proc_hpa"]
|
||||
SWITCH_ON = ["2", "on"]
|
||||
SWITCH_OFF = ["3", "off"]
|
||||
@ -70,7 +70,7 @@ class Info:
|
||||
DISABLE_HK = "Disable HK"
|
||||
|
||||
|
||||
class SetIds(enum.IntEnum):
|
||||
class SetId(enum.IntEnum):
|
||||
ADC = 0
|
||||
|
||||
|
||||
@ -124,116 +124,116 @@ class ParamIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC)
|
||||
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCodes.NORMAL_SSR, info=Info.NORMAL_SSR)
|
||||
oce.add(keys=OpCodes.NORMAL_DRO, info=Info.NORMAL_DRO)
|
||||
oce.add(keys=OpCodes.NORMAL_X8, info=Info.NORMAL_X8)
|
||||
oce.add(keys=OpCodes.NORMAL_TX, info=Info.NORMAL_TX)
|
||||
oce.add(keys=OpCodes.NORMAL_MPA, info=Info.NORMAL_MPA)
|
||||
oce.add(keys=OpCodes.NORMAL_HPA, info=Info.NORMAL_HPA)
|
||||
oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK)
|
||||
oce.add(keys=OpCodes.ENABLE_HK, info=Info.ENABLE_HK)
|
||||
oce.add(keys=OpCode.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC)
|
||||
oce.add(keys=OpCode.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCode.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCode.NORMAL_SSR, info=Info.NORMAL_SSR)
|
||||
oce.add(keys=OpCode.NORMAL_DRO, info=Info.NORMAL_DRO)
|
||||
oce.add(keys=OpCode.NORMAL_X8, info=Info.NORMAL_X8)
|
||||
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_HPA, info=Info.NORMAL_HPA)
|
||||
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=OpCodes.INJECT_SSR_TO_DRO_FAILURE,
|
||||
keys=OpCode.INJECT_SSR_TO_DRO_FAILURE,
|
||||
info="Inject failure SSR to DRO transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_DRO_TO_X8_FAILURE,
|
||||
keys=OpCode.INJECT_DRO_TO_X8_FAILURE,
|
||||
info="Inject failure in DRO to X8 transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_X8_TO_TX_FAILURE,
|
||||
keys=OpCode.INJECT_X8_TO_TX_FAILURE,
|
||||
info="Inject failure in X8 to TX transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_TX_TO_MPA_FAILURE,
|
||||
keys=OpCode.INJECT_TX_TO_MPA_FAILURE,
|
||||
info="Inject failure in TX to MPA transition",
|
||||
)
|
||||
oce.add(
|
||||
keys=OpCodes.INJECT_MPA_TO_HPA_FAILURE,
|
||||
keys=OpCode.INJECT_MPA_TO_HPA_FAILURE,
|
||||
info="Inject failure in MPA to HPA transition",
|
||||
)
|
||||
oce.add(keys=OpCodes.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")
|
||||
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
|
||||
|
||||
|
||||
def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if op_code in OpCodes.SWITCH_ON:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Modes.ON, submode=0)
|
||||
if op_code in OpCodes.SWITCH_OFF:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_OFF, mode=Modes.OFF, submode=0)
|
||||
if op_code in OpCodes.ENABLE_HK:
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Mode.ON, submode=0)
|
||||
if op_code in OpCode.SWITCH_OFF:
|
||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_OFF, mode=Mode.OFF, submode=0)
|
||||
if op_code in OpCode.ENABLE_HK:
|
||||
interval = float(
|
||||
input("Please enter HK collection interval in floating point seconds: ")
|
||||
)
|
||||
cmds = enable_periodic_hk_command_with_interval(
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetIds.ADC), interval_seconds=interval
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetId.ADC), interval_seconds=interval
|
||||
)
|
||||
q.add_log_cmd(f"Enable PL PCDU HK with interval of {interval} seconds")
|
||||
for cmd in cmds:
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodes.DISABLE_HK:
|
||||
if op_code in OpCode.DISABLE_HK:
|
||||
cmd = disable_periodic_hk_command(
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetIds.ADC)
|
||||
diag=True, sid=make_sid(PL_PCDU_ID, SetId.ADC)
|
||||
)
|
||||
q.add_log_cmd("Disabling PL PCDU HK")
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code in OpCodes.NORMAL_SSR:
|
||||
if op_code in OpCode.NORMAL_SSR:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_SSR,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(
|
||||
NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_DRO:
|
||||
if op_code in OpCode.NORMAL_DRO:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_DRO,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_X8:
|
||||
if op_code in OpCode.NORMAL_X8:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_X8,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_TX:
|
||||
if op_code in OpCode.NORMAL_TX:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_TX,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_MPA:
|
||||
if op_code in OpCode.NORMAL_MPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_MPA,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
|
||||
)
|
||||
if op_code in OpCodes.NORMAL_HPA:
|
||||
if op_code in OpCode.NORMAL_HPA:
|
||||
pack_pl_pcdu_mode_cmd(
|
||||
q=q,
|
||||
info=Info.NORMAL_HPA,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
|
||||
)
|
||||
if op_code in OpCodes.REQ_OS_HK:
|
||||
if op_code in OpCode.REQ_OS_HK:
|
||||
q.add_log_cmd(f"PL PCDU: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_diag_command(
|
||||
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetIds.ADC)
|
||||
sid=make_sid(object_id=PL_PCDU_ID, set_id=SetId.ADC)
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.SWITCH_HPA_ON_PROC:
|
||||
if op_code in OpCode.SWITCH_HPA_ON_PROC:
|
||||
hpa_on_procedure(q)
|
||||
if op_code in OpCodes.INJECT_ALL_ON_FAILURE:
|
||||
if op_code in OpCode.INJECT_ALL_ON_FAILURE:
|
||||
pack_failure_injection_cmd(
|
||||
q=q,
|
||||
param_id=ParamIds.INJECT_ALL_ON_FAILURE,
|
||||
@ -251,15 +251,15 @@ def hpa_on_procedure(q: DefaultPusQueueHelper):
|
||||
)
|
||||
pl_pcdu_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(object_id=PL_PCDU_ID, mode=Modes.ON, submode=0),
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(object_id=PL_PCDU_ID, mode=Mode.ON, submode=0),
|
||||
)
|
||||
ssr_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(
|
||||
NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON
|
||||
),
|
||||
@ -267,46 +267,46 @@ def hpa_on_procedure(q: DefaultPusQueueHelper):
|
||||
)
|
||||
dro_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.DRO_ON),
|
||||
),
|
||||
)
|
||||
x8_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.X8_ON),
|
||||
),
|
||||
)
|
||||
tx_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.TX_ON),
|
||||
),
|
||||
)
|
||||
mpa_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.MPA_ON),
|
||||
),
|
||||
)
|
||||
hpa_on = PusTelecommand(
|
||||
service=200,
|
||||
subservice=Subservices.TC_MODE_COMMAND,
|
||||
subservice=Subservice.TC_MODE_COMMAND,
|
||||
app_data=pack_mode_data(
|
||||
object_id=PL_PCDU_ID,
|
||||
mode=Modes.NORMAL,
|
||||
mode=Mode.NORMAL,
|
||||
submode=submode_mask_to_submode(NormalSubmodesMask.HPA_ON),
|
||||
),
|
||||
)
|
||||
@ -439,12 +439,12 @@ def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_st
|
||||
|
||||
|
||||
def pack_pl_pcdu_mode_cmd(
|
||||
q: DefaultPusQueueHelper, info: str, mode: Modes, submode: int
|
||||
q: DefaultPusQueueHelper, info: str, mode: Mode, submode: int
|
||||
):
|
||||
q.add_log_cmd(info)
|
||||
mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=mode, submode=submode)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=mode_data
|
||||
)
|
||||
)
|
||||
|
@ -10,7 +10,7 @@ import struct
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data, Modes
|
||||
from eive_tmtc.pus_tc.service_200_mode import pack_mode_data, Mode
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
@ -18,11 +18,11 @@ from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class SetIds:
|
||||
class SetId:
|
||||
HK = 3
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
ON = ["0", "on"]
|
||||
NORMAL = ["1", "normal"]
|
||||
OFF = ["2", "off"]
|
||||
@ -40,7 +40,7 @@ class Info:
|
||||
DEBUG_OFF = "Switch debug output off"
|
||||
|
||||
|
||||
class CommandIds:
|
||||
class CommandId:
|
||||
START_CONVERSIONS = 2
|
||||
READ_CONVERSIONS = 3
|
||||
ENABLE_DEBUG_OUTPUT = 4
|
||||
@ -50,12 +50,12 @@ class CommandIds:
|
||||
@tmtc_definitions_provider
|
||||
def add_rad_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(info=Info.ON, keys=OpCodes.ON)
|
||||
oce.add(info=Info.OFF, keys=OpCodes.OFF)
|
||||
oce.add(info=Info.NORMAL, keys=OpCodes.NORMAL)
|
||||
oce.add(info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE)
|
||||
oce.add(info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON)
|
||||
oce.add(info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF)
|
||||
oce.add(info=Info.ON, keys=OpCode.ON)
|
||||
oce.add(info=Info.OFF, keys=OpCode.OFF)
|
||||
oce.add(info=Info.NORMAL, keys=OpCode.NORMAL)
|
||||
oce.add(info=Info.REQ_OS_HK, keys=OpCode.REQ_HK_ONCE)
|
||||
oce.add(info=Info.DEBUG_ON, keys=OpCode.DEBUG_ON)
|
||||
oce.add(info=Info.DEBUG_OFF, keys=OpCode.DEBUG_OFF)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RAD_SENSOR.value,
|
||||
info="Radiation Sensor",
|
||||
@ -68,31 +68,29 @@ def pack_rad_sensor_test_into(
|
||||
):
|
||||
q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
|
||||
|
||||
if op_code in OpCodes.ON:
|
||||
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, q)
|
||||
if op_code in OpCodes.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCodes.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, q)
|
||||
if op_code in OpCodes.REQ_HK_ONCE:
|
||||
if op_code in OpCode.ON:
|
||||
rad_sensor_mode_cmd(object_id, Mode.ON, Info.ON, q)
|
||||
if op_code in OpCode.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Mode.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCode.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Mode.OFF, Info.OFF, q)
|
||||
if op_code in OpCode.REQ_HK_ONCE:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetIds.HK))
|
||||
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetId.HK))
|
||||
)
|
||||
if op_code in OpCodes.DEBUG_ON:
|
||||
if op_code in OpCode.DEBUG_ON:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_ON}")
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandId.ENABLE_DEBUG_OUTPUT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.DEBUG_OFF:
|
||||
if op_code in OpCode.DEBUG_OFF:
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", CommandIds.DISABLE_DEBUG_OUTPUT
|
||||
)
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandId.DISABLE_DEBUG_OUTPUT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def rad_sensor_mode_cmd(
|
||||
object_id: ObjectIdU32, mode: Modes, info: str, q: DefaultPusQueueHelper
|
||||
object_id: ObjectIdU32, mode: Mode, info: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
q.add_log_cmd(f"Rad sensor: {info}")
|
||||
mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
|
||||
|
@ -1,14 +1,14 @@
|
||||
from typing import Optional
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from eive_tmtc.pus_tc.devs.pdec_handler import CommandIds
|
||||
from eive_tmtc.pus_tc.devs.pdec_handler import CommandId
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, pack_mode_data, Subservice
|
||||
import eive_tmtc.config.object_ids as oids
|
||||
from eive_tmtc.config.object_ids import get_object_ids
|
||||
|
||||
@ -32,7 +32,7 @@ RTD_IDS = [
|
||||
]
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
ON = ["0", "on"]
|
||||
OFF = ["1", "off"]
|
||||
NORMAL = ["2", "normal"]
|
||||
@ -49,9 +49,9 @@ class Info:
|
||||
@tmtc_definitions_provider
|
||||
def specify_rtd_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.ON, info=Info.ON)
|
||||
oce.add(keys=OpCodes.NORMAL, info=Info.NORMAL)
|
||||
oce.add(keys=OpCodes.OFF, info=Info.OFF)
|
||||
oce.add(keys=OpCode.ON, info=Info.ON)
|
||||
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
|
||||
oce.add(keys=OpCode.OFF, info=Info.OFF)
|
||||
defs.add_service(
|
||||
name=CustomServiceList.RTD.value, info="RTD commands", op_code_entry=oce
|
||||
)
|
||||
@ -67,35 +67,33 @@ def pack_rtd_commands(
|
||||
tgt_rtd_idx = prompt_rtd_idx()
|
||||
object_id_dict = get_object_ids()
|
||||
object_id = object_id_dict.get(RTD_IDS[tgt_rtd_idx])
|
||||
if op_code in OpCodes.ON:
|
||||
if op_code in OpCode.ON:
|
||||
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Mode.ON, submode=0)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCode.NORMAL:
|
||||
app_data = pack_mode_data(
|
||||
object_id=object_id.as_bytes, mode=Modes.ON, submode=0
|
||||
object_id=object_id.as_bytes, mode=Mode.NORMAL, submode=0
|
||||
)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.NORMAL:
|
||||
if op_code in OpCode.OFF:
|
||||
app_data = pack_mode_data(
|
||||
object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0
|
||||
object_id=object_id.as_bytes, mode=Mode.OFF, submode=0
|
||||
)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
|
||||
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.OFF:
|
||||
app_data = pack_mode_data(
|
||||
object_id=object_id.as_bytes, mode=Modes.OFF, submode=0
|
||||
)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
|
||||
)
|
||||
)
|
||||
if op_code in OpCodes.CONFIG_CMD:
|
||||
command = object_id.as_bytes + CommandIds.PRINT_CLCW
|
||||
if op_code in OpCode.CONFIG_CMD:
|
||||
command = object_id.as_bytes + CommandId.PRINT_CLCW
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
|
@ -5,10 +5,10 @@ from spacepackets.ecss import PusTelecommand
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import Mode, pack_mode_data, Subservice
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_fsfw_action_cmd
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||
from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
|
||||
@ -16,7 +16,7 @@ from eive_tmtc.config.object_ids import SCEX_HANDLER_ID
|
||||
USE_SCEX_CONF_FILE = True
|
||||
|
||||
|
||||
class OpCodes:
|
||||
class OpCode:
|
||||
PING = ["0", "ping"]
|
||||
ION_CMD = ["1", "ion"]
|
||||
TEMP_CMD = ["2", "temp"]
|
||||
@ -30,7 +30,7 @@ class OpCodes:
|
||||
SWITCH_OFF = ["8", "off"]
|
||||
|
||||
|
||||
class ActionIds(enum.IntEnum):
|
||||
class ActionId(enum.IntEnum):
|
||||
PING = 7
|
||||
ION_CMD = 4
|
||||
TEMP_CMD = 3
|
||||
@ -58,16 +58,16 @@ class Info:
|
||||
@tmtc_definitions_provider
|
||||
def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(keys=OpCodes.PING, info=Info.PING)
|
||||
oce.add(keys=OpCodes.ION_CMD, info=Info.ION_CMD)
|
||||
oce.add(keys=OpCodes.TEMP_CMD, info=Info.TEMP_CMD)
|
||||
oce.add(keys=OpCodes.EXP_STATUS_CMD, info=Info.EXP_STATUS_CMD)
|
||||
oce.add(keys=OpCodes.ONE_CELLS_CMD, info=Info.ONE_CELLS_CMD)
|
||||
oce.add(keys=OpCode.PING, info=Info.PING)
|
||||
oce.add(keys=OpCode.ION_CMD, info=Info.ION_CMD)
|
||||
oce.add(keys=OpCode.TEMP_CMD, info=Info.TEMP_CMD)
|
||||
oce.add(keys=OpCode.EXP_STATUS_CMD, info=Info.EXP_STATUS_CMD)
|
||||
oce.add(keys=OpCode.ONE_CELLS_CMD, info=Info.ONE_CELLS_CMD)
|
||||
|
||||
oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCodes.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
oce.add(keys=OpCode.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
|
||||
oce.add(keys=OpCode.FRAM, info=Info.FRAM)
|
||||
oce.add(keys=OpCode.SWITCH_ON, info=Info.SWITCH_ON)
|
||||
oce.add(keys=OpCode.SWITCH_OFF, info=Info.SWITCH_OFF)
|
||||
|
||||
defs.add_service(
|
||||
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
|
||||
@ -78,48 +78,46 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_scex_cmds(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
if op_code in OpCodes.SWITCH_ON:
|
||||
if op_code in OpCode.SWITCH_ON:
|
||||
q.add_log_cmd(Info.SWITCH_ON)
|