Compare commits

...

13 Commits

14 changed files with 215 additions and 118 deletions

View File

@@ -10,6 +10,21 @@ list yields a list of all related PRs for each release.
# [unreleased]
## Fixed
- Bugfix for CCSDS handler commanding: Pass correct object ID
## Added
- Added command to request switcher set from PCDU handler.
## Changed
- Move Star Tracker module to `tmtc` folder and add some set IDs. Rename `SetIds` to `SetId`.
- Move `syrlinks_hk_handler` and `ccsds_handler` module to `tmtc` module.
Rename `syrlinks_hk_handler` to `syrlinks_handler`.
- Move `star_tracker` module into `tmtc.acs`
# [v2.4.0] and [v2.4.1] 2023-01-23
- Pin `tmtccmd` to v4.0.0a2

View File

@@ -39,21 +39,6 @@ def add_pdec_cmds(defs: TmtcDefinitionWrapper):
defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce)
@tmtc_definitions_provider
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add("0", "CCSDS Handler: Set low rate")
oce.add("1", "CCSDS Handler: Set high rate")
oce.add("2", "CCSDS Handler: Enable transmitter")
oce.add("3", "CCSDS Handler: Disable transmitter")
oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
oce.add("7", "CCSDS Handler: Update tx data on rising edge")
oce.add("8", "CCSDS Handler: Update tx data on falling edge")
defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)
@tmtc_definitions_provider
def add_str_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()

View File

@@ -1,81 +0,0 @@
# -*- coding: utf-8 -*-
"""
@file ccsds_handler.py
@brief Test commanding of CCSDS Handler
@author J. Meier
@date 20.11.2021
"""
import enum
import struct
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.util import ObjectIdU32
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)
SET_HIGH_RATE = 1
# Enables the syrlinks transmitter (by using RS485 enables lines)
EN_TRANSMITTER = 2
# Disables the syrlinks transmitter (by using RS485 enables lines)
DIS_TRANSMITTER = 3
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
# required
ARBITRARY_BITRATE = 4
ENABLE_TX_CLK_MANIPULATOR = 5
DISABLE_TX_CLK_MANIPULATOR = 6
# Tx data will be updated on rising edge of tx clock
UPDATE_ON_RISING_EDGE = 7
# Tx data will be updated on falling edge of tx clock
UPDATE_ON_FALLING_EDGE = 8
def pack_ccsds_handler_test(
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
):
obyt = object_id.as_bytes
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", 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", 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", 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", 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", 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", 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", 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", 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", CommandId.UPDATE_ON_FALLING_EDGE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))

View File

@@ -36,10 +36,10 @@ from eive_tmtc.tmtc.acs.reaction_wheels import (
)
from eive_tmtc.pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
from eive_tmtc.pus_tc.devs.ccsds_handler import pack_ccsds_handler_test
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_test
from eive_tmtc.tmtc.core import pack_core_commands
from eive_tmtc.pus_tc.devs.star_tracker import pack_star_tracker_commands
from eive_tmtc.tmtc.syrlinks_hk_handler import pack_syrlinks_command
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
from eive_tmtc.pus_tc.devs.gps import pack_gps_command
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
from eive_tmtc.pus_tc.devs.plpcdu import pack_pl_pcdu_commands
@@ -166,8 +166,9 @@ def handle_default_procedure(
object_id=oids.GPS_CONTROLLER, q=queue_helper, op_code=op_code
)
if service == CustomServiceList.CCSDS_HANDLER.value:
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
return pack_ccsds_handler_test(
object_id=CCSDS_HANDLER_ID, q=queue_helper, op_code=op_code
object_id=object_id, q=queue_helper, op_code=op_code
)
if service == CustomServiceList.PDEC_HANDLER.value:
return pack_ccsds_handler_test(

View File

@@ -26,11 +26,11 @@ from eive_tmtc.pus_tc.devs.mgms import MgmLis3SetId as MgmLis3SetIds_0_2
from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetId as MgmRm3100SetIds_1_3
from eive_tmtc.pus_tc.devs.gyros import AdisGyroSetId as AdisGyroSetIds_0_2
from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetId as L3gGyroSetIds_1_3
from eive_tmtc.tmtc.syrlinks_hk_handler import SetId as SyrlinksSetIds
from eive_tmtc.tmtc.com.syrlinks_handler import SetId as SyrlinksSetIds
from eive_tmtc.pus_tc.devs.gps import SetId as GpsSetIds
from eive_tmtc.tmtc.acs.imtq import ImtqSetId
from eive_tmtc.pus_tc.devs.sus import SetId
from eive_tmtc.pus_tc.devs.star_tracker import SetIds as StrSetIds
from eive_tmtc.tmtc.acs.star_tracker import SetId as StrSetIds
from eive_tmtc.tmtc.acs.reaction_wheels import (
RwSetId,
rw_speed_up_cmd_consec,
@@ -43,7 +43,7 @@ from eive_tmtc.pus_tc.system.controllers import (
from eive_tmtc.tmtc.acs.acs_board import pack_acs_command
from eive_tmtc.tmtc.acs.sus_board import pack_sus_cmds
from eive_tmtc.tmtc.acs.imtq import pack_imtq_test_into, pack_dipole_command
from eive_tmtc.pus_tc.devs.star_tracker import pack_star_tracker_commands
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
from eive_tmtc.tmtc.acs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command

View File

@@ -4,7 +4,7 @@ from eive_tmtc.tmtc.acs.imtq import ImtqActionId
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.tmtc.payload.ploc_mpsoc import PlocReplyIds
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
from eive_tmtc.pus_tc.devs.star_tracker import StarTrackerActionId
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
from tmtccmd.logging import get_console_logger
from tmtccmd.tm import Service8FsfwTm

View File

@@ -6,7 +6,7 @@ from eive_tmtc.pus_tm.devs.rad_sensor import handle_rad_sensor_data
from eive_tmtc.pus_tm.devs.sus import handle_sus_hk
from eive_tmtc.tmtc.payload.ploc_supervisor import handle_supv_hk_data
from eive_tmtc.tmtc.acs.reaction_wheels import handle_rw_hk_data
from eive_tmtc.tmtc.syrlinks_hk_handler import handle_syrlinks_hk_data
from eive_tmtc.tmtc.com.syrlinks_handler import handle_syrlinks_hk_data
from eive_tmtc.tmtc.tcs import handle_thermal_controller_hk_data
from tmtccmd.tm.pus_3_fsfw_hk import (
Service3Base,

View File

@@ -90,8 +90,18 @@ class OpCodes:
NORMAL = ["2", "nml"]
class SetIds:
class SetId(enum.IntEnum):
VERSION = 2
INTERFACE = 3
POWER = 11
TEMPERATURE = 25
SOLUTION = 24
HISTOGRAM = 28
CHECKSUM = 50
CAMERA = 67
LIMITS = 68
CENTROIDING = 72
LISA = 73
class FileDefs:

View File

View File

@@ -0,0 +1,132 @@
# -*- coding: utf-8 -*-
"""
@file ccsds_handler.py
@brief Test commanding of CCSDS Handler
@author J. Meier
@date 20.11.2021
"""
import enum
import struct
from eive_tmtc.config.definitions import CustomServiceList
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config.tmtc import (
tmtc_definitions_provider,
OpCodeEntry,
TmtcDefinitionWrapper,
)
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command, Mode
from tmtccmd.util import ObjectIdU32
from eive_tmtc.config.object_ids import CCSDS_HANDLER_ID
class ActionId(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)
# SET_HIGH_RATE = 1
# Enables the syrlinks transmitter (by using RS485 enables lines). Please note that this
# is a legacy command. It is recommended to use mode commands instead
EN_TRANSMITTER = 2
# Disables the syrlinks transmitter (by using RS485 enables lines). Please note that this is
# a legacy command. It is recommended to use mode commands instead.
DIS_TRANSMITTER = 3
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
# required
ARBITRARY_BITRATE = 4
ENABLE_TX_CLK_MANIPULATOR = 5
DISABLE_TX_CLK_MANIPULATOR = 6
# Tx data will be updated on rising edge of tx clock
UPDATE_ON_RISING_EDGE = 7
# Tx data will be updated on falling edge of tx clock
UPDATE_ON_FALLING_EDGE = 8
class Submode(enum.IntEnum):
# Informative, do not command this.
UNSET = 0
DATARATE_LOW = 1
DATARATE_HIGH = 2
class OpCode:
ENABLE_WITH_LOW_DATARATE = ["enable_low_datarate"]
ENABLE_WITH_HIGH_DATARATE = ["enable_high_datarate"]
DISABLE = ["disable"]
ENABLE_ACTION = ["legacy_enable_tx"]
DISABLE_ACTION = ["legacy_disable_tx"]
class Info:
ENABLE_WITH_LOW_DATARATE = "Enable TX with low datarate"
ENABLE_WITH_HIGH_DATARATE = "Enable TX with high datarate"
DISABLE = "Disable TX"
ENABLE_ACTION = "Enable TX (legacy)"
DISABLE_ACTION = "Disable TX (legacy)"
def pack_ccsds_handler_test(
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
):
obyt = object_id.as_bytes
prefix = "CCSDS Handler"
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
if op_code in OpCode.ENABLE_WITH_LOW_DATARATE:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_LOW_DATARATE}")
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_LOW))
if op_code in OpCode.ENABLE_WITH_HIGH_DATARATE:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_WITH_HIGH_DATARATE}")
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_HIGH))
if op_code in OpCode.DISABLE:
q.add_log_cmd(f"{prefix}: {Info.DISABLE}")
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
if op_code in OpCode.ENABLE_ACTION:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_ACTION}")
command = obyt + struct.pack("!I", ActionId.EN_TRANSMITTER)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCode.DISABLE_ACTION:
q.add_log_cmd(f"{prefix}: {Info.DISABLE_ACTION}")
command = obyt + struct.pack("!I", ActionId.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", ActionId.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", ActionId.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", ActionId.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", ActionId.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", ActionId.UPDATE_ON_FALLING_EDGE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@tmtc_definitions_provider
def add_ccsds_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(OpCode.ENABLE_WITH_LOW_DATARATE, Info.ENABLE_WITH_LOW_DATARATE)
oce.add(OpCode.ENABLE_WITH_HIGH_DATARATE, Info.ENABLE_WITH_HIGH_DATARATE)
oce.add(OpCode.DISABLE, Info.DISABLE)
oce.add(OpCode.ENABLE_ACTION, Info.ENABLE_ACTION)
oce.add(OpCode.DISABLE_ACTION, Info.DISABLE_ACTION)
oce.add("4", "CCSDS Handler: Set arbitrary bitrate")
oce.add("5", "CCSDS Handler: Enable tx clock manipulator")
oce.add("6", "CCSDS Handler: Disable tx clock manipulator")
oce.add("7", "CCSDS Handler: Update tx data on rising edge")
oce.add("8", "CCSDS Handler: Update tx data on falling edge")
defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce)

View File

@@ -41,11 +41,13 @@ class OpCode:
ON = "on"
NORMAL = "nml"
STANDBY = "set_tx_standby"
SET_CW = "set_tx_carrier_wave"
MODULATION = "modulation"
SET_TX_CW = "set_tx_carrier_wave"
SET_TX_MODULATION = "set_tx_modulation"
HK_RX_REGS = "hk_rx_regs"
ENABLE_HK_RX_REGS = "enable_hk_rx"
DISABLE_HK_RX_REGS = "disable_hk_rx"
ENABLE_HK_TX_REGS = "enable_hk_tx"
DISABLE_HK_TX_REGS = "disable_hk_tx"
HK_TX_REGS = "hk_tx_regs"
TX_STATUS = "tx_status"
RX_STATUS = "rx_status"
@@ -56,7 +58,8 @@ class Info:
HK_TX_REGS = "Request TX register set"
ENABLE_HK_RX_REGS = "Enable periodic RX register HK"
DISABLE_HK_RX_REGS = "Disable periodic RX register HK"
EMABLE_HK_TX_REGS = "Enable periodic TX register HK"
ENABLE_HK_TX_REGS = "Enable periodic TX register HK"
DISABLE_HK_TX_REGS = "Disable periodic TX register HK"
TX_STATUS = "Read TX status (always read in normal mode)"
RX_STATUS = "Read RX status (always read in normal mode)"
SET_CW = "Set TX carrier wave"
@@ -87,14 +90,16 @@ def add_syrlinks_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCode.ON, "Syrlinks Handler: Set mode on")
oce.add(OpCode.NORMAL, "Syrlinks Handler: Set mode normal")
oce.add(OpCode.STANDBY, "Syrlinks Handler: Set TX standby")
oce.add(OpCode.MODULATION, "Syrlinks Handler: Set TX modulation")
oce.add(OpCode.SET_TX_MODULATION, "Syrlinks Handler: Set TX modulation")
oce.add(OpCode.HK_RX_REGS, Info.HK_RX_REGS)
oce.add(OpCode.HK_TX_REGS, Info.HK_TX_REGS)
oce.add(OpCode.SET_CW, Info.SET_CW)
oce.add(OpCode.SET_TX_CW, Info.SET_CW)
oce.add(OpCode.TX_STATUS, Info.TX_STATUS)
oce.add(OpCode.RX_STATUS, Info.RX_STATUS)
oce.add(OpCode.ENABLE_HK_RX_REGS, Info.ENABLE_HK_RX_REGS)
oce.add(OpCode.DISABLE_HK_RX_REGS, Info.DISABLE_HK_RX_REGS)
oce.add(OpCode.ENABLE_HK_TX_REGS, Info.ENABLE_HK_TX_REGS)
oce.add(OpCode.DISABLE_HK_TX_REGS, Info.DISABLE_HK_TX_REGS)
oce.add("7", "Syrlinks Handler: Read TX waveform")
oce.add("8", "Syrlinks Handler: Read TX AGC value high byte")
oce.add("9", "Syrlinks Handler: Read TX AGC value low byte")
@@ -130,11 +135,11 @@ def pack_syrlinks_command(
q.add_log_cmd(f"{prefix}: Set TX mode standby")
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_STANDBY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.MODULATION:
if op_code == OpCode.SET_TX_MODULATION:
q.add_log_cmd(f"{prefix}: Set TX mode modulation")
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_MODULATION)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code in OpCode.SET_CW:
if op_code in OpCode.SET_TX_CW:
q.add_log_cmd(f"{prefix}: {Info.SET_CW}")
data = obyt + struct.pack("!I", CommandId.SET_TX_MODE_CW)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@@ -145,13 +150,25 @@ def pack_syrlinks_command(
if op_code in OpCode.ENABLE_HK_RX_REGS:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}")
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
cmds = create_enable_periodic_hk_command_with_interval(True, sid, 2.0)
interval = float(input("HK interval in floating point seconds"))
cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code in OpCode.DISABLE_HK_RX_REGS:
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_RX_REGS}")
sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET)
q.add_pus_tc(create_disable_periodic_hk_command(True, sid))
if op_code in OpCode.ENABLE_HK_TX_REGS:
q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_TX_REGS}")
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
interval = float(input("HK interval in floating point seconds"))
cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval)
for cmd in cmds:
q.add_pus_tc(cmd)
if op_code in OpCode.DISABLE_HK_TX_REGS:
q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_TX_REGS}")
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)
q.add_pus_tc(create_disable_periodic_hk_command(True, sid))
if op_code in OpCode.HK_TX_REGS:
q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}")
sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET)

View File

@@ -53,6 +53,7 @@ class PowerInfo:
INFO_CORE = "Core Information"
INFO_AUX = "Auxiliary Information"
INFO_ALL = "All Information"
REQUEST_SWITCHER_SET = "Request Switcher Information"
ENABLE_INFO_HK = "Enable Core Info HK"
DISABLE_INFO_HK = "Disable Core Info HK"
RESET_ALL_GND_WDTS = "Reset all Ground Watchdogs"
@@ -101,6 +102,7 @@ class PowerOpCodes:
REBOOT = ["reboot"]
INFO_CORE = ["info"]
REQUEST_SWITCHER_SET = ["request_switchers"]
ENABLE_INFO_HK = ["info_hk_on"]
DISABLE_INFO_HK = ["info_hk_off"]
INFO_AUX = ["info_aux"]

View File

@@ -79,7 +79,7 @@ class PDU2TestProcedure:
def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
q.add_log_cmd("Testing PDU2")
objb = object_id.as_bytes
pdu2_cmds(q, op_code)
pdu2_switch_cmds(q, op_code)
pdu2_req_hk_cmds(q, op_code)
pack_common_power_cmds("PDU2", object_id, q, op_code)
pack_common_gomspace_cmds("PDU2", object_id, q, op_code)
@@ -159,7 +159,7 @@ def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
)
def pdu2_cmds(q: DefaultPusQueueHelper, op_code: str):
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
pl_pcdu_bat_nom_on_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:

View File

@@ -1,3 +1,5 @@
import enum
from eive_tmtc.tmtc.power.common_power import (
PowerOpCodes,
PowerInfo,
@@ -10,6 +12,7 @@ from eive_tmtc.config.object_ids import (
ACU_HANDLER_ID,
PDU_1_HANDLER_ID,
PDU_2_HANDLER_ID,
PCDU_HANDLER_ID,
get_object_ids,
)
from eive_tmtc.tmtc.power.pdu1 import (
@@ -21,7 +24,7 @@ from eive_tmtc.tmtc.power.pdu1 import (
from eive_tmtc.tmtc.power.pdu2 import (
pdu2_req_hk_cmds,
add_pdu2_common_defs,
pdu2_cmds,
pdu2_switch_cmds,
add_pdu2_cmds,
)
from tmtccmd import get_console_logger
@@ -29,6 +32,7 @@ from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from eive_tmtc.tmtc.power.p60dock import P60OpCode, P60Info, p60_dock_req_hk_cmds
from eive_tmtc.tmtc.power.acu import add_acu_cmds, acu_req_hk_cmds
from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_diag_command, make_sid
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper
@@ -36,9 +40,13 @@ from tmtccmd.tc import DefaultPusQueueHelper
LOGGER = get_console_logger()
class SetId(enum.IntEnum):
SWITCHER_SET = 0
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pdu1_switch_cmds(q, op_code)
pdu2_cmds(q, op_code)
pdu2_switch_cmds(q, op_code)
if op_code in PowerOpCodes.INFO_CORE:
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
@@ -68,6 +76,13 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pack_reset_gnd_wdt_cmd(q, "PDU1", oids[PDU_1_HANDLER_ID])
pack_reset_gnd_wdt_cmd(q, "PDU2", oids[PDU_2_HANDLER_ID])
q.add_wait_seconds(5.0)
elif op_code in PowerOpCodes.REQUEST_SWITCHER_SET:
q.add_log_cmd("PCDU: Requesting Switcher Set")
q.add_pus_tc(
create_request_one_diag_command(
make_sid(PCDU_HANDLER_ID, SetId.SWITCHER_SET)
)
)
if q.empty():
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
@@ -94,6 +109,7 @@ def add_power_cmd_defs(defs: TmtcDefinitionWrapper):
oce.add(keys=PowerOpCodes.INFO_ALL, info=PowerInfo.INFO_ALL)
oce.add(keys=PowerOpCodes.INFO_CORE, info=PowerInfo.INFO_CORE)
oce.add(keys=PowerOpCodes.INFO_AUX, info=PowerInfo.INFO_AUX)
oce.add(keys=PowerOpCodes.REQUEST_SWITCHER_SET, info=PowerInfo.REQUEST_SWITCHER_SET)
oce.add(keys=PowerOpCodes.RESET_ALL_GND_WDTS, info=PowerInfo.RESET_ALL_GND_WDTS)
defs.add_service(
name=CustomServiceList.POWER.value,