From 5d866a6d83b0c4614823af8366c911c92a066580 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Sat, 28 Nov 2020 01:04:29 +0100 Subject: [PATCH] config file renamed --- config/tmtcc_com_config.py | 2 +- config/{obsw_config.py => tmtcc_config.py} | 17 ++---- .../{obsw_user_code.py => tmtcc_user_code.py} | 2 +- core/tmtc_backend.py | 4 +- core/tmtc_client_core.py | 4 +- core/tmtc_frontend.py | 56 +++++++++---------- tc/obsw_image_handler.py | 2 +- tc/obsw_pus_tc_packer.py | 2 +- tc/obsw_tc_core.py | 2 +- tc/obsw_tc_gps.py | 2 +- tc/obsw_tc_service2.py | 2 +- tc/obsw_tc_service20.py | 2 +- tc/obsw_tc_service200.py | 2 +- tc/obsw_tc_service23_sdcard.py | 2 +- tc/obsw_tc_service3.py | 2 +- tc/obsw_tc_service5_17.py | 2 +- tc/obsw_tc_service8.py | 2 +- tc/obsw_tc_utility.py | 2 +- test/obsw_module_test.py | 2 +- test/obsw_pus_service_test.py | 2 +- tm/obsw_tm_service_3.py | 2 +- tmtc_core | 2 +- utility/obsw_binary_uploader.py | 2 +- utility/obsw_file_transfer_helper.py | 2 +- 24 files changed, 58 insertions(+), 63 deletions(-) rename config/{obsw_config.py => tmtcc_config.py} (91%) rename config/{obsw_user_code.py => tmtcc_user_code.py} (95%) diff --git a/config/tmtcc_com_config.py b/config/tmtcc_com_config.py index 07bc864..79ad402 100644 --- a/config/tmtcc_com_config.py +++ b/config/tmtcc_com_config.py @@ -13,7 +13,7 @@ from tmtc_core.comIF.obsw_qemu_com_if import QEMUComIF from tmtc_core.utility.obsw_logger import get_logger from tmtc_core.utility.obsw_tmtc_printer import TmTcPrinter -import config.obsw_config as g +import config.tmtcc_config as g LOGGER = get_logger() diff --git a/config/obsw_config.py b/config/tmtcc_config.py similarity index 91% rename from config/obsw_config.py rename to config/tmtcc_config.py index 99955e7..f803da1 100644 --- a/config/obsw_config.py +++ b/config/tmtcc_config.py @@ -1,10 +1,7 @@ """ -@file - obsw_config.py -@date - 01.11.2019 -@brief - Global settings for UDP client +@file tmtcc_config.py +@date 01.11.2019 +@brief Global settings for TMTC commander. """ import struct @@ -17,11 +14,9 @@ from tmtc_core.tmtc_core_definitions import ComInterfaces Mission/Device specific information. """ -SW_NAME = "sputnik" -SW_VERSION = 1 -SW_SUBVERSION = 0 - # TODO: Automate / Autofill this file with the MIB parser +# TODO: JSON file so we can store variables which are not tracked by version control but still +# remain the same on a machine (e.g. COM port or IP addresses) # Object IDs CORE_CONTROLLER_ID = bytearray([0x40, 0x00, 0x10, 0x00]) @@ -180,7 +175,7 @@ def set_globals(args): G_RESEND_TC = args.resend_tc G_LISTENER_AFTER_OP = args.listener - from config.obsw_user_code import global_setup_hook + from config.tmtcc_user_code import global_setup_hook global_setup_hook() def set_glob_apid(new_apid: int): diff --git a/config/obsw_user_code.py b/config/tmtcc_user_code.py similarity index 95% rename from config/obsw_user_code.py rename to config/tmtcc_user_code.py index 7091926..1f2f325 100644 --- a/config/obsw_user_code.py +++ b/config/tmtcc_user_code.py @@ -42,7 +42,7 @@ def global_setup_hook(): def global_setup_hook_robin(): - from config.obsw_config import get_glob_com_if, set_glob_apid + from config.tmtcc_config import get_glob_com_if, set_glob_apid if get_glob_com_if() == ComInterfaces.Ethernet: # Configure APID for FSFW example. Set this back to 0x73 for STM32! set_glob_apid(0xEF) diff --git a/core/tmtc_backend.py b/core/tmtc_backend.py index 56247d9..89fa323 100644 --- a/core/tmtc_backend.py +++ b/core/tmtc_backend.py @@ -6,9 +6,9 @@ from multiprocessing import Process from collections import deque from typing import Tuple, Union -from config import obsw_config as g +from config import tmtcc_config as g from config.tmtcc_definitions import ModeList -from config.obsw_user_code import command_preparation_hook +from config.tmtcc_user_code import command_preparation_hook from tmtc_core.tmtc_core_definitions import ComInterfaces from tmtc_core.utility.obsw_logger import get_logger diff --git a/core/tmtc_client_core.py b/core/tmtc_client_core.py index 3508f4e..244a65e 100755 --- a/core/tmtc_client_core.py +++ b/core/tmtc_client_core.py @@ -12,8 +12,8 @@ from PyQt5.QtWidgets import QApplication from config.tmtcc_version import SW_VERSION, SW_SUBVERSION from tmtc_core.utility.obsw_logger import set_tmtc_logger, get_logger -from config.obsw_config import set_globals -import config.obsw_config as g +from config.tmtcc_config import set_globals +import config.tmtcc_config as g from core.tmtc_backend import TmTcHandler from core.tmtc_frontend import TmTcFrontend from utility.obsw_args_parser import parse_input_arguments diff --git a/core/tmtc_frontend.py b/core/tmtc_frontend.py index 0461209..054b1dd 100644 --- a/core/tmtc_frontend.py +++ b/core/tmtc_frontend.py @@ -14,7 +14,7 @@ from PyQt5.QtWidgets import * from PyQt5.QtGui import QPixmap, QIcon from core.tmtc_backend import TmTcHandler -from config import obsw_config +from config import tmtcc_config from tmtc_core.tmtc_core_definitions import ComInterfaces from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand @@ -29,7 +29,7 @@ TODO: Make it look nicer. Add SOURCE or KSat logo. class TmTcFrontend(QMainWindow): - # TODO: this list should probably be inside an enum in the obsw_config.py + # TODO: this list should probably be inside an enum in the tmtcc_config.py serviceList = [2, 3, 5, 8, 9, 17, 20, 200, "Dummy", "GPS0", "GPS1"] # , "Error"] service_test_button: QPushButton @@ -50,14 +50,14 @@ class TmTcFrontend(QMainWindow): # Also, when changing ComIF, ensure that old ComIF is closed (e.g. with printout) # Lock all other elements while ComIF is invalid. self.tmtc_handler.initialize() - obsw_config.G_SERVICE = 17 - obsw_config.G_COM_IF = obsw_config.ComInterfaces.QEMU + tmtcc_config.G_SERVICE = 17 + tmtcc_config.G_COM_IF = tmtcc_config.ComInterfaces.QEMU def prepare_start(self, args: any) -> Process: return Process(target=self.start_ui) def service_index_changed(self, index: int): - obsw_config.G_SERVICE = self.serviceList[index] + tmtcc_config.G_SERVICE = self.serviceList[index] LOGGER.info("service_test_mode_selection updated: " + str(self.serviceList[index])) def single_command_set_service(self, value): @@ -71,8 +71,8 @@ class TmTcFrontend(QMainWindow): def start_service_test_clicked(self): LOGGER.info("start service test button pressed") - LOGGER.info("start testing service: " + str(obsw_config.G_SERVICE)) - self.tmtc_handler.mode = obsw_config.ModeList.ServiceTestMode + LOGGER.info("start testing service: " + str(tmtcc_config.G_SERVICE)) + self.tmtc_handler.mode = tmtcc_config.ModeList.ServiceTestMode # start the action in a new process p = threading.Thread(target=self.handle_tm_tc_action) p.start() @@ -99,7 +99,7 @@ class TmTcFrontend(QMainWindow): ssc=self.single_command_ssc) self.tmtc_handler.single_command_package = command.pack_command_tuple() - self.tmtc_handler.mode = obsw_config.ModeList.SingleCommandMode + self.tmtc_handler.mode = tmtcc_config.ModeList.SingleCommandMode # start the action in a new process p = threading.Thread(target=self.handle_tm_tc_action) p.start() @@ -135,23 +135,23 @@ class TmTcFrontend(QMainWindow): row += 1 checkbox_console = QCheckBox("print output to console") - checkbox_console.setChecked(obsw_config.G_PRINT_TM) + checkbox_console.setChecked(tmtcc_config.G_PRINT_TM) checkbox_console.stateChanged.connect(checkbox_console_print) checkbox_log = QCheckBox("print output to log file") - checkbox_log.setChecked(obsw_config.G_PRINT_TO_FILE) + checkbox_log.setChecked(tmtcc_config.G_PRINT_TO_FILE) checkbox_log.stateChanged.connect(checkbox_log_print) checkbox_raw_tm = QCheckBox("print all raw TM data directly") - checkbox_raw_tm.setChecked(obsw_config.G_PRINT_RAW_TM) + checkbox_raw_tm.setChecked(tmtcc_config.G_PRINT_RAW_TM) checkbox_raw_tm.stateChanged.connect(checkbox_print_raw_data) checkbox_hk = QCheckBox("print hk data") - checkbox_hk.setChecked(obsw_config.G_PRINT_HK_DATA) + checkbox_hk.setChecked(tmtcc_config.G_PRINT_HK_DATA) checkbox_hk.stateChanged.connect(checkbox_print_hk_data) checkbox_short = QCheckBox("short display mode") - checkbox_short.setChecked(obsw_config.G_DISPLAY_MODE == "short") + checkbox_short.setChecked(tmtcc_config.G_DISPLAY_MODE == "short") checkbox_short.stateChanged.connect(checkbox_short_display_mode) grid.addWidget(checkbox_log, row, 0, 1, 1) @@ -179,7 +179,7 @@ class TmTcFrontend(QMainWindow): grid.addWidget(spin_timeout, row, 0, 1, 1) spin_timeout_factor = QDoubleSpinBox() - spin_timeout_factor.setValue(obsw_config.G_TC_SEND_TIMEOUT_FACTOR) + spin_timeout_factor.setValue(tmtcc_config.G_TC_SEND_TIMEOUT_FACTOR) # TODO: set sensible min/max values spin_timeout_factor.setSingleStep(0.1) spin_timeout_factor.setMinimum(0.25) @@ -211,9 +211,9 @@ class TmTcFrontend(QMainWindow): grid.addWidget(QLabel("Communication Interface:"), row, 0, 1, 1) com_if_comboBox = QComboBox() # add all possible ComIFs to the comboBox - for comIf in obsw_config.ComInterfaces: + for comIf in tmtcc_config.ComInterfaces: com_if_comboBox.addItem(comIf.name) - com_if_comboBox.setCurrentIndex(obsw_config.G_COM_IF.value) + com_if_comboBox.setCurrentIndex(tmtcc_config.G_COM_IF.value) com_if_comboBox.currentIndexChanged.connect(com_if_index_changed) grid.addWidget(com_if_comboBox, row, 1, 1, 1) row += 1 @@ -225,7 +225,7 @@ class TmTcFrontend(QMainWindow): comboBox = QComboBox() for service in self.serviceList: comboBox.addItem("Service - " + str(service)) - comboBox.setCurrentIndex(self.serviceList.index(obsw_config.G_SERVICE)) + comboBox.setCurrentIndex(self.serviceList.index(tmtcc_config.G_SERVICE)) comboBox.currentIndexChanged.connect(self.service_index_changed) grid.addWidget(comboBox, row, 0, 1, 1) @@ -319,49 +319,49 @@ class SingleCommandTable(QTableWidget): self.setItem(0, 2, QTableWidgetItem("20")) def com_if_index_changed(index: int): - obsw_config.G_COM_IF = ComInterfaces(index) - LOGGER.info("com if updated: " + str(obsw_config.G_COM_IF)) + tmtcc_config.G_COM_IF = ComInterfaces(index) + LOGGER.info("com if updated: " + str(tmtcc_config.G_COM_IF)) def checkbox_console_print(state: int): LOGGER.info(["enabled", "disabled"][state == 0] + " console print") - obsw_config.G_PRINT_TM = state == 0 + tmtcc_config.G_PRINT_TM = state == 0 def checkbox_log_print(state: int): LOGGER.info(["enabled", "disabled"][state == 0] + " print to log") - obsw_config.G_PRINT_TO_FILE = state == 0 + tmtcc_config.G_PRINT_TO_FILE = state == 0 def checkbox_print_raw_data(state: int): LOGGER.info(["enabled", "disabled"][state == 0] + " printing of raw data") - obsw_config.G_PRINT_RAW_TM = state == 0 + tmtcc_config.G_PRINT_RAW_TM = state == 0 def checkbox_print_hk_data(state: int): LOGGER.info(["enabled", "disabled"][state == 0] + " printing of hk data") - obsw_config.G_PRINT_HK_DATA = state == 0 + tmtcc_config.G_PRINT_HK_DATA = state == 0 def checkbox_short_display_mode(state: int): LOGGER.info(["enabled", "disabled"][state == 0] + " short display mode") - obsw_config.G_DISPLAY_MODE = ["short", "long"][state == 0] + tmtcc_config.G_DISPLAY_MODE = ["short", "long"][state == 0] def number_timeout(value: float): LOGGER.info("tm timeout changed to: " + str(value)) - obsw_config.G_TM_TIMEOUT = value + tmtcc_config.G_TM_TIMEOUT = value def number_timeout_factor(value: float): LOGGER.info("tm timeout factor changed to: " + str(value)) - obsw_config.G_TC_SEND_TIMEOUT_FACTOR = value + tmtcc_config.G_TC_SEND_TIMEOUT_FACTOR = value def ip_change_client(value): LOGGER.info("client ip changed: " + value) - obsw_config.G_REC_ADDRESS = (value, 2008) + tmtcc_config.G_REC_ADDRESS = (value, 2008) def ip_change_board(value): LOGGER.info("board ip changed: " + value) - obsw_config.G_SEND_ADDRESS = (value, 7) \ No newline at end of file + tmtcc_config.G_SEND_ADDRESS = (value, 7) \ No newline at end of file diff --git a/tc/obsw_image_handler.py b/tc/obsw_image_handler.py index 6f32168..57967f2 100644 --- a/tc/obsw_image_handler.py +++ b/tc/obsw_image_handler.py @@ -4,7 +4,7 @@ from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque from tc.obsw_tc_service8 import make_action_id from tc.obsw_tc_service20 import pack_boolean_parameter_setting from tmtc_core.utility.obsw_logger import get_logger -from config.obsw_config import SW_IMAGE_HANDLER_ID +from config.tmtcc_config import SW_IMAGE_HANDLER_ID LOGGER = get_logger() diff --git a/tc/obsw_pus_tc_packer.py b/tc/obsw_pus_tc_packer.py index c4d281e..92ff578 100644 --- a/tc/obsw_pus_tc_packer.py +++ b/tc/obsw_pus_tc_packer.py @@ -24,7 +24,7 @@ from tc.obsw_tc_gps import pack_gps_test_into from tc.obsw_tc_core import pack_core_command from tmtc_core.utility.obsw_logger import get_logger -import config.obsw_config as g +import config.tmtcc_config as g from collections import deque from typing import Union diff --git a/tc/obsw_tc_core.py b/tc/obsw_tc_core.py index be4a2fa..58ec190 100644 --- a/tc/obsw_tc_core.py +++ b/tc/obsw_tc_core.py @@ -1,6 +1,6 @@ from typing import Deque -from config.obsw_config import CORE_CONTROLLER_ID +from config.tmtcc_config import CORE_CONTROLLER_ID from tc.obsw_tc_service8 import make_action_id from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand diff --git a/tc/obsw_tc_gps.py b/tc/obsw_tc_gps.py index 1a047bf..f97b50f 100644 --- a/tc/obsw_tc_gps.py +++ b/tc/obsw_tc_gps.py @@ -9,7 +9,7 @@ from tc.obsw_pus_tc_packer import TcQueueT, PusTelecommand from tc.obsw_tc_service2 import pack_mode_data -import config.obsw_config as g +import config.tmtcc_config as g def pack_gps_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: diff --git a/tc/obsw_tc_service2.py b/tc/obsw_tc_service2.py index 22906fb..4872fb7 100644 --- a/tc/obsw_tc_service2.py +++ b/tc/obsw_tc_service2.py @@ -7,7 +7,7 @@ """ import struct -import config.obsw_config as g +import config.tmtcc_config as g from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque from tc.obsw_tc_service200 import pack_mode_data diff --git a/tc/obsw_tc_service20.py b/tc/obsw_tc_service20.py index 149fb9c..65b1d32 100644 --- a/tc/obsw_tc_service20.py +++ b/tc/obsw_tc_service20.py @@ -8,7 +8,7 @@ import struct from typing import Deque -import config.obsw_config as g +import config.tmtcc_config as g from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, TcQueueT from tmtc_core.utility.obsw_logger import get_logger from tc.obsw_tc_service200 import pack_mode_data diff --git a/tc/obsw_tc_service200.py b/tc/obsw_tc_service200.py index cf7f5a1..a66d662 100644 --- a/tc/obsw_tc_service200.py +++ b/tc/obsw_tc_service200.py @@ -7,7 +7,7 @@ """ from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand from tc.obsw_pus_tc_packer import TcQueueT -import config.obsw_config as g +import config.tmtcc_config as g import struct diff --git a/tc/obsw_tc_service23_sdcard.py b/tc/obsw_tc_service23_sdcard.py index b89ae1b..9770a40 100644 --- a/tc/obsw_tc_service23_sdcard.py +++ b/tc/obsw_tc_service23_sdcard.py @@ -4,7 +4,7 @@ Created: 21.01.2020 07:48 @author: Jakob Meier """ -import config.obsw_config as g +import config.tmtcc_config as g from typing import Deque, Union from tc.obsw_pus_tc_packer import PusTelecommand, TcQueueT diff --git a/tc/obsw_tc_service3.py b/tc/obsw_tc_service3.py index 4391b04..9391f07 100644 --- a/tc/obsw_tc_service3.py +++ b/tc/obsw_tc_service3.py @@ -8,7 +8,7 @@ import struct from typing import Deque from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand -import config.obsw_config as g +import config.tmtcc_config as g def make_sid(object_id: bytearray, set_id: int) -> bytearray: diff --git a/tc/obsw_tc_service5_17.py b/tc/obsw_tc_service5_17.py index f1c2d68..b602a29 100644 --- a/tc/obsw_tc_service5_17.py +++ b/tc/obsw_tc_service5_17.py @@ -6,7 +6,7 @@ @author R. Mueller @date 02.05.2020 """ -import config.obsw_config as g +import config.tmtcc_config as g from tc.obsw_pus_tc_packer import TcQueueT, PusTelecommand diff --git a/tc/obsw_tc_service8.py b/tc/obsw_tc_service8.py index 6449fcf..ec14574 100644 --- a/tc/obsw_tc_service8.py +++ b/tc/obsw_tc_service8.py @@ -8,7 +8,7 @@ import struct from typing import Deque -import config.obsw_config as g +import config.tmtcc_config as g from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand from tc.obsw_tc_service200 import pack_mode_data diff --git a/tc/obsw_tc_utility.py b/tc/obsw_tc_utility.py index 9f21283..7d0dc54 100644 --- a/tc/obsw_tc_utility.py +++ b/tc/obsw_tc_utility.py @@ -2,7 +2,7 @@ from typing import Union from tmtc_core.tc.obsw_pus_tc_base import TcQueueT from tc.obsw_tc_service8 import generate_action_command -from config.obsw_config import LED_TASK_ID +from config.tmtcc_config import LED_TASK_ID def pack_utility_command(service_queue: TcQueueT, op_code: Union[str, int]): diff --git a/test/obsw_module_test.py b/test/obsw_module_test.py index fbdd1b6..6cc58c6 100644 --- a/test/obsw_module_test.py +++ b/test/obsw_module_test.py @@ -44,7 +44,7 @@ from abc import abstractmethod from collections import deque from typing import Deque -from config import obsw_config as g +from config import tmtcc_config as g from tc.obsw_pus_tc_packer import pack_dummy_device_test_into from tmtc_core.tc.obsw_pus_tc_base import PusTcInfoQueueT, TcDictionaryKeys from tm.obsw_tm_service_1 import PusPacketInfoService1T diff --git a/test/obsw_pus_service_test.py b/test/obsw_pus_service_test.py index 16137a6..080ef2f 100644 --- a/test/obsw_pus_service_test.py +++ b/test/obsw_pus_service_test.py @@ -12,7 +12,7 @@ from test.obsw_module_test import TestService, PusTmInfoQueueT, TmDictionaryKeys from tmtc_core.tc.obsw_pus_tc_base import PusTcInfoQueueT from tc.obsw_pus_tc_packer import pack_service17_test_into, pack_service5_test_into, \ pack_service2_test_into, pack_service8_test_into, pack_service200_test_into, pack_service20_test_into -import config.obsw_config as g +import config.tmtcc_config as g from tmtc_core.utility.obsw_logger import get_logger LOGGER = get_logger() diff --git a/tm/obsw_tm_service_3.py b/tm/obsw_tm_service_3.py index ddb4376..732cadf 100644 --- a/tm/obsw_tm_service_3.py +++ b/tm/obsw_tm_service_3.py @@ -10,7 +10,7 @@ from tmtc_core.tm.obsw_pus_tm_base import PusTelemetry from typing import Type from tmtc_core.utility.obsw_logger import get_logger import struct -import config.obsw_config as g +import config.tmtcc_config as g LOGGER = get_logger() diff --git a/tmtc_core b/tmtc_core index 440b94c..8496418 160000 --- a/tmtc_core +++ b/tmtc_core @@ -1 +1 @@ -Subproject commit 440b94ce454f50d4078962806ef03942f56d466c +Subproject commit 8496418c0933eab08943aa4f018689785b78445e diff --git a/utility/obsw_binary_uploader.py b/utility/obsw_binary_uploader.py index 5520006..f27ded9 100644 --- a/utility/obsw_binary_uploader.py +++ b/utility/obsw_binary_uploader.py @@ -16,7 +16,7 @@ from typing import Deque from tmtc_core.comIF.obsw_com_interface import CommunicationInterface from utility.obsw_file_transfer_helper import FileTransferHelper -import config.obsw_config as g +import config.tmtcc_config as g from tmtc_core.utility.obsw_tmtc_printer import TmTcPrinter, DisplayMode from tmtc_core.utility.obsw_logger import get_logger from tmtc_core.sendreceive.obsw_tm_listener import TmListener diff --git a/utility/obsw_file_transfer_helper.py b/utility/obsw_file_transfer_helper.py index 52743ac..69d9e82 100644 --- a/utility/obsw_file_transfer_helper.py +++ b/utility/obsw_file_transfer_helper.py @@ -1,7 +1,7 @@ from enum import Enum import math -from config.obsw_config import SD_CARD_HANDLER_ID +from config.tmtcc_config import SD_CARD_HANDLER_ID from tmtc_core.tc.obsw_pus_tc_base import TcQueueT, PusTelecommand from tc.obsw_tc_service23_sdcard import \ calculate_allowed_file_data_size, generate_rm_file_srv23_2_packet, \ -- GitLab