From cff6661f5d3ddca2d3784d9dba7ee1c8d876e758 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 14:46:23 +0200 Subject: [PATCH 1/6] update README --- README.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a79785d..3e56bad 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,31 @@ # TMTC Commander EIVE +This application can be used to test the EIVE On-Board Software. Furthermore, it can +also be used to retrieve all sorts of telemetry data like housekeeping data. + +It is recommended to use this application with a virtual environment. +The [virtual environemnt](#venv) chapter describes how to set one up. + +The configuration file can currently be found at `tmtc_conf.json`. It caches settings +like the default communication interface or parameters like the TCP port when using the TCP +communication interface. + +# Examples + +Assuming you are running in a virtual environment + +Run CLI mode + +```sh +./tmtccli.py +``` + +Run GUI mode + +```sh +./tmtcgui.py +``` + # Run Linter Can be used to quickly check validity of script. Install `flake8` first @@ -20,7 +46,7 @@ and then run the `lint.py` script ./lint.py ``` -# Set up virtual environment +# Set up virtual environment ## Linux @@ -63,4 +89,3 @@ venv\Scripts\activate.bat cd tmtccmd py -m pip install -e .[gui] ``` - From 1272a5aa894725e394db890565c01cfd94133f39 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 14:55:23 +0200 Subject: [PATCH 2/6] add back requirements.txt and update README --- README.md | 109 +++++++++++++++++++++++++++-------------------- requirements.txt | 1 + 2 files changed, 64 insertions(+), 46 deletions(-) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 3e56bad..104d00c 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,76 @@ This application can be used to test the EIVE On-Board Software. Furthermore, it also be used to retrieve all sorts of telemetry data like housekeeping data. It is recommended to use this application with a virtual environment. -The [virtual environemnt](#venv) chapter describes how to set one up. +The [virtual environemnt](#venv) chapter describes how to set one up and install the `tmtccmd` +package interactively. The configuration file can currently be found at `tmtc_conf.json`. It caches settings like the default communication interface or parameters like the TCP port when using the TCP communication interface. +# Set up virtual environment + +## Linux + +1. Create virtual environment + + ```sh + python3 -m venv venv + ``` + +2. Activate virtual environment + + ```sh + . venv/bin/activate + ``` + +## Windows + +1. Create virtual environment + + ```sh + py -m venv . + ``` + +2. Activate virtual environment + + ```sh + venv\Scripts\activate.bat + ``` + +# Install requirements + +There are two ways to install the requirements. One is to install the primary dependency +`tmtccmd` interactively. This is the recommended way + +Assuming you are running in a virtual environment: + +1. Install `tmtccmd` for virtual environment. `-e` for interactive installation. + + ```sh + cd tmtccmd + pip install -e .[gui] + ``` + +2. You can also install the `spacepackets` package locally/interactively + Normally, it will be installed as a `tmtccmd` dependency. + + ```sh + cd spacepackets + pip install -e . + ``` + +Alternatively you can also install the packages from PyPI completely, but the risk of +incompatibilities will be high there + +```sh +pip install -r requirements.txt +``` + # Examples -Assuming you are running in a virtual environment +Assuming you are running in a virtual environment and all package requirements were +installed properly. Run CLI mode @@ -45,47 +106,3 @@ and then run the `lint.py` script ```sh ./lint.py ``` - -# Set up virtual environment - -## Linux - -1. Create virtual environment - -```sh -python3 -m venv venv -``` - -2. Activate virtual environment - -```sh -. venv/bin/activate -``` - -3. Install `tmtccmd` for virtual environment. `-e` for interactive installation. - -```sh -cd tmtccmd -python3 -m pip install -e .[gui] -``` - -## Windows - -1. Create virtual environment - -```sh -py -m venv . -``` - -2. Activate virtual environment - -```sh -venv\Scripts\activate.bat -``` - -3. Install `tmtccmd` for virtual environment. `-e` for interactive installation. - -```sh -cd tmtccmd -py -m pip install -e .[gui] -``` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f444d16 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +tmtccmd >= 2.2.1 From 66d788abf4fc52057f1b28ed4186aeaf18ebc159 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 14:57:54 +0200 Subject: [PATCH 3/6] other small update for README --- README.md | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 104d00c..1a32765 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,30 @@ This application can be used to test the EIVE On-Board Software. Furthermore, it also be used to retrieve all sorts of telemetry data like housekeeping data. It is recommended to use this application with a virtual environment. -The [virtual environemnt](#venv) chapter describes how to set one up and install the `tmtccmd` -package interactively. +The [virtual environemnt](#venv) chapter describes how to set one up. The [requirements](#reqs) +describes how to install all required packages. The configuration file can currently be found at `tmtc_conf.json`. It caches settings like the default communication interface or parameters like the TCP port when using the TCP communication interface. +# Examples + +Assuming you are running in a [virtual environment](#venv) and all [package requirements](#reqs) +were installed properly. + +Run CLI mode + +```sh +./tmtccli.py +``` + +Run GUI mode + +```sh +./tmtcgui.py +``` + # Set up virtual environment ## Linux @@ -41,7 +58,7 @@ communication interface. venv\Scripts\activate.bat ``` -# Install requirements +# Install requirements There are two ways to install the requirements. One is to install the primary dependency `tmtccmd` interactively. This is the recommended way @@ -70,23 +87,6 @@ incompatibilities will be high there pip install -r requirements.txt ``` -# Examples - -Assuming you are running in a virtual environment and all package requirements were -installed properly. - -Run CLI mode - -```sh -./tmtccli.py -``` - -Run GUI mode - -```sh -./tmtcgui.py -``` - # Run Linter Can be used to quickly check validity of script. Install `flake8` first @@ -106,3 +106,11 @@ and then run the `lint.py` script ```sh ./lint.py ``` + +# Run Auto-Formatter + +This repo is auto-formatted using `black`. Assuming `black` is installed, you can simply run + +```sh +black . +``` From 79d900f57b38bbe644460503fc522bd732eaa9cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 15:00:55 +0200 Subject: [PATCH 4/6] bump version --- config/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/__init__.py b/config/__init__.py index 56db5af..2e43775 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -1,6 +1,6 @@ SW_NAME = "eive" VERSION_MAJOR = 1 -VERSION_MINOR = 9 +VERSION_MINOR = 11 VERSION_SUBMINOR = 0 -__version__ = "1.9.0" +__version__ = "1.11.0" From 1d6002abcff2abf9df116f143b6c6f7ddbd79e70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 15:03:05 +0200 Subject: [PATCH 5/6] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 600bf83..5a00ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ list yields a list of all related PRs for each release. # [v1.11.0] +- Add `setup.cfg` and `setup.py` file, allowing package installation +- New ploc commands +- Removed commands related to obsolete ploc updater component +- Adds `tmtcloop.py`, which allows receiving TMs continously while being able to send TCs at will. - Added more RW HK handling and RW Assembly commands - Pack additional parameter which identifiers whether heater is commanded externally or internally PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/67 From a6f669e9740b98c1502e753509750bad7fdf6539 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 May 2022 17:21:03 +0200 Subject: [PATCH 6/6] cleaner TM handling --- pus_tc/cmd_definitions.py | 3 ++- pus_tc/devs/ploc_supervisor.py | 16 ++++++++-------- pus_tm/factory_hook.py | 11 ++++++++--- pus_tm/verification_handler.py | 2 -- tmtcc.py | 4 +++- tmtccli.py | 9 +++++++-- tmtccmd | 2 +- tmtcloop.py | 6 +++--- 8 files changed, 32 insertions(+), 21 deletions(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index dc21110..94f3e82 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -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) diff --git a/pus_tc/devs/ploc_supervisor.py b/pus_tc/devs/ploc_supervisor.py index d9b9104..c6fcd56 100644 --- a/pus_tc/devs/ploc_supervisor.py +++ b/pus_tc/devs/ploc_supervisor.py @@ -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()) diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index d1829ca..6fdca91 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -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) ) diff --git a/pus_tm/verification_handler.py b/pus_tm/verification_handler.py index 6182f9d..08c0099 100644 --- a/pus_tm/verification_handler.py +++ b/pus_tm/verification_handler.py @@ -1,5 +1,3 @@ -import logging -from datetime import datetime from typing import cast from tmtccmd.tm.pus_1_verification import Service1TMExtended diff --git a/tmtcc.py b/tmtcc.py index 0dc37b3..e704716 100644 --- a/tmtcc.py +++ b/tmtcc.py @@ -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 ) diff --git a/tmtccli.py b/tmtccli.py index 3541bd4..29f3615 100755 --- a/tmtccli.py +++ b/tmtccli.py @@ -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(): diff --git a/tmtccmd b/tmtccmd index 0895aae..e81e6db 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 0895aae63414cdca4a16c53028fe72401c1b50e0 +Subproject commit e81e6dbd594c1cdf51cd355a724cbd267d9dee38 diff --git a/tmtcloop.py b/tmtcloop.py index d2cfb5b..c48f436 100755 --- a/tmtcloop.py +++ b/tmtcloop.py @@ -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)