rtd command to rewrite config

This commit is contained in:
Jakob Meier 2023-01-19 13:21:12 +01:00
parent 43e6f0cefa
commit 887312371b

View File

@ -1,4 +1,5 @@
from typing import Optional
import struct
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.pus_tc.devs.pdec_handler import CommandId
@ -32,18 +33,22 @@ RTD_IDS = [
]
class CommandId:
WRITE_CONFIG = 6
class OpCode:
ON = ["0", "on"]
OFF = ["1", "off"]
NORMAL = ["2", "normal"]
CONFIG_CMD = ["3", "Write config"]
WRITE_CONFIG = ["3", "Write config"]
class Info:
ON = "Switch handler on"
OFF = "Switch handler off"
NORMAL = "Switch handler normal"
WIRTE_CONFIG = "Write config"
WRITE_CONFIG = "Write config"
@tmtc_definitions_provider
@ -52,6 +57,7 @@ def specify_rtd_cmds(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCode.ON, info=Info.ON)
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
oce.add(keys=OpCode.OFF, info=Info.OFF)
oce.add(keys=OpCode.WRITE_CONFIG, info=Info.WRITE_CONFIG)
defs.add_service(
name=CustomServiceList.RTD.value, info="RTD commands", op_code_entry=oce
)
@ -92,8 +98,8 @@ def pack_rtd_commands(
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
)
)
if op_code in OpCode.CONFIG_CMD:
command = object_id.as_bytes + CommandId.PRINT_CLCW
if op_code in OpCode.WRITE_CONFIG:
command = object_id.as_bytes + struct.pack('!I', CommandId.WRITE_CONFIG)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))