rtd command to rewrite config
This commit is contained in:
parent
43e6f0cefa
commit
887312371b
@ -1,4 +1,5 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import struct
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.pus_tc.devs.pdec_handler import CommandId
|
from eive_tmtc.pus_tc.devs.pdec_handler import CommandId
|
||||||
@ -32,18 +33,22 @@ RTD_IDS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class CommandId:
|
||||||
|
WRITE_CONFIG = 6
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
ON = ["0", "on"]
|
ON = ["0", "on"]
|
||||||
OFF = ["1", "off"]
|
OFF = ["1", "off"]
|
||||||
NORMAL = ["2", "normal"]
|
NORMAL = ["2", "normal"]
|
||||||
CONFIG_CMD = ["3", "Write config"]
|
WRITE_CONFIG = ["3", "Write config"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
ON = "Switch handler on"
|
ON = "Switch handler on"
|
||||||
OFF = "Switch handler off"
|
OFF = "Switch handler off"
|
||||||
NORMAL = "Switch handler normal"
|
NORMAL = "Switch handler normal"
|
||||||
WIRTE_CONFIG = "Write config"
|
WRITE_CONFIG = "Write config"
|
||||||
|
|
||||||
|
|
||||||
@tmtc_definitions_provider
|
@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.ON, info=Info.ON)
|
||||||
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
|
oce.add(keys=OpCode.NORMAL, info=Info.NORMAL)
|
||||||
oce.add(keys=OpCode.OFF, info=Info.OFF)
|
oce.add(keys=OpCode.OFF, info=Info.OFF)
|
||||||
|
oce.add(keys=OpCode.WRITE_CONFIG, info=Info.WRITE_CONFIG)
|
||||||
defs.add_service(
|
defs.add_service(
|
||||||
name=CustomServiceList.RTD.value, info="RTD commands", op_code_entry=oce
|
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
|
service=200, subservice=Subservice.TC_MODE_COMMAND, app_data=app_data
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if op_code in OpCode.CONFIG_CMD:
|
if op_code in OpCode.WRITE_CONFIG:
|
||||||
command = object_id.as_bytes + CommandId.PRINT_CLCW
|
command = object_id.as_bytes + struct.pack('!I', CommandId.WRITE_CONFIG)
|
||||||
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