From 6b657b56236bee01555fca3482fc1ab65cf6e928 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 1 Feb 2023 15:58:34 +0100 Subject: [PATCH] move some modules --- CHANGELOG.md | 2 ++ eive_tmtc/config/events.py | 4 +++- eive_tmtc/config/object_ids.py | 4 +++- eive_tmtc/pus_tc/devs/gyros.py | 10 ---------- eive_tmtc/pus_tc/devs/mgms.py | 9 --------- eive_tmtc/pus_tc/system/time.py | 5 +++-- eive_tmtc/pus_tm/hk_handling.py | 4 ++-- eive_tmtc/{pus_tm/devs => tmtc/acs}/gyros.py | 13 +++++++++++-- eive_tmtc/{pus_tm/devs => tmtc/acs}/mgms.py | 13 +++++++++++-- eive_tmtc/tmtc/power/power.py | 4 +++- tmtcc.py | 4 +++- 11 files changed, 41 insertions(+), 31 deletions(-) delete mode 100644 eive_tmtc/pus_tc/devs/gyros.py delete mode 100644 eive_tmtc/pus_tc/devs/mgms.py rename eive_tmtc/{pus_tm/devs => tmtc/acs}/gyros.py (94%) rename eive_tmtc/{pus_tm/devs => tmtc/acs}/mgms.py (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc9a6e9..3bde721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ list yields a list of all related PRs for each release. # [unreleased] +- Move low level ACS board device modules `gyros.py` and `mgms.py` + to the `tmtc.acs` module. - Bump tmtccmd to include more pythonic log usage. All related changes. It is recommended to use `logging.getLogger(__name__)` for module level loggers now. - Moved TCS components to `tmtc` module diff --git a/eive_tmtc/config/events.py b/eive_tmtc/config/events.py index 0ec1796..aeb4d30 100644 --- a/eive_tmtc/config/events.py +++ b/eive_tmtc/config/events.py @@ -15,6 +15,8 @@ def get_event_dict() -> EventDictT: if os.path.exists(DEFAULT_EVENTS_CSV_PATH): __EVENT_DICT = parse_fsfw_events_csv(DEFAULT_EVENTS_CSV_PATH) else: - logging.getLogger(__name__).warning(f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}") + logging.getLogger(__name__).warning( + f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}" + ) __EVENT_DICT = dict() return __EVENT_DICT diff --git a/eive_tmtc/config/object_ids.py b/eive_tmtc/config/object_ids.py index ce6a5ec..2fca20a 100644 --- a/eive_tmtc/config/object_ids.py +++ b/eive_tmtc/config/object_ids.py @@ -142,7 +142,9 @@ CORE_CONTROLLER_ID = bytes([0x43, 0x00, 0x00, 0x03]) def get_object_ids() -> ObjectIdDictT: global __OBJECT_ID_DICT if not os.path.exists(DEFAULT_OBJECTS_CSV_PATH): - logging.getLogger(__name__).warning(f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}") + logging.getLogger(__name__).warning( + f"No Objects CSV file found at {DEFAULT_OBJECTS_CSV_PATH}" + ) if __OBJECT_ID_DICT is None: if os.path.exists(DEFAULT_OBJECTS_CSV_PATH): __OBJECT_ID_DICT = parse_fsfw_objects_csv(csv_file=DEFAULT_OBJECTS_CSV_PATH) diff --git a/eive_tmtc/pus_tc/devs/gyros.py b/eive_tmtc/pus_tc/devs/gyros.py deleted file mode 100644 index 461a15b..0000000 --- a/eive_tmtc/pus_tc/devs/gyros.py +++ /dev/null @@ -1,10 +0,0 @@ -import enum - - -class AdisGyroSetId(enum.IntEnum): - CORE_HK = 0 - CFG_HK = 1 - - -class L3gGyroSetId(enum.IntEnum): - CORE_HK = 0 diff --git a/eive_tmtc/pus_tc/devs/mgms.py b/eive_tmtc/pus_tc/devs/mgms.py deleted file mode 100644 index fb91e54..0000000 --- a/eive_tmtc/pus_tc/devs/mgms.py +++ /dev/null @@ -1,9 +0,0 @@ -import enum - - -class MgmLis3SetId(enum.IntEnum): - CORE_HK = 0 - - -class MgmRm3100SetId(enum.IntEnum): - CORE_HK = 0 diff --git a/eive_tmtc/pus_tc/system/time.py b/eive_tmtc/pus_tc/system/time.py index 3e05ad1..f00739d 100644 --- a/eive_tmtc/pus_tc/system/time.py +++ b/eive_tmtc/pus_tc/system/time.py @@ -8,7 +8,6 @@ from tmtccmd.tc import service_provider from tmtccmd.tc.decorator import ServiceProviderParams - class OpCode: SET_CURRENT_TIME = ["0", "set-curr-time"] @@ -22,6 +21,8 @@ def pack_set_current_time_ascii_command(p: ServiceProviderParams): q = p.queue_helper time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0" current_time_ascii = time_test_current_time.encode("ascii") - logging.getLogger(__name__).info(f"Current time in ASCII format: {current_time_ascii}") + logging.getLogger(__name__).info( + f"Current time in ASCII format: {current_time_ascii}" + ) q.add_log_cmd(Info.SET_CURRENT_TIME) q.add_pus_tc(PusTelecommand(service=9, subservice=128, app_data=current_time_ascii)) diff --git a/eive_tmtc/pus_tm/hk_handling.py b/eive_tmtc/pus_tm/hk_handling.py index 12acddc..8a61ff6 100644 --- a/eive_tmtc/pus_tm/hk_handling.py +++ b/eive_tmtc/pus_tm/hk_handling.py @@ -19,7 +19,7 @@ from tmtccmd.util.obj_id import ObjectIdU32, ObjectIdDictT from eive_tmtc.pus_tm.devs.bpx_bat import handle_bpx_hk_data from eive_tmtc.pus_tm.devs.gps import handle_gps_data -from eive_tmtc.pus_tm.devs.gyros import handle_gyros_hk_data +from eive_tmtc.tmtc.acs.gyros import handle_gyros_hk_data from eive_tmtc.tmtc.power.tm import ( handle_pdu_data, handle_p60_hk_data, @@ -34,7 +34,7 @@ from eive_tmtc.tmtc.acs.imtq import ( ) from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter from eive_tmtc.tmtc.core import handle_core_hk_data -from eive_tmtc.pus_tm.devs.mgms import handle_mgm_hk_data +from eive_tmtc.tmtc.acs.mgms import handle_mgm_hk_data import eive_tmtc.config.object_ids as obj_ids diff --git a/eive_tmtc/pus_tm/devs/gyros.py b/eive_tmtc/tmtc/acs/gyros.py similarity index 94% rename from eive_tmtc/pus_tm/devs/gyros.py rename to eive_tmtc/tmtc/acs/gyros.py index 923d1a5..fba217f 100644 --- a/eive_tmtc/pus_tm/devs/gyros.py +++ b/eive_tmtc/tmtc/acs/gyros.py @@ -1,11 +1,20 @@ +import enum import struct +import config.objects as obj_ids + from eive_tmtc.pus_tm.defs import PrintWrapper from tmtccmd.util import ObjectIdU32 from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter -from eive_tmtc.pus_tc.devs.gyros import L3gGyroSetId, AdisGyroSetId -import eive_tmtc.config.object_ids as obj_ids + +class AdisGyroSetId(enum.IntEnum): + CORE_HK = 0 + CFG_HK = 1 + + +class L3gGyroSetId(enum.IntEnum): + CORE_HK = 0 def handle_gyros_hk_data( diff --git a/eive_tmtc/pus_tm/devs/mgms.py b/eive_tmtc/tmtc/acs/mgms.py similarity index 91% rename from eive_tmtc/pus_tm/devs/mgms.py rename to eive_tmtc/tmtc/acs/mgms.py index 86391ba..7502a03 100644 --- a/eive_tmtc/pus_tm/devs/mgms.py +++ b/eive_tmtc/tmtc/acs/mgms.py @@ -1,10 +1,19 @@ +import enum import struct +import config.object_id as obj_ids + from eive_tmtc.pus_tm.defs import PrintWrapper -from eive_tmtc.pus_tc.devs.mgms import MgmRm3100SetId, MgmLis3SetId from tmtccmd.util import ObjectIdU32 from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter -import eive_tmtc.config.object_ids as obj_ids + + +class MgmLis3SetId(enum.IntEnum): + CORE_HK = 0 + + +class MgmRm3100SetId(enum.IntEnum): + CORE_HK = 0 def handle_mgm_hk_data( diff --git a/eive_tmtc/tmtc/power/power.py b/eive_tmtc/tmtc/power/power.py index d70c581..65e2a7a 100644 --- a/eive_tmtc/tmtc/power/power.py +++ b/eive_tmtc/tmtc/power/power.py @@ -81,7 +81,9 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str): ) ) if q.empty(): - logging.getLogger(__name__).info(f"Queue is empty, no stack for op code {op_code}") + logging.getLogger(__name__).info( + f"Queue is empty, no stack for op code {op_code}" + ) @tmtc_definitions_provider diff --git a/tmtcc.py b/tmtcc.py index c757ab1..0615994 100755 --- a/tmtcc.py +++ b/tmtcc.py @@ -393,7 +393,9 @@ def setup_tmtc_handlers( gui: bool, ) -> (CcsdsTmHandler, TcHandler): cfdp_in_ccsds_wrapper = setup_cfdp_handler() - verification_wrapper = VerificationWrapper(verificator, _LOGGER, printer.file_logger) + verification_wrapper = VerificationWrapper( + verificator, _LOGGER, printer.file_logger + ) pus_handler = PusHandler(verification_wrapper, printer, raw_logger) ccsds_handler = CcsdsTmHandler(generic_handler=UnknownApidHandler(None)) ccsds_handler.add_apid_handler(pus_handler)