From 887312371bbc7aad5f8fba1532cf5fc0d2d0470d Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 13:21:12 +0100 Subject: [PATCH] rtd command to rewrite config --- eive_tmtc/pus_tc/devs/rtd.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eive_tmtc/pus_tc/devs/rtd.py b/eive_tmtc/pus_tc/devs/rtd.py index 450ced8..239c7b9 100644 --- a/eive_tmtc/pus_tc/devs/rtd.py +++ b/eive_tmtc/pus_tc/devs/rtd.py @@ -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))