cleaner TM handling

This commit is contained in:
Robin Müller 2022-05-17 17:21:03 +02:00
parent 1d6002abcf
commit a6f669e974
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
8 changed files with 32 additions and 21 deletions

View File

@ -14,6 +14,7 @@ from pus_tc.devs.bpx_batt import BpxOpCodes
def get_eive_service_op_code_dict() -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict
service_op_code_dict = get_default_service_op_code_dict()
add_bpx_cmd_definitions(cmd_dict=service_op_code_dict)
add_core_controller_definitions(cmd_dict=service_op_code_dict)
@ -806,7 +807,7 @@ def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT):
"14": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}),
"15": ("Ploc MPSoC: Mode idle", {OpCodeDictKeys.TIMEOUT: 2.0}),
"16": ("Ploc MPSoC: Tc cam command send", {OpCodeDictKeys.TIMEOUT: 2.0}),
"17": ("Ploc MPSoC: Set UART TX tristate" , {OpCodeDictKeys.TIMEOUT: 2.0}),
"17": ("Ploc MPSoC: Set UART TX tristate", {OpCodeDictKeys.TIMEOUT: 2.0}),
"18": ("Ploc MPSoC: Relesase UART TX", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_mpsoc_tuple = ("Ploc MPSoC", op_code_dict_srv_ploc_mpsoc)

View File

@ -277,18 +277,14 @@ def pack_ploc_supv_commands(
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")
)
command = object_id + struct.pack(
"!I", SupvActionIds.RESTART_SUPERVISOR
)
command = object_id + struct.pack("!I", SupvActionIds.RESTART_SUPERVISOR)
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "38":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")
)
command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
)
command = object_id + struct.pack("!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "39":
@ -393,8 +389,12 @@ def pack_ploc_supv_commands(
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable NVMs"))
nvm01 = int(input("Enable (1) or disable(0) NVM 0 and 1: "))
nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_NVMS) + struct.pack('B', nvm01) + \
struct.pack('B', nvm3)
command = (
object_id
+ struct.pack("!I", SupvActionIds.ENABLE_NVMS)
+ struct.pack("B", nvm01)
+ struct.pack("B", nvm3)
)
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -41,7 +41,9 @@ def pus_factory_hook(raw_tm_packet: bytes):
subservice_type = raw_tm_packet[8]
file_logger = FSFW_PRINTER.file_logger
obj_id_dict = get_object_ids()
dedicated_handler = True
try:
tm_packet = None
if service_type == 1:
handle_service_1_packet(printer=FSFW_PRINTER, raw_tm=raw_tm_packet)
elif service_type == 3:
@ -58,19 +60,22 @@ def pus_factory_hook(raw_tm_packet: bytes):
)
elif service_type == 17:
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
dedicated_handler = False
elif service_type == 20:
tm_packet = Service20FsfwTm.unpack(raw_telemetry=raw_tm_packet)
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
dedicated_handler = False
elif service_type == 200:
tm_packet = Service200FsfwTm.unpack(raw_telemetry=raw_tm_packet)
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
dedicated_handler = False
else:
LOGGER.info(
f"The service {service_type} is not implemented in Telemetry Factory"
)
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
tm_packet.print_source_data(PrintFormats.HEX)
dedicated_handler = True
if not dedicated_handler and tm_packet is not None:
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
log_raw_pus_tm(
packet=raw_tm_packet, srv_subservice=(service_type, subservice_type)
)

View File

@ -1,5 +1,3 @@
import logging
from datetime import datetime
from typing import cast
from tmtccmd.tm.pus_1_verification import Service1TMExtended

View File

@ -45,7 +45,9 @@ def tmtcc_pre_args() -> EiveHookObject:
return EiveHookObject(json_cfg_path=default_json_path())
def tmtcc_post_args(hook_obj: EiveHookObject, use_gui: bool, args: Optional[argparse.Namespace]):
def tmtcc_post_args(
hook_obj: EiveHookObject, use_gui: bool, args: Optional[argparse.Namespace]
):
setup_args = SetupArgs(
hook_obj=hook_obj, use_gui=use_gui, apid=PUS_APID, cli_args=args
)

View File

@ -1,7 +1,12 @@
#!/usr/bin/env python3
"""TMTC commander for EIVE"""
from tmtcc import tmtcc_post_args, tmtcc_pre_args, create_default_args_parser, \
add_default_tmtccmd_args, parse_default_input_arguments
from tmtcc import (
tmtcc_post_args,
tmtcc_pre_args,
create_default_args_parser,
add_default_tmtccmd_args,
parse_default_input_arguments,
)
def main():

@ -1 +1 @@
Subproject commit 0895aae63414cdca4a16c53028fe72401c1b50e0
Subproject commit e81e6dbd594c1cdf51cd355a724cbd267d9dee38

View File

@ -58,7 +58,7 @@ def main():
)
tmtc_file_logger = create_tmtc_logger()
tmtc_backend.usr_send_wrapper = (pre_tc_send_cb, tmtc_file_logger)
tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
get_console_logger().info("Disabling console logger for continuous operation")
@ -69,7 +69,7 @@ def main():
# remove cmdline args so that we can reuse code
sys.argv = sys.argv[:1]
while True:
args = parse_default_input_arguments(arg_parser, hook_obj)
setup_args = SetupArgs(
@ -77,7 +77,7 @@ def main():
)
tmtccmd.setup(setup_args=setup_args)
tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
tmtccmd.performOperation(tmtc_backend=tmtc_backend)