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
diff --git a/README.md b/README.md
index a79785d..1a32765 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,92 @@
# 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 [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
+
+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
+```
+
# Run Linter
Can be used to quickly check validity of script. Install `flake8` first
@@ -20,47 +107,10 @@ and then run the `lint.py` script
./lint.py
```
-# Set up virtual environment
+# Run Auto-Formatter
-## Linux
-
-1. Create virtual environment
+This repo is auto-formatted using `black`. Assuming `black` is installed, you can simply run
```sh
-python3 -m venv venv
+black .
```
-
-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/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"
diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py
index db803da..c3dd7e8 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 5ca178b..3c892be 100644
--- a/pus_tm/factory_hook.py
+++ b/pus_tm/factory_hook.py
@@ -42,7 +42,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:
@@ -59,19 +61,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/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..f444d16
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+tmtccmd >= 2.2.1
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/tmtcloop.py b/tmtcloop.py
index 1302dac..52d1848 100755
--- a/tmtcloop.py
+++ b/tmtcloop.py
@@ -60,7 +60,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")
@@ -71,7 +71,7 @@ def main():
# remove cmdline args so that we can reuse code
sys.argv = sys.argv[:1]
-
+
while True:
args.service = None
args.op_code = None
@@ -80,7 +80,7 @@ def main():
tmtc_backend.set_service(args.service)
tmtc_backend.set_opcode(args.op_code)
tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
-
+
tmtccmd.performOperation(tmtc_backend=tmtc_backend)