diff --git a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml index edc30694c5b1a4ed02b2d773a89fef28ccb4c638..e9f787a3e5b7a3c42fbc6e0027a332b173ebcb46 100644 --- a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml @@ -13,7 +13,7 @@ <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> - <option name="PARAMETERS" value="-m 5 -c 1 --hk" /> + <option name="PARAMETERS" value="-m 5 -c 1 --hk --np" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="true" /> <option name="MODULE_MODE" value="false" /> diff --git a/comIF/obsw_com_interface.py b/comIF/obsw_com_interface.py index 6f3f80debfbdc73447743f535f5d546cc5d49e06..50b959f764f4e51dac6384e6c5a180e0a6bcaadc 100644 --- a/comIF/obsw_com_interface.py +++ b/comIF/obsw_com_interface.py @@ -10,7 +10,7 @@ Description: Generic Communication Interface. Defines the syntax of the communic from abc import abstractmethod from typing import TypeVar, Tuple, Union from tm.obsw_pus_tm_base import PusTmQueueT, PusTmTupleQueueT, PusTmInfoQueueT, PusTmListT -from utility.obsw_tmtc_printer import TmTcPrinterT +from utility.obsw_tmtc_printer import TmTcPrinter from tc.obsw_pus_tc_base import PusTcInfoT ComIfT = TypeVar('ComIfT', bound='CommunicationInterface') @@ -24,7 +24,7 @@ class CommunicationInterface: Generic form of a communication interface to separate communication logic from the underlying interface. """ - def __init__(self, tmtc_printer: TmTcPrinterT): + def __init__(self, tmtc_printer: TmTcPrinter): self.tmtc_printer = tmtc_printer @abstractmethod diff --git a/comIF/obsw_ethernet_com_if.py b/comIF/obsw_ethernet_com_if.py index 647dc1c908f8433c0886660bae2b7faa8fe5592d..b49cb9e4f480e3227d756688de28036e7bdba246 100644 --- a/comIF/obsw_ethernet_com_if.py +++ b/comIF/obsw_ethernet_com_if.py @@ -71,7 +71,8 @@ class EthernetComIF(CommunicationInterface): packets = self.receive_telemetry() for packet in packets: packet_info = packet.pack_tm_information() - self.tmtc_printer.print_telemetry(packet) + if g.G_PRINT_TM: + self.tmtc_printer.print_telemetry(packet) tmInfoQueue.append(packet_info) return tmInfoQueue @@ -87,7 +88,8 @@ class EthernetComIF(CommunicationInterface): for packet in packet_list: packet_info = packet.pack_tm_information() tm_tuple = (packet_info, packet) - self.tmtc_printer.print_telemetry(packet) + if g.G_PRINT_TM: + self.tmtc_printer.print_telemetry(packet) tmTupleQueue.append(tm_tuple) return tmTupleQueue diff --git a/comIF/obsw_serial_com_if.py b/comIF/obsw_serial_com_if.py index 9be78d7550a616471d7a335efac7f40a7e373bde..e7592438ed9002472e1bfc7c67a071376e63b731 100644 --- a/comIF/obsw_serial_com_if.py +++ b/comIF/obsw_serial_com_if.py @@ -11,6 +11,7 @@ import logging from typing import Tuple, List, Union, Optional import serial +import config.obsw_config as g from comIF.obsw_com_interface import CommunicationInterface, PusTmQueueT from utility.obsw_tmtc_printer import TmTcPrinterT from tm.obsw_pus_tm_factory import pus_telemetry_factory @@ -57,13 +58,15 @@ class SerialComIF(CommunicationInterface): return packet_list return [] + # TODO: DO NOT PRINT HERE! this will block the listener thread!!! def poll_interface(self, parameters: any = 0) -> Tuple[bool, PusTmListT]: if self.data_available(): pus_data_list, number_of_packets = self.__poll_pus_packets() packet_list = [] for counter in range(0, number_of_packets): packet = pus_telemetry_factory(pus_data_list[counter]) - self.tmtc_printer.print_telemetry(packet) + if g.G_PRINT_TM: + self.tmtc_printer.print_telemetry(packet) packet_list.append(packet) return True, packet_list return False, [] diff --git a/config/obsw_config.py b/config/obsw_config.py index 09923ffd82c975dce92452bd119a29bf6c681844..81f87e6ba9785d2c34ae08a46c941ee630866beb 100644 --- a/config/obsw_config.py +++ b/config/obsw_config.py @@ -81,6 +81,7 @@ G_SEND_ADDRESS = (0, 0) G_PRINT_TO_FILE = True G_PRINT_HK_DATA = False G_PRINT_RAW_TM = False +G_PRINT_TM = True """ These objects are set for the Unit Test, no better solution found yet @@ -94,7 +95,7 @@ G_TMTC_PRINTER = None def setGlobals(args): global G_REC_ADDRESS, G_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, G_DISPLAY_MODE,\ G_COM_IF, G_COM_PORT, G_SERIAL_TIMEOUT, G_TM_TIMEOUT, G_TC_SEND_TIMEOUT_FACTOR, \ - G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM + G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM if args.mode == 0: print("GUI mode not implemented yet !") if args.shortDisplayMode: @@ -143,7 +144,8 @@ def setGlobals(args): G_SEND_ADDRESS = sendAddressToSet G_MODE_ID = G_MODE_ID G_PRINT_HK_DATA = args.print_hk - G_PRINT_TO_FILE = args.print_file + G_PRINT_TM = args.print_tm + G_PRINT_TO_FILE = args.print_log G_PRINT_RAW_TM = args.rawDataPrint G_COM_PORT = args.com_port G_TM_TIMEOUT = args.tm_timeout diff --git a/test/obsw_pus_service_test.py b/test/obsw_pus_service_test.py index f918d92afed62122221e3e88d0ec3b8fbf4ddde6..2e0777e460988d700b43e2e9d9897f736060f6be 100644 --- a/test/obsw_pus_service_test.py +++ b/test/obsw_pus_service_test.py @@ -25,7 +25,7 @@ class TestService2(TestService): print("Testing Service 2") # all commands must be sent sequentially, not as a burst cls.wait_intervals = [1, 2, 3, 4] - cls.wait_time = [2.5, 2.5, 2.5, 3] + cls.wait_time = [2.0, 2.0, 2.0, 2.0] pack_service2_test_into(cls.test_queue) def test_service2(self): @@ -104,7 +104,7 @@ class TestService8(TestService): super().setUpClass() print("Testing Service 8") cls.wait_intervals = [1, 2, 3, 4] - cls.wait_time = [1.5, 1.5, 1.5, 1.5] + cls.wait_time = [1.5, 1.0, 1.0, 1.0] cls.data_reply_count = 0 pack_service8_test_into(cls.test_queue) diff --git a/utility/obsw_args_parser.py b/utility/obsw_args_parser.py index 71ab6a65e98ba82b0561913333f73a7489287bec..cd74990ee638d864acfa135568e2ca5a16ed68aa 100644 --- a/utility/obsw_args_parser.py +++ b/utility/obsw_args_parser.py @@ -34,7 +34,10 @@ def parse_input_arguments(): '-t', '--tm_timeout', type=float, help='TM Timeout when listening to verification sequence.' ' Default: 12, 6(Serial)', default=6.0) arg_parser.add_argument( - '--np', dest='print_file', help='Supply --np to suppress print output to log files.', + '--nl', dest='print_log', help='Supply --nl to suppress print output to log files.', + action='store_false') + arg_parser.add_argument( + '--np', dest='print_tm', help='Supply --np to suppress print output to console.', action='store_false') arg_parser.add_argument( '-o', '--tc_timeout_factor', type=float, help='TC Timeout Factor. Multiplied with '