added command to command assembly to normal

This commit is contained in:
Robin Müller 2021-12-14 16:29:46 +01:00
parent aa0dcdae1a
commit 59a80fed91
No known key found for this signature in database
GPG Key ID: BE6480244DFE612C
3 changed files with 28 additions and 3 deletions

View File

@ -19,13 +19,27 @@ class FsfwHookBase(TmTcHookBase):
return "config/tmtc_config.json"
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict, add_service_op_code_entry, add_op_code_entry
from tmtccmd.config.globals import (
get_default_service_op_code_dict,
add_service_op_code_entry,
add_op_code_entry,
OpCodeDictKeys,
)
def_dict = get_default_service_op_code_dict()
op_code = dict()
add_op_code_entry(op_code_dict=op_code, keys="test", info="Mode CMD Test")
add_op_code_entry(
op_code_dict=op_code,
keys=["0", "asm_to_normal"],
info="Command test assembly to normal mode",
options={OpCodeDictKeys.TIMEOUT: 6.0},
)
add_service_op_code_entry(
srv_op_code_dict=def_dict, name="200", info="Mode MGMT", op_code_entry=op_code
srv_op_code_dict=def_dict,
name="200",
info="Mode MGMT",
op_code_entry=op_code,
)
return def_dict

View File

@ -8,6 +8,7 @@ from typing import Dict
PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17])
TEST_DEVICE_0_ID = bytes([0x44, 0x01, 0xAF, 0xFE])
TEST_DEVICE_1_ID = bytes([0x44, 0x02, 0xAF, 0xFE])
ASSEMBLY_ID = bytes([0x41, 0x00, 0xCA, 0xFE])
def get_object_ids() -> Dict[bytes, list]:
@ -15,5 +16,6 @@ def get_object_ids() -> Dict[bytes, list]:
PUS_SERVICE_17_ID: ["PUS Service 17"],
TEST_DEVICE_0_ID: ["Test Device 0"],
TEST_DEVICE_1_ID: ["Test Device 1"],
ASSEMBLY_ID: ["Assembly ID"],
}
return object_id_dict

View File

@ -11,12 +11,21 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID
from common_tmtc.config.object_ids import TEST_DEVICE_0_ID, ASSEMBLY_ID
def pack_service_200_commands_into(tc_queue: TcQueueT, op_code: str):
if op_code == "test":
pack_service_200_test_into(tc_queue=tc_queue, init_ssc=2000)
elif op_code == "asm_to_normal" or op_code == "0":
# Set Normal mode
tc_queue.appendleft(
(QueueCommands.PRINT, "Testing Service 200: Set Mode Normal")
)
# Command assembly to normal, submode 1 for dual mode,
mode_data = pack_mode_data(ASSEMBLY_ID, Modes.NORMAL, 1)
command = PusTelecommand(service=200, subservice=1, ssc=0, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
def pack_service_200_test_into(init_ssc: int, tc_queue: TcQueueT) -> int: