From c3b0470aa65b4fd7448837d3284c0b2b2fd66e53 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:01:40 +0200 Subject: [PATCH 1/7] prep next release --- eive_tmtc/__init__.py | 7 ---- eive_tmtc/tmtc/acs/gps.py | 84 +++++++++++++++++++++++++++++---------- pyproject.toml | 8 +--- tmtcc.py | 4 +- 4 files changed, 67 insertions(+), 36 deletions(-) diff --git a/eive_tmtc/__init__.py b/eive_tmtc/__init__.py index d701219..0c373b4 100644 --- a/eive_tmtc/__init__.py +++ b/eive_tmtc/__init__.py @@ -1,13 +1,6 @@ -__version__ = "5.4.3" - import logging from pathlib import Path -SW_NAME = "eive-tmtc" -VERSION_MAJOR = 5 -VERSION_MINOR = 4 -VERSION_REVISION = 3 - EIVE_TMTC_ROOT = Path(__file__).parent PACKAGE_ROOT = EIVE_TMTC_ROOT.parent diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index da90ce1..ab60805 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -72,7 +72,9 @@ def add_gps_cmds(defs: TmtcDefinitionWrapper): ) -def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str): +def pack_gps_command( # noqa: C901 + object_id: bytes, q: DefaultPusQueueHelper, op_code: str +): # noqa: C901: if op_code in OpCode.RESET_GNSS: # TODO: This needs to be re-implemented _LOGGER.warning("Reset pin handling needs to be re-implemented") @@ -82,34 +84,52 @@ def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str): raise ValueError("invalid interval") q.add_log_cmd(f"GPS: {Info.ENABLE_CORE_HK}") cmds = create_enable_periodic_hk_command_with_interval( - diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK), interval_seconds=interval + diag=False, + sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK), + interval_seconds=interval, ) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_CORE_HK: q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}") - q.add_pus_tc(create_disable_periodic_hk_command(diag=False, sid=make_sid(object_id=object_id, - set_id=SetId.CORE_HK))) + q.add_pus_tc( + create_disable_periodic_hk_command( + diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK) + ) + ) if op_code in OpCode.REQ_CORE_HK: q.add_log_cmd(f"GPS: {Info.REQ_CORE_HK}") - q.add_pus_tc(create_request_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK))) + q.add_pus_tc( + create_request_one_hk_command( + sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK) + ) + ) if op_code in OpCode.ENABLE_SKYVIEW_HK: interval = float(input("Please specify interval in floating point seconds: ")) if interval <= 0: raise ValueError("invalid interval") q.add_log_cmd(f"GPS: {Info.ENABLE_SKYVIEW_HK}") cmds = create_enable_periodic_hk_command_with_interval( - diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK), interval_seconds=interval + diag=False, + sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK), + interval_seconds=interval, ) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_SKYVIEW_HK: q.add_log_cmd(f"gps: {Info.DISABLE_SKYVIEW_HK}") - q.add_pus_tc(create_disable_periodic_hk_command(diag=False, sid=make_sid(object_id=object_id, - set_id=SetId.SKYVIEW_HK))) + q.add_pus_tc( + create_disable_periodic_hk_command( + diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK) + ) + ) if op_code in OpCode.REQ_SKYVIEW_HK: q.add_log_cmd(f"GPS: {Info.REQ_SKYVIEW_HK}") - q.add_pus_tc(create_request_one_hk_command(sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK))) + q.add_pus_tc( + create_request_one_hk_command( + sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK) + ) + ) if op_code in OpCode.ON: q.add_log_cmd(f"GPS: {Info.ON}") q.add_pus_tc(create_mode_command(object_id, Mode.ON, 0)) @@ -133,7 +153,7 @@ def handle_gps_data( def handle_core_data(pw: PrintWrapper, hk_data: bytes): - if len(hk_data) < 4*8+4+2+8: + if len(hk_data) < 4 * 8 + 4 + 2 + 8: pw.dlog( f"GPS Core dataset with size {len(hk_data)} does not have expected size" f" of {4*8+4+2+8} bytes" @@ -179,7 +199,7 @@ def handle_core_data(pw: PrintWrapper, hk_data: bytes): def handle_skyview_data(pw: PrintWrapper, hk_data: bytes): - data_length = 8+GpsInfo.MAX_SATELLITES*(8+3*2+1) + data_length = 8 + GpsInfo.MAX_SATELLITES * (8 + 3 * 2 + 1) if len(hk_data) < data_length: pw.dlog( f"GPS Skyview dataset with size {len(hk_data)} does not have expected size" @@ -195,24 +215,46 @@ def handle_skyview_data(pw: PrintWrapper, hk_data: bytes): inc_len_int16 = struct.calcsize(fmt_str_int16) inc_len_double = struct.calcsize(fmt_str_double) inc_len_uint8 = struct.calcsize(fmt_str_uint8) - unix = struct.unpack(fmt_str_unix, hk_data[current_idx: current_idx + inc_len_unix])[0] + unix = struct.unpack( + fmt_str_unix, hk_data[current_idx : current_idx + inc_len_unix] + )[0] current_idx += inc_len_unix - prn_id = struct.unpack(fmt_str_int16, hk_data[current_idx: current_idx + inc_len_int16]) + prn_id = struct.unpack( + fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16] + ) current_idx += inc_len_int16 - azimuth = struct.unpack(fmt_str_int16, hk_data[current_idx: current_idx + inc_len_int16]) + azimuth = struct.unpack( + fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16] + ) current_idx += inc_len_int16 - elevation = struct.unpack(fmt_str_int16, hk_data[current_idx: current_idx + inc_len_int16]) + elevation = struct.unpack( + fmt_str_int16, hk_data[current_idx : current_idx + inc_len_int16] + ) current_idx += inc_len_int16 - signal_to_noise = struct.unpack(fmt_str_double, hk_data[current_idx: current_idx + inc_len_double]) + signal_to_noise = struct.unpack( + fmt_str_double, hk_data[current_idx : current_idx + inc_len_double] + ) current_idx += inc_len_double - used = struct.unpack(fmt_str_uint8, hk_data[current_idx: current_idx + inc_len_uint8]) + used = struct.unpack( + fmt_str_uint8, hk_data[current_idx : current_idx + inc_len_uint8] + ) current_idx += inc_len_uint8 pw.dlog(f"Skyview Time: {unix} unix-sec") - pw.dlog("{:<8} {:<8} {:<8} {:<8} {:<8}".format('PRN_ID', 'AZ [°]', 'EL [°]', 'S2N [dBW]', 'USED')) + pw.dlog( + "{:<8} {:<8} {:<8} {:<8} {:<8}".format( + "PRN_ID", "AZ [°]", "EL [°]", "S2N [dBW]", "USED" + ) + ) for idx in range(GpsInfo.MAX_SATELLITES): - pw.dlog("{:<8} {:<8} {:<8} {:<8} {:<8}".format(prn_id[idx], azimuth[idx], elevation[idx], signal_to_noise[idx], - used[idx])) + pw.dlog( + "{:<8} {:<8} {:<8} {:<8} {:<8}".format( + prn_id[idx], + azimuth[idx], + elevation[idx], + signal_to_noise[idx], + used[idx], + ) + ) FsfwTmTcPrinter.get_validity_buffer( validity_buffer=hk_data[current_idx:], num_vars=6 ) - diff --git a/pyproject.toml b/pyproject.toml index e3d3429..7c88b05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "eive-tmtc" description = "TMTC Commander EIVE" readme = "README.md" -dynamic = ["version"] +version = "5.5.0" requires-python = ">=3.10" license = {text = "Apache-2.0"} authors = [ @@ -29,9 +29,8 @@ classifiers = [ "Topic :: Scientific/Engineering" ] dependencies = [ - "tmtccmd ~= 5.0", + "tmtccmd == 6.0.0rc0", "python-dateutil ~= 2.8", - # "tmtccmd @ git+https://github.com/robamu-org/tmtccmd@1b110d321ef85#egg=tmtccmd" ] [project.urls] @@ -40,9 +39,6 @@ dependencies = [ [tool.setuptools] include-package-data = true -[tool.setuptools.dynamic] -version = {attr = "eive_tmtc.__version__"} - # Auto-Discovery is problematic for some reason, so use custom-discovery [tool.setuptools.packages] find = {} diff --git a/tmtcc.py b/tmtcc.py index d6d3645..c445a63 100755 --- a/tmtcc.py +++ b/tmtcc.py @@ -86,7 +86,7 @@ from tmtccmd.config.args import ( ProcedureParamsWrapper, ) from eive_tmtc import APP_LOGGER -from eive_tmtc import __version__ +from importlib.metadata import version from eive_tmtc.config.definitions import ( PUS_APID, CFDP_APID, @@ -449,7 +449,7 @@ def setup_backend( def main(): # noqa C901: Complexity okay here. - print(f"-- eive tmtc v{__version__} --") + print(f"-- eive tmtc v{version('eive-tmtc')} --") print(f"-- spacepackets v{spacepackets.__version__} --") add_colorlog_console_logger(_LOGGER) # TODO: -V CLI argument to enable this? From acbcbbe98f8aaa73fb7c70bc12fbfd95757baa5f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:03:54 +0200 Subject: [PATCH 2/7] some fixes for new version --- tmtcc.py | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/tmtcc.py b/tmtcc.py index c445a63..0b7fda1 100755 --- a/tmtcc.py +++ b/tmtcc.py @@ -2,10 +2,11 @@ import logging import sys import time -import traceback from pathlib import Path from typing import cast +from spacepackets.ecss import PusVerificator +from spacepackets.version import get_version as get_sp_version from spacepackets.ccsds import SPACE_PACKET_HEADER_SIZE from spacepackets.cfdp import ( ConditionCode, @@ -16,6 +17,8 @@ from spacepackets.cfdp import ( PduFactory, PduType, ) + +import tmtccmd from tmtccmd.logging import add_colorlog_console_logger from tmtccmd.cfdp import CfdpUserBase, TransactionId from tmtccmd.cfdp.defs import CfdpRequestType @@ -32,28 +35,6 @@ from tmtccmd.cfdp.user import ( FileSegmentRecvdParams, ) from tmtccmd.tc.handler import SendCbParams - -try: - import spacepackets -except ImportError as error: - print(error) - print("Python spacepackets module could not be imported") - print( - 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation' - ) - sys.exit(1) - -try: - import tmtccmd -except ImportError: - run_tmtc_commander = None - initialize_tmtc_commander = None - tb = traceback.format_exc() - print(tb) - print("Python tmtccmd submodule could not be imported") - sys.exit(1) - -from spacepackets.ecss import PusVerificator from tmtccmd import TcHandlerBase, BackendBase from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter @@ -450,7 +431,7 @@ def setup_backend( def main(): # noqa C901: Complexity okay here. print(f"-- eive tmtc v{version('eive-tmtc')} --") - print(f"-- spacepackets v{spacepackets.__version__} --") + print(f"-- spacepackets v{get_sp_version()} --") add_colorlog_console_logger(_LOGGER) # TODO: -V CLI argument to enable this? _LOGGER.setLevel(_LOG_LEVEL) From 33cff5e2d2f341dfc9cbceec4f0dfa54244f2535 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:05:18 +0200 Subject: [PATCH 3/7] changelog --- CHANGELOG.md | 6 ++++++ release-checklist.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5844963..8a4a980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v5.5.0] 2023-09-12 + +- Version is not specfied dynamically anymore and can be updated in `pyproject.toml` +- New events and returnvalues +- Bump `tmtccmd` to v6.0.0rc0 + # [v5.4.3] 2023-08-15 ## Added diff --git a/release-checklist.md b/release-checklist.md index bf481ec..7d8a9f6 100644 --- a/release-checklist.md +++ b/release-checklist.md @@ -3,7 +3,7 @@ Checklist for new releases # Pre-Release -1. Bump version inside the `eive_tmtc/__init__.py` file. +1. Bump version inside the `pyproject.toml` file. 2. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and new `unreleased`section. 3. Run auto-formatter with `black .` From 9edc819a9766234bf884d98844173557ffd80e50 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:35:26 +0200 Subject: [PATCH 4/7] eive-tmtc bugfixes --- eive_tmtc/tmtc/acs/gps.py | 11 ++++++----- eive_tmtc/tmtc/acs/imtq.py | 18 ++++++++++-------- eive_tmtc/tmtc/com/pdec_handler.py | 4 ++-- eive_tmtc/tmtc/com/subsystem.py | 8 +++++--- eive_tmtc/tmtc/com/syrlinks_handler.py | 11 ++++++----- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index ab60805..efad9f6 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -13,7 +13,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, create_request_one_hk_command, create_enable_periodic_hk_command_with_interval, - create_disable_periodic_hk_command, + create_disable_periodic_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, + create_disable_periodic_hk_command_with_diag, ) from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter @@ -83,7 +84,7 @@ def pack_gps_command( # noqa: C901 if interval <= 0: raise ValueError("invalid interval") q.add_log_cmd(f"GPS: {Info.ENABLE_CORE_HK}") - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK), interval_seconds=interval, @@ -93,7 +94,7 @@ def pack_gps_command( # noqa: C901 if op_code in OpCode.DISABLE_CORE_HK: q.add_log_cmd(f"gps: {Info.DISABLE_CORE_HK}") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( diag=False, sid=make_sid(object_id=object_id, set_id=SetId.CORE_HK) ) ) @@ -109,7 +110,7 @@ def pack_gps_command( # noqa: C901 if interval <= 0: raise ValueError("invalid interval") q.add_log_cmd(f"GPS: {Info.ENABLE_SKYVIEW_HK}") - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK), interval_seconds=interval, @@ -119,7 +120,7 @@ def pack_gps_command( # noqa: C901 if op_code in OpCode.DISABLE_SKYVIEW_HK: q.add_log_cmd(f"gps: {Info.DISABLE_SKYVIEW_HK}") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( diag=False, sid=make_sid(object_id=object_id, set_id=SetId.SKYVIEW_HK) ) ) diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index cf739ea..2629edd 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -26,6 +26,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( create_request_one_diag_command, create_disable_periodic_hk_command, create_enable_periodic_hk_command_with_interval, + create_enable_periodic_hk_command_with_interval_with_diag, + create_disable_periodic_hk_command_with_diag, ) from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode from tmtccmd.util import ObjectIdU32 @@ -248,7 +250,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.ENABLE_ENG_HK_NO_TORQUE: q.add_log_cmd("IMTQ: Enable ENG HK") interval = float(input("Please enter collection interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=True, sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE), interval_seconds=interval, @@ -258,7 +260,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.DISABLE_ENG_HK_NO_TORQUE: q.add_log_cmd("IMTQ: Disable ENG HK (No Torque)") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_NO_TORQUE) ) ) @@ -275,7 +277,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.ENABLE_ENG_HK_WITH_TORQUE: q.add_log_cmd("IMTQ: Enable ENG HK with torque") interval = float(input("Please enter collection interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=True, sid=make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE), interval_seconds=interval, @@ -285,7 +287,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.DISABLE_ENG_HK_WITH_TORQUE: q.add_log_cmd("IMTQ: Disable ENG HK with Torque") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( True, make_sid(object_id.as_bytes, ImtqSetId.ENG_HK_SET_WITH_TORQUE) ) ) @@ -320,14 +322,14 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.DISABLE_MGM_RAW_NO_TORQUE: q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE) ) ) if op_code == OpCode.ENABLE_MGM_RAW_NO_TORQUE: q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)") interval = float(input("Please enter collection interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=True, sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_NO_TORQUE), interval_seconds=interval, @@ -346,7 +348,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.ENABLE_MGM_RAW_WITH_TORQUE: q.add_log_cmd("IMTQ: Enable MGM RAW HK (No Torque)") interval = float(input("Please enter collection interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( diag=True, sid=make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE), interval_seconds=interval, @@ -356,7 +358,7 @@ def pack_imtq_test_into( # noqa C901 if op_code == OpCode.DISABLE_MGM_RAW_WITH_TORQUE: q.add_log_cmd("IMTQ: Disable MGM RAW HK (No Torque)") q.add_pus_tc( - create_disable_periodic_hk_command( + create_disable_periodic_hk_command_with_diag( True, make_sid(object_id.as_bytes, ImtqSetId.RAW_MTM_WITH_TORQUE) ) ) diff --git a/eive_tmtc/tmtc/com/pdec_handler.py b/eive_tmtc/tmtc/com/pdec_handler.py index 38763b4..758ca5c 100644 --- a/eive_tmtc/tmtc/com/pdec_handler.py +++ b/eive_tmtc/tmtc/com/pdec_handler.py @@ -83,7 +83,7 @@ def pack_pdec_handler_test( 0, ParameterId.POSITIVE_WINDOW, pw, - ).pack() + ) ) ) if op_code == OpCode.NEGATIVE_WINDOW: @@ -96,7 +96,7 @@ def pack_pdec_handler_test( 0, ParameterId.NEGATIVE_WINDOW, nw, - ).pack() + ) ) ) if op_code == OpCode.RESET_NO_INIT: diff --git a/eive_tmtc/tmtc/com/subsystem.py b/eive_tmtc/tmtc/com/subsystem.py index 7a2273e..f011ce5 100644 --- a/eive_tmtc/tmtc/com/subsystem.py +++ b/eive_tmtc/tmtc/com/subsystem.py @@ -3,6 +3,7 @@ import enum from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.config.object_ids import COM_SUBSYSTEM_ID from eive_tmtc.tmtc.com.syrlinks_handler import Datarate +from tmtccmd.pus.s20_fsfw_param_defs import create_scalar_u8_parameter from .defs import Mode as ComMode @@ -87,11 +88,12 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901 q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_LOW}") q.add_pus_tc( create_load_param_cmd( - pack_scalar_u8_parameter_app_data( + create_scalar_u8_parameter( COM_SUBSYSTEM_ID, 0, ParameterId.DATARATE, Datarate.LOW_RATE_MODULATION_BPSK, + ) ) ) @@ -99,7 +101,7 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901 q.add_log_cmd(f"{prefix}: {Info.UPDATE_DEFAULT_DATARATE_HIGH}") q.add_pus_tc( create_load_param_cmd( - pack_scalar_u8_parameter_app_data( + create_scalar_u8_parameter( COM_SUBSYSTEM_ID, 0, ParameterId.DATARATE, @@ -122,7 +124,7 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901 0, ParameterId.TRANSMITTER_TIMEOUT, timeout, - ).pack() + ) ) ) elif o == OpCode.READ_MODE: diff --git a/eive_tmtc/tmtc/com/syrlinks_handler.py b/eive_tmtc/tmtc/com/syrlinks_handler.py index d103900..51ceda0 100644 --- a/eive_tmtc/tmtc/com/syrlinks_handler.py +++ b/eive_tmtc/tmtc/com/syrlinks_handler.py @@ -23,7 +23,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( create_request_one_diag_command, create_enable_periodic_hk_command_with_interval, create_disable_periodic_hk_command, - create_request_one_hk_command, + create_request_one_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, + create_disable_periodic_hk_command_with_diag, ) from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc.pus_200_fsfw_mode import Mode, create_mode_command @@ -182,24 +183,24 @@ def pack_syrlinks_command( # noqa C901: Complexity okay here. q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}") sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET) interval = float(input("HK interval in floating point seconds")) - cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval) + cmds = create_enable_periodic_hk_command_with_interval_with_diag(True, sid, interval) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_HK_RX_REGS: q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_RX_REGS}") sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET) - q.add_pus_tc(create_disable_periodic_hk_command(True, sid)) + q.add_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid)) if op_code in OpCode.ENABLE_HK_TX_REGS: q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_TX_REGS}") sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET) interval = float(input("HK interval in floating point seconds")) - cmds = create_enable_periodic_hk_command_with_interval(True, sid, interval) + cmds = create_enable_periodic_hk_command_with_interval_with_diag(True, sid, interval) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_HK_TX_REGS: q.add_log_cmd(f"{prefix}: {Info.DISABLE_HK_TX_REGS}") sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET) - q.add_pus_tc(create_disable_periodic_hk_command(True, sid)) + q.add_pus_tc(create_disable_periodic_hk_command_with_diag(True, sid)) if op_code in OpCode.HK_TX_REGS: q.add_log_cmd(f"{prefix}: {Info.HK_TX_REGS}") sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET) From 2d08fc0bfa087484abb75ac1bf3423d92d650e1b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:47:27 +0200 Subject: [PATCH 5/7] that appears to be all --- eive_tmtc/tmtc/tcs/ctrl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eive_tmtc/tmtc/tcs/ctrl.py b/eive_tmtc/tmtc/tcs/ctrl.py index 17a1131..4894059 100644 --- a/eive_tmtc/tmtc/tcs/ctrl.py +++ b/eive_tmtc/tmtc/tcs/ctrl.py @@ -13,7 +13,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( generate_one_hk_command, create_request_one_diag_command, create_enable_periodic_hk_command_with_interval, - create_request_one_hk_command, + create_request_one_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, ) @@ -68,7 +68,7 @@ def pack_tcs_ctrl_commands(q: DefaultPusQueueHelper, op_code: str): ) if op_code == OpCode.ENABLE_TEMP_SET: interval_seconds = float(input("Please specify interval in seconds: ")) - cmds = create_enable_periodic_hk_command_with_interval( + cmds = create_enable_periodic_hk_command_with_interval_with_diag( False, make_sid(TCS_CONTROLLER, CtrlSetId.PRIMARY_SENSORS), interval_seconds ) for cmd in cmds: From 66db12796b54d140aecb8308b1ee25d9afb96c5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:48:38 +0200 Subject: [PATCH 6/7] black preview mode, flake8 --- eive_tmtc/pus_tm/event_handler.py | 11 ++++---- eive_tmtc/pus_tm/hk_handler.py | 2 +- eive_tmtc/pus_tm/pus_demux.py | 3 +- eive_tmtc/pus_tm/verification_handler.py | 6 ++-- eive_tmtc/tmtc/acs/acs_ctrl.py | 15 +++++----- eive_tmtc/tmtc/acs/gps.py | 3 +- eive_tmtc/tmtc/acs/imtq.py | 13 +++++---- eive_tmtc/tmtc/acs/reaction_wheels.py | 34 ++++++++++++----------- eive_tmtc/tmtc/com/subsystem.py | 2 -- eive_tmtc/tmtc/com/syrlinks_handler.py | 13 +++++---- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 13 +++++---- eive_tmtc/tmtc/payload/ploc_supervisor.py | 7 +++-- eive_tmtc/tmtc/payload/scex.py | 3 +- eive_tmtc/tmtc/power/common_power.py | 11 ++++---- eive_tmtc/tmtc/power/plpcdu.py | 2 +- eive_tmtc/tmtc/power/tm.py | 18 ++++++------ eive_tmtc/tmtc/tcs/ctrl.py | 4 +-- eive_tmtc/tmtc/tm_store.py | 4 +-- lint.py | 4 +-- tmtcc.py | 10 ++++--- 20 files changed, 95 insertions(+), 83 deletions(-) diff --git a/eive_tmtc/pus_tm/event_handler.py b/eive_tmtc/pus_tm/event_handler.py index d499652..9597bf4 100644 --- a/eive_tmtc/pus_tm/event_handler.py +++ b/eive_tmtc/pus_tm/event_handler.py @@ -37,12 +37,13 @@ def handle_event_packet( # noqa C901: Complexity okay here else: obj_name = obj_id_obj.name generic_event_string = ( - f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x}) " - f"at {tm.time_provider.as_date_time()}" + f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x})" + f" at {tm.time_provider.as_date_time()}" ) _LOGGER.info(generic_event_string) pw.file_logger.info( - f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}" + f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:" + f" {generic_event_string}" ) specific_handler = False if info.name == "MODE_TRANSITION_FAILED": @@ -54,8 +55,8 @@ def handle_event_packet( # noqa C901: Complexity okay here if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED": additional_event_info = f"Additional info: {info.info}" context = ( - f"Progress Percent: {event_def.param1 >> 24 & 0xff} | " - f"Sequence Count: {event_def.param1 & 0xffff} | Bytes Written: {event_def.param2}" + f"Progress Percent: {event_def.param1 >> 24 & 0xff} | Sequence Count:" + f" {event_def.param1 & 0xffff} | Bytes Written: {event_def.param2}" ) pw.dlog(additional_event_info) pw.dlog(context) diff --git a/eive_tmtc/pus_tm/hk_handler.py b/eive_tmtc/pus_tm/hk_handler.py index 78c980b..461f829 100644 --- a/eive_tmtc/pus_tm/hk_handler.py +++ b/eive_tmtc/pus_tm/hk_handler.py @@ -188,5 +188,5 @@ def handle_regular_hk_print( # noqa C901: Complexity okay here else: _LOGGER.info( f"Service 3 TM: Parsing for object {object_id} and set ID {set_id} " - f"has not been implemented." + "has not been implemented." ) diff --git a/eive_tmtc/pus_tm/pus_demux.py b/eive_tmtc/pus_tm/pus_demux.py index 6fdadb7..3495a0f 100644 --- a/eive_tmtc/pus_tm/pus_demux.py +++ b/eive_tmtc/pus_tm/pus_demux.py @@ -87,7 +87,8 @@ def pus_factory_hook( # noqa C901 : Complexity okay here # TODO: Could improve display further by actually displaying a matrix as a # matrix using row and column information pw.dlog( - f"Received vector or matrix data: {param.param_raw.hex(sep=',')}" + "Received vector or matrix data:" + f" {param.param_raw.hex(sep=',')}" ) except ValueError as e: pw.dlog(f"received {e} when trying to parse parameters") diff --git a/eive_tmtc/pus_tm/verification_handler.py b/eive_tmtc/pus_tm/verification_handler.py index 7da00f4..7d75fa8 100644 --- a/eive_tmtc/pus_tm/verification_handler.py +++ b/eive_tmtc/pus_tm/verification_handler.py @@ -48,7 +48,7 @@ def generic_retval_printout( if retval_info is None: raw_err = retval return [ - f"No returnvalue information found for error code with " + "No returnvalue information found for error code with " f"subsystem ID {(raw_err >> 8) & 0xff} and unique ID {raw_err & 0xff}" ] else: @@ -58,9 +58,9 @@ def generic_retval_printout( ) string_list = [retval_string] if p1: - error_param_1_str = f"Error Parameter 1: hex {p1:#010x} " f"dec {p1} " + error_param_1_str = f"Error Parameter 1: hex {p1:#010x} dec {p1} " string_list.append(error_param_1_str) if p2: - error_param_2_str = f"Error Parameter 2: hex {p2:#010x} " f"dec {p2}" + error_param_2_str = f"Error Parameter 2: hex {p2:#010x} dec {p2}" string_list.append(error_param_2_str) return string_list diff --git a/eive_tmtc/tmtc/acs/acs_ctrl.py b/eive_tmtc/tmtc/acs/acs_ctrl.py index 441e898..83d46c4 100644 --- a/eive_tmtc/tmtc/acs/acs_ctrl.py +++ b/eive_tmtc/tmtc/acs/acs_ctrl.py @@ -571,8 +571,8 @@ def pack_acs_ctrl_command(p: ServiceProviderParams): # noqa C901 def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper): pt = int( input( - 'Specify parameter type to set {0: "uint8", 1: "uint16", 2: "int32", 3: "float", ' - '4: "double"}: ' + 'Specify parameter type to set {0: "uint8", 1: "uint16", 2: "int32", 3:' + ' "float", 4: "double"}: ' ) ) sid = int(input("Specify parameter struct ID to set: ")) @@ -808,8 +808,8 @@ def handle_acs_ctrl_sus_raw_data(pw: PrintWrapper, hk_data: bytes): def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes): if len(hk_data) < 3 * 4 * 12 + 3 * 8 * 3: pw.dlog( - f"SUS Processed dataset with size {len(hk_data)} does not have expected size" - f" of {3 * 4 * 12 + 3 * 8 * 3} bytes" + f"SUS Processed dataset with size {len(hk_data)} does not have expected" + f" size of {3 * 4 * 12 + 3 * 8 * 3} bytes" ) return current_idx = 0 @@ -846,7 +846,8 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes): if len(hk_data) < 61: pw.dlog( - f"ACS CTRL HK: MGM HK data with length {len(hk_data)} shorter than expected 61 bytes" + f"ACS CTRL HK: MGM HK data with length {len(hk_data)} shorter than expected" + " 61 bytes" ) pw.dlog(f"Raw Data: {hk_data.hex(sep=',')}") return @@ -1276,8 +1277,8 @@ def perform_mgm_calibration( # noqa C901: Complexity okay reply = CALIBR_SOCKET.recv(1024) if len(reply) != 2: pw.dlog( - f"MGM calibration: Reply received command magnetometer_field has invalid " - f"length {len(reply)}" + "MGM calibration: Reply received command magnetometer_field has" + f" invalid length {len(reply)}" ) return else: diff --git a/eive_tmtc/tmtc/acs/gps.py b/eive_tmtc/tmtc/acs/gps.py index efad9f6..b590800 100644 --- a/eive_tmtc/tmtc/acs/gps.py +++ b/eive_tmtc/tmtc/acs/gps.py @@ -12,8 +12,7 @@ from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, create_request_one_hk_command, - create_enable_periodic_hk_command_with_interval, - create_disable_periodic_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, + create_enable_periodic_hk_command_with_interval_with_diag, create_disable_periodic_hk_command_with_diag, ) from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter diff --git a/eive_tmtc/tmtc/acs/imtq.py b/eive_tmtc/tmtc/acs/imtq.py index 2629edd..e9d873a 100644 --- a/eive_tmtc/tmtc/acs/imtq.py +++ b/eive_tmtc/tmtc/acs/imtq.py @@ -24,8 +24,6 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( generate_one_diag_command, generate_one_hk_command, create_request_one_diag_command, - create_disable_periodic_hk_command, - create_enable_periodic_hk_command_with_interval, create_enable_periodic_hk_command_with_interval_with_diag, create_disable_periodic_hk_command_with_diag, ) @@ -229,12 +227,13 @@ def pack_imtq_test_into( # noqa C901 duration = int( input( f"Specify torque duration [range [0, {pow(2, 16) - 1}, " - f"0 for continuous generation until update]: " + "0 for continuous generation until update]: " ) ) dur_str = "infinite" if duration == 0 else str(duration) q.add_log_cmd( - f"IMTQ: Commanding dipole X={x_dipole}, Y={y_dipole}, Z={y_dipole}, duration={dur_str}" + f"IMTQ: Commanding dipole X={x_dipole}, Y={y_dipole}, Z={y_dipole}," + f" duration={dur_str}" ) q.add_pus_tc( pack_dipole_command( @@ -390,7 +389,8 @@ def pack_dipole_command( duration = int(round(duration)) if duration < 0 or duration > pow(2, 16) - 1: raise ValueError( - f"Duration in ms of {duration} smaller than 0 or larger than allowed {pow(2, 16) - 1}" + f"Duration in ms of {duration} smaller than 0 or larger than allowed" + f" {pow(2, 16) - 1}" ) command += struct.pack("!h", x_dipole) command += struct.pack("!h", y_dipole) @@ -402,7 +402,8 @@ def pack_dipole_command( def raise_dipole_error(dipole_str: str, value: int): raise ValueError( - f"{dipole_str} {value} negative or larger than maximum allowed 2000 * 10^-4*Am^2" + f"{dipole_str} {value} negative or larger than maximum allowed 2000 *" + " 10^-4*Am^2" ) diff --git a/eive_tmtc/tmtc/acs/reaction_wheels.py b/eive_tmtc/tmtc/acs/reaction_wheels.py index 0950627..55b7ddb 100644 --- a/eive_tmtc/tmtc/acs/reaction_wheels.py +++ b/eive_tmtc/tmtc/acs/reaction_wheels.py @@ -261,14 +261,12 @@ def pack_set_speed_command( if speed > 0: if speed < 1000 or speed > 65000: raise ValueError( - "Invalid RW speed specified. " - "Allowed range is [1000, 65000] 0.1 * RPM" + "Invalid RW speed specified. Allowed range is [1000, 65000] 0.1 * RPM" ) elif speed < 0: if speed < -65000 or speed > -1000: raise ValueError( - "Invalid RW speed specified. " - "Allowed range is [-65000, -1000] 0.1 * RPM" + "Invalid RW speed specified. Allowed range is [-65000, -1000] 0.1 * RPM" ) else: # Speed is 0 @@ -304,15 +302,16 @@ def handle_rw_hk_data( speed_rpm = speed / 10.0 ref_speed_rpm = ref_speed / 10.0 pw.dlog( - f"Temperature {temp} C | Speed {speed_rpm} rpm | Reference Speed {ref_speed_rpm} rpm" + f"Temperature {temp} C | Speed {speed_rpm} rpm | Reference Speed" + f" {ref_speed_rpm} rpm" ) pw.dlog( f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, " - f"4: Running, speed changing" + "4: Running, speed changing" ) pw.dlog( f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), " - f"1: High Current Mode (0.6 A)" + "1: High Current Mode (0.6 A)" ) pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5)) if set_id == RwSetId.LAST_RESET: @@ -361,22 +360,24 @@ def handle_rw_hk_data( ) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len]) pw.dlog( - f"MCU Temperature {mcu_temp} | Pressure Sensore Temperature {pressure_sens_temp} C" + f"MCU Temperature {mcu_temp} | Pressure Sensore Temperature" + f" {pressure_sens_temp} C" ) pw.dlog(f"Last Reset Status {last_reset_status}") pw.dlog( f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), " - f"1: High Current Mode (0.6 A)" + "1: High Current Mode (0.6 A)" ) pw.dlog(f"Speed {current_speed} rpm | Reference Speed {ref_speed} rpm") pw.dlog( f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, " - f"4: Running, speed changing" + "4: Running, speed changing" ) pw.dlog("Number Of Invalid Packets:") pw.dlog("CRC | Length | CMD") pw.dlog( - f"{num_invalid_crc_packets} | {num_invalid_len_packets} | {num_invalid_cmd_packets}" + f"{num_invalid_crc_packets} | {num_invalid_len_packets} |" + f" {num_invalid_cmd_packets}" ) pw.dlog( f"Num Of CMD Executed Requests {num_of_cmd_executed_requests} | " @@ -388,15 +389,16 @@ def handle_rw_hk_data( "RegOverrunErrs | TotalErrs" ) pw.dlog( - f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} | {uart_num_parity_errors} | " - f"{uart_num_noise_errors} | {uart_num_frame_errors} | {uart_num_reg_overrun_errors} | " - f"{uart_total_num_errors}" + f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} |" + f" {uart_num_parity_errors} | {uart_num_noise_errors} |" + f" {uart_num_frame_errors} | {uart_num_reg_overrun_errors} |" + f" {uart_total_num_errors}" ) pw.dlog("SPI COM Info:") pw.dlog("NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs") pw.dlog( - f"{spi_num_bytes_written} | {spi_num_bytes_read} | {spi_num_reg_overrun_errors} | " - f"{spi_total_num_errors}" + f"{spi_num_bytes_written} | {spi_num_bytes_read} |" + f" {spi_num_reg_overrun_errors} | {spi_total_num_errors}" ) if current_idx > 0: pw.dlog( diff --git a/eive_tmtc/tmtc/com/subsystem.py b/eive_tmtc/tmtc/com/subsystem.py index f011ce5..35cc3ff 100644 --- a/eive_tmtc/tmtc/com/subsystem.py +++ b/eive_tmtc/tmtc/com/subsystem.py @@ -22,7 +22,6 @@ from tmtccmd.tc.pus_200_fsfw_mode import ( ) from tmtccmd.tc.pus_20_fsfw_param import ( create_load_param_cmd, - pack_scalar_u8_parameter_app_data, ) from tmtccmd.pus.s20_fsfw_param import create_scalar_u32_parameter @@ -93,7 +92,6 @@ def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901 0, ParameterId.DATARATE, Datarate.LOW_RATE_MODULATION_BPSK, - ) ) ) diff --git a/eive_tmtc/tmtc/com/syrlinks_handler.py b/eive_tmtc/tmtc/com/syrlinks_handler.py index 51ceda0..c757a61 100644 --- a/eive_tmtc/tmtc/com/syrlinks_handler.py +++ b/eive_tmtc/tmtc/com/syrlinks_handler.py @@ -21,9 +21,8 @@ from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, create_request_one_diag_command, - create_enable_periodic_hk_command_with_interval, - create_disable_periodic_hk_command, - create_request_one_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, + create_request_one_hk_command, + create_enable_periodic_hk_command_with_interval_with_diag, create_disable_periodic_hk_command_with_diag, ) from spacepackets.ecss.tc import PusTelecommand @@ -183,7 +182,9 @@ def pack_syrlinks_command( # noqa C901: Complexity okay here. q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_RX_REGS}") sid = make_sid(obyt, SetId.RX_REGISTERS_DATASET) interval = float(input("HK interval in floating point seconds")) - cmds = create_enable_periodic_hk_command_with_interval_with_diag(True, sid, interval) + cmds = create_enable_periodic_hk_command_with_interval_with_diag( + True, sid, interval + ) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_HK_RX_REGS: @@ -194,7 +195,9 @@ def pack_syrlinks_command( # noqa C901: Complexity okay here. q.add_log_cmd(f"{prefix}: {Info.ENABLE_HK_TX_REGS}") sid = make_sid(obyt, SetId.TX_REGISTERS_DATASET) interval = float(input("HK interval in floating point seconds")) - cmds = create_enable_periodic_hk_command_with_interval_with_diag(True, sid, interval) + cmds = create_enable_periodic_hk_command_with_interval_with_diag( + True, sid, interval + ) for cmd in cmds: q.add_pus_tc(cmd) if op_code in OpCode.DISABLE_HK_TX_REGS: diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 57cbc58..1a7f8cf 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -570,12 +570,12 @@ def handle_ploc_mpsoc_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int): pw.dlog(f"CAM SoC Temperature: {cam_soc_temp}") pw.dlog(f"System Monitor Temperature: {sysmon_temp}") pw.dlog( - f"SYSMON VCC INT {sysmon_vcc_int:.3f} | SYSMON VCC AUX {sysmon_vcc_aux:.3f} | " - f"SYSMON VCC BRAM {sysmon_vcc_bram:.3f}" + f"SYSMON VCC INT {sysmon_vcc_int:.3f} | SYSMON VCC AUX" + f" {sysmon_vcc_aux:.3f} | SYSMON VCC BRAM {sysmon_vcc_bram:.3f}" ) pw.dlog( - f"SYSMON VCC PAUX {sysmon_vcc_paux:.3f} | SYSMON VCC PINT {sysmon_vcc_pint:.3f} | " - f"SYSMON VCC PDRO {sysmon_vcc_pdro:.3f}" + f"SYSMON VCC PAUX {sysmon_vcc_paux:.3f} | SYSMON VCC PINT" + f" {sysmon_vcc_pint:.3f} | SYSMON VCC PDRO {sysmon_vcc_pdro:.3f}" ) fmt_str = "!fffffffffffff" @@ -602,8 +602,9 @@ def handle_ploc_mpsoc_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int): f"SYSMON MBA 1V8 {sysmon_mb_1v8:.3f}" ) pw.dlog( - f"SYSMON VCC 12V {sysmon_vcc_12v:.3f} | SYSMON VCC 5V {sysmon_vcc_5v:.3f} | " - f"SYSMON VCC 3V3 {sysmon_vcc_3v3:.3f} | SYSMON VCC 3V3VA {sysmon_vcc_3v3va}" + f"SYSMON VCC 12V {sysmon_vcc_12v:.3f} | SYSMON VCC 5V {sysmon_vcc_5v:.3f} |" + f" SYSMON VCC 3V3 {sysmon_vcc_3v3:.3f} | SYSMON VCC 3V3VA" + f" {sysmon_vcc_3v3va}" ) pw.dlog( f"SYSMON VCC 2V5DDR {sysmon_vcc_2v5ddr:.3f} | " diff --git a/eive_tmtc/tmtc/payload/ploc_supervisor.py b/eive_tmtc/tmtc/payload/ploc_supervisor.py index 18aebab..189c0ca 100644 --- a/eive_tmtc/tmtc/payload/ploc_supervisor.py +++ b/eive_tmtc/tmtc/payload/ploc_supervisor.py @@ -471,8 +471,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 custom_data.extend(struct.pack("!B", memory_id)) custom_data.extend(struct.pack("!I", start_address)) q.add_log_cmd( - f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID {memory_id} at start " - f"address {start_address}" + f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID" + f" {memory_id} at start address {start_address}" ) command = create_action_cmd( object_id.as_bytes, SupvActionId.MEM_CHECK, custom_data @@ -775,7 +775,8 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper): ) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len]) current_idx += inc_len pw.dlog( - f"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset): {soc_state}" + "SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset):" + f" {soc_state}" ) pw.dlog(f"Power Cycles {power_cycles}") pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms") diff --git a/eive_tmtc/tmtc/payload/scex.py b/eive_tmtc/tmtc/payload/scex.py index 2edcbe9..6935a1c 100644 --- a/eive_tmtc/tmtc/payload/scex.py +++ b/eive_tmtc/tmtc/payload/scex.py @@ -131,8 +131,7 @@ def pack_scex_cmds(p: ServiceProviderParams): # noqa C901 cell_select = int(cell_select) if cell_select < 1 or cell_select > 10: print( - f"Invalid cell number {cell_select}, " - f"Please enter a valid number: " + f"Invalid cell number {cell_select}, Please enter a valid number: " ) continue cn = cell_select - 1 diff --git a/eive_tmtc/tmtc/power/common_power.py b/eive_tmtc/tmtc/power/common_power.py index 477a3fa..bcf416c 100644 --- a/eive_tmtc/tmtc/power/common_power.py +++ b/eive_tmtc/tmtc/power/common_power.py @@ -200,7 +200,8 @@ def pack_common_gomspace_cmds( # noqa C901: Complexity is okay here. if op_code in GomspaceOpCode.SAVE_TABLE_DEFAULT: source_table = int( input( - "Source table [0: Board Config, 1: Module Config, 2: Calibration Parameter]: " + "Source table [0: Board Config, 1: Module Config, 2: Calibration" + " Parameter]: " ) ) if source_table not in [0, 1, 2]: @@ -215,8 +216,8 @@ def pack_common_gomspace_cmds( # noqa C901: Complexity is okay here. if op_code in GomspaceOpCode.LOAD_TABLE: target_table = int( input( - "Target table ID [0: Board Config, 1: Module Config, 2: Calibration Parameter, " - "4: HK TM]: " + "Target table ID [0: Board Config, 1: Module Config, 2: Calibration" + " Parameter, 4: HK TM]: " ) ) if target_table not in [0, 1, 2, 4]: @@ -224,8 +225,8 @@ def pack_common_gomspace_cmds( # noqa C901: Complexity is okay here. if target_table != 4: source_table = int( input( - "Source table (file or default) [0: Board Config, 1: Module Config, " - "2: Calibration Parameter, value + 4 for default table]: " + "Source table (file or default) [0: Board Config, 1: Module Config," + " 2: Calibration Parameter, value + 4 for default table]: " ) ) if source_table not in [0, 1, 2, 4, 5, 6]: diff --git a/eive_tmtc/tmtc/power/plpcdu.py b/eive_tmtc/tmtc/power/plpcdu.py index 62517e3..68bbc72 100644 --- a/eive_tmtc/tmtc/power/plpcdu.py +++ b/eive_tmtc/tmtc/power/plpcdu.py @@ -284,7 +284,7 @@ def hpa_on_procedure(q: DefaultPusQueueHelper): if delay_dro_to_x8 is None: delay_dro_to_x8 = 900 q.add_log_cmd( - f"Starting procedure to switch on PL PCDU HPA with DRO to X8 " + "Starting procedure to switch on PL PCDU HPA with DRO to X8 " f"delay of {delay_dro_to_x8} seconds" ) pl_pcdu_on = PusTelecommand( diff --git a/eive_tmtc/tmtc/power/tm.py b/eive_tmtc/tmtc/power/tm.py index 6c7971b..76f8a21 100644 --- a/eive_tmtc/tmtc/power/tm.py +++ b/eive_tmtc/tmtc/power/tm.py @@ -75,8 +75,8 @@ class WdtInfo: self.pw.dlog(wdt_info) for idx in range(len(self.wdt_reboots_list)): self.pw.dlog( - f"{WDT_LIST[idx].ljust(5)} | " - f"{self.wdt_reboots_list[idx]:010} | {self.time_pings_left_list[idx]:010}", + f"{WDT_LIST[idx].ljust(5)} | {self.wdt_reboots_list[idx]:010} |" + f" {self.time_pings_left_list[idx]:010}", ) def parse(self, wdt_data: bytes, current_idx: int) -> int: @@ -327,8 +327,9 @@ def handle_p60_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes): ) pw.dlog(misc_info) batt_info = ( - f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0} | " - f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}" + f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0} |" + f" Charge Current {batt_charge_current} | Discharge Current" + f" {batt_discharge_current}" ) pw.dlog(batt_info) pw.dlog( @@ -419,12 +420,12 @@ def handle_acu_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes): ) pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}") pw.dlog( - f"Ground WDT: Reboot Count {wdt_cnt_gnd} | Time Left {wdt_gnd_time_left} sec" + f"Ground WDT: Reboot Count {wdt_cnt_gnd} | Time Left" + f" {wdt_gnd_time_left} sec" ) pw.dlog( - "ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|" - "5:DAC|6:TempSens|7:Reserved" + "ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|5:DAC|6:TempSens|7:Reserved" ) dev_parser.print(pw=pw) FsfwTmTcPrinter.get_validity_buffer( @@ -474,7 +475,8 @@ def pdu_config_table_handler( pw.dlog("[tcs, syrlinks, str, mgt, sus-n, scex, ploc, acs-a, unused]") elif obj_id.as_bytes == PDU_2_HANDLER_ID: pw.dlog( - "[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red, acs-b, pl-cam]" + "[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red," + " acs-b, pl-cam]" ) out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H") out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H") diff --git a/eive_tmtc/tmtc/tcs/ctrl.py b/eive_tmtc/tmtc/tcs/ctrl.py index 4894059..7b99437 100644 --- a/eive_tmtc/tmtc/tcs/ctrl.py +++ b/eive_tmtc/tmtc/tcs/ctrl.py @@ -12,8 +12,8 @@ from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, generate_one_hk_command, create_request_one_diag_command, - create_enable_periodic_hk_command_with_interval, - create_request_one_hk_command, create_enable_periodic_hk_command_with_interval_with_diag, + create_request_one_hk_command, + create_enable_periodic_hk_command_with_interval_with_diag, ) diff --git a/eive_tmtc/tmtc/tm_store.py b/eive_tmtc/tmtc/tm_store.py index 10a8683..262cac7 100644 --- a/eive_tmtc/tmtc/tm_store.py +++ b/eive_tmtc/tmtc/tm_store.py @@ -148,8 +148,8 @@ def time_prompt_offset_from_now() -> datetime.datetime: seconds_offset = math.floor( float( input( - "Please enter the time as a offset from now in seconds. Negative offset is " - "allowed: " + "Please enter the time as a offset from now in seconds. Negative offset" + " is allowed: " ) ) ) diff --git a/lint.py b/lint.py index e91bd36..420bc81 100755 --- a/lint.py +++ b/lint.py @@ -32,8 +32,8 @@ def main(): if not os.path.exists("setup.cfg"): additional_flags_second_step += " --max-line-length=100" flake8_second_step_cmd = ( - f"{python_exe} flake8 . {additional_flags_both_steps} {additional_flags_second_step}" - f" {exclude_dirs_flag}" + f"{python_exe} flake8 . {additional_flags_both_steps} " + f" {additional_flags_second_step} {exclude_dirs_flag}" ) os.system(flake8_second_step_cmd) diff --git a/tmtcc.py b/tmtcc.py index 0b7fda1..2768af2 100755 --- a/tmtcc.py +++ b/tmtcc.py @@ -192,7 +192,8 @@ class CfdpInCcsdsWrapper(SpecificApidHandlerBase): _LOGGER.info("Received Finished PDU TM") else: _LOGGER.info( - f"Received File Directive PDU with type {pdu_base.directive_type!r} TM" + "Received File Directive PDU with type" + f" {pdu_base.directive_type!r} TM" ) self.handler.pass_pdu_packet(pdu_base) @@ -292,7 +293,7 @@ class TcHandler(TcHandlerBase): if pdu.pdu_directive_type == DirectiveType.METADATA_PDU: metadata = pdu.to_metadata_pdu() self.queue_helper.add_log_cmd( - f"CFDP Source: Sending Metadata PDU for file with size " + "CFDP Source: Sending Metadata PDU for file with size " f"{metadata.file_size}" ) elif pdu.pdu_directive_type == DirectiveType.EOF_PDU: @@ -302,7 +303,7 @@ class TcHandler(TcHandlerBase): else: fd_pdu = pdu.to_file_data_pdu() self.queue_helper.add_log_cmd( - f"CFDP Source: Sending File Data PDU for segment at offset " + "CFDP Source: Sending File Data PDU for segment at offset " f"{fd_pdu.offset} with length {len(fd_pdu.file_data)}" ) self.queue_helper.add_ccsds_tc(sp) @@ -314,7 +315,8 @@ class TcHandler(TcHandlerBase): if info.proc_type == TcQueueEntryType.PUS_TC: def_proc = info.to_def_procedure() _LOGGER.info( - f"Finished queue for service {def_proc.service} and op code {def_proc.op_code}" + f"Finished queue for service {def_proc.service} and op code" + f" {def_proc.op_code}" ) elif info.proc_type == TcProcedureType.CFDP: _LOGGER.info("Finished CFDP queue") From af1474f10cc3b1a355086d7d92f2882fa1942da6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 12 Sep 2023 13:49:27 +0200 Subject: [PATCH 7/7] bump patch version --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4a980..f07832c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v5.5.1] 2023-09-12 + +## Fixed + +- Some API usage fixes related to `tmtccmd` update. + # [v5.5.0] 2023-09-12 - Version is not specfied dynamically anymore and can be updated in `pyproject.toml` diff --git a/pyproject.toml b/pyproject.toml index 7c88b05..4c2633c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "eive-tmtc" description = "TMTC Commander EIVE" readme = "README.md" -version = "5.5.0" +version = "5.5.1" requires-python = ">=3.10" license = {text = "Apache-2.0"} authors = [