add new CCSDS handler mode commands
This commit is contained in:
parent
cac68dba7f
commit
8a7880bc35
@ -10,17 +10,21 @@ import struct
|
|||||||
|
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
|
from tmtccmd.tc.pus_200_fsfw_modes import create_mode_command, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
|
from eive_tmtc.config.object_ids import CCSDS_HANDLER_ID
|
||||||
|
|
||||||
|
|
||||||
class ActionId(enum.IntEnum):
|
class ActionId(enum.IntEnum):
|
||||||
# Configures input rate of syrlinks to 400 Khz (results in downlink rate of 200 kbps)
|
# Configures input rate of syrlinks to 400 Khz (results in downlink rate of 200 kbps)
|
||||||
SET_LOW_RATE = 0
|
# SET_LOW_RATE = 0
|
||||||
# Configures input rate of syrlinks to 2000 Khz (results in downlink rate of 1000 kbps)
|
# Configures input rate of syrlinks to 2000 Khz (results in downlink rate of 1000 kbps)
|
||||||
SET_HIGH_RATE = 1
|
# SET_HIGH_RATE = 1
|
||||||
# Enables the syrlinks transmitter (by using RS485 enables lines)
|
# 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
|
EN_TRANSMITTER = 2
|
||||||
# Disables the syrlinks transmitter (by using RS485 enables lines)
|
# 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
|
DIS_TRANSMITTER = 3
|
||||||
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
|
# Sets an arbitrary bitrate. Normally only set low and set high rate commands should be
|
||||||
# required
|
# required
|
||||||
@ -33,20 +37,36 @@ class ActionId(enum.IntEnum):
|
|||||||
UPDATE_ON_FALLING_EDGE = 8
|
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_HIGH_DATARATE = ["disable"]
|
||||||
|
ENABLE_ACTION = ["legacy_enable_tx"]
|
||||||
|
DISABLE_ACTION = ["legacy_disable_tx"]
|
||||||
|
|
||||||
|
|
||||||
def pack_ccsds_handler_test(
|
def pack_ccsds_handler_test(
|
||||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
obyt = object_id.as_bytes
|
obyt = object_id.as_bytes
|
||||||
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
q.add_log_cmd(f"Testing CCSDS handler with object id: {object_id.as_hex_string}")
|
||||||
if op_code == "0":
|
if op_code in OpCode.ENABLE_WITH_LOW_DATARATE:
|
||||||
q.add_log_cmd("CCSDS Handler: Set low rate")
|
q.add_log_cmd("CCSDS Handler: Set low rate")
|
||||||
command = obyt + struct.pack("!I", ActionId.SET_LOW_RATE)
|
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_LOW))
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
if op_code in OpCode.ENABLE_WITH_HIGH_DATARATE:
|
||||||
if op_code == "1":
|
|
||||||
q.add_log_cmd("CCSDS Handler: Set high rate")
|
q.add_log_cmd("CCSDS Handler: Set high rate")
|
||||||
command = obyt + struct.pack("!I", ActionId.SET_HIGH_RATE)
|
q.add_pus_tc(create_mode_command(obyt, Mode.ON, Submode.DATARATE_HIGH))
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
if op_code in OpCode.DISABLE_ACTION:
|
||||||
if op_code == "2":
|
q.add_log_cmd("CCSDS Handler: Disable")
|
||||||
|
q.add_pus_tc(create_mode_command(obyt, Mode.OFF, 0))
|
||||||
|
if op_code in OpCode.ENABLE_ACTION:
|
||||||
q.add_log_cmd("CCSDS Handler: Enables the transmitter")
|
q.add_log_cmd("CCSDS Handler: Enables the transmitter")
|
||||||
command = obyt + struct.pack("!I", ActionId.EN_TRANSMITTER)
|
command = obyt + struct.pack("!I", ActionId.EN_TRANSMITTER)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||||
|
Loading…
Reference in New Issue
Block a user