diff --git a/comIF/obsw_com_config.py b/comIF/obsw_com_config.py index a267d48e3b962b45064679b2862a201cfe8b039e..4e50bf104b231f8f25418d75eb076d3bbb213bc7 100644 --- a/comIF/obsw_com_config.py +++ b/comIF/obsw_com_config.py @@ -22,8 +22,6 @@ def set_communication_interface(tmtc_printer: TmTcPrinter) -> CommunicationInter :param tmtc_printer: TmTcPrinter object. :return: CommunicationInterface object """ - print("test") - print(g.G_COM_IF) try: if g.G_COM_IF == g.ComIF.Ethernet: communication_interface = EthernetComIF( @@ -38,7 +36,6 @@ def set_communication_interface(tmtc_printer: TmTcPrinter) -> CommunicationInter tmtc_printer=tmtc_printer, com_port=com_port, baud_rate=baud_rate, serial_timeout=g.G_SERIAL_TIMEOUT) elif g.G_COM_IF == g.ComIF.QEMU: - print("hallo") communication_interface = QEMUComIF( tmtcPrinter=tmtc_printer, tmTimeout=g.G_TM_TIMEOUT, tcTimeoutFactor=g.G_TC_SEND_TIMEOUT_FACTOR) diff --git a/tc/obsw_pus_tc_packer.py b/tc/obsw_pus_tc_packer.py index ccb66f26ee18f94f7f23e5b8ab18c8b4b8b9808d..9dcd2c0374e6dfa390947e18ed9c8063c806490b 100644 --- a/tc/obsw_pus_tc_packer.py +++ b/tc/obsw_pus_tc_packer.py @@ -18,11 +18,13 @@ from tc.obsw_tc_service2 import pack_service2_test_into from tc.obsw_tc_service3 import pack_service3_test_into from tc.obsw_tc_service8 import pack_service8_test_into from tc.obsw_tc_service200 import packModeData, pack_service200_test_into +from utility.obsw_logger import get_logger import config.obsw_config as g from datetime import datetime from collections import deque from typing import Union +LOGGER = get_logger() def service_test_select(service: Union[int, str], service_queue: TcQueueT) -> TcQueueT: if service == 2: @@ -59,15 +61,15 @@ def service_test_select(service: Union[int, str], service_queue: TcQueueT) -> Tc def pack_service5_test_into(tc_queue: TcQueueT) -> TcQueueT: tc_queue.appendleft(("print", "Testing Service 5")) # disable events - tc_queue.appendleft(("print", "\r\nTesting Service 5: Disable event")) + tc_queue.appendleft(("print", "Testing Service 5: Disable event")) command = PusTelecommand(service=5, subservice=6, ssc=500) tc_queue.appendleft(command.pack_command_tuple()) # trigger event - tc_queue.appendleft(("print", "\r\nTesting Service 5: Trigger event")) + tc_queue.appendleft(("print", "Testing Service 5: Trigger event")) command = PusTelecommand(service=17, subservice=128, ssc=510) tc_queue.appendleft(command.pack_command_tuple()) # enable event - tc_queue.appendleft(("print", "\r\nTesting Service 5: Enable event")) + tc_queue.appendleft(("print", "Testing Service 5: Enable event")) command = PusTelecommand(service=5, subservice=5, ssc=520) tc_queue.appendleft(command.pack_command_tuple()) # trigger event @@ -87,17 +89,17 @@ def pack_service9_test_into(tc_queue: TcQueueT) -> TcQueueT: time_test1 = time_test_ascii_code_a.encode('ascii') time_test2 = time_test_ascii_code_b.encode('ascii') time_test3 = time_test_current_time.encode('ascii') - print("Time Code 1 :" + str(time_test1)) - print("Time Code 2 :" + str(time_test2)) - print("Time Code 3 :" + str(time_test3) + "\r") + LOGGER.info("Time Code 1 :%s", time_test1) + LOGGER.info("Time Code 2 :%s", time_test2) + LOGGER.info("Time Code 3 :%s", time_test3) # time setting - tc_queue.appendleft(("print", "\r\nTesting Service 9: Testing timecode A")) + tc_queue.appendleft(("print", "Testing Service 9: Testing timecode A")) command = PusTelecommand(service=9, subservice=128, ssc=900, app_data=bytearray(time_test1)) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("print", "\r\nTesting Service 9: Testing timecode B")) + tc_queue.appendleft(("print", "Testing Service 9: Testing timecode B")) command = PusTelecommand(service=9, subservice=128, ssc=910, app_data=bytearray(time_test2)) tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("print", "\r\nTesting Service 9: Testing timecode Current Time")) + tc_queue.appendleft(("print", "Testing Service 9: Testing timecode Current Time")) command = PusTelecommand(service=9, subservice=128, ssc=920, app_data=bytearray(time_test3)) tc_queue.appendleft(command.pack_command_tuple()) # TODO: Add other time formats here @@ -107,7 +109,7 @@ def pack_service9_test_into(tc_queue: TcQueueT) -> TcQueueT: def pack_service17_test_into(tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing Service 17\r")) + tc_queue.appendleft(("print", "Testing Service 17")) # ping test tc_queue.appendleft(("print", "Testing Service 17: Ping Test")) command = PusTelecommand(service=17, subservice=1, ssc=1700) @@ -129,15 +131,15 @@ def pack_dummy_device_test_into(tc_queue: TcQueueT) -> TcQueueT: # Object ID: Dummy Device object_id = g.DUMMY_DEVICE_ID # Set On Mode - tc_queue.appendleft(("print", "\n\rTesting Service Dummy: Set On")) + tc_queue.appendleft(("print", "Testing Service Dummy: Set On")) mode_data = packModeData(object_id, 1, 0) command = PusTelecommand(service=200, subservice=1, ssc=1, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # Test Service 2 commands - tc_queue.appendleft(("print", "\n\rTesting Service Dummy: Service 2")) + tc_queue.appendleft(("print", "Testing Service Dummy: Service 2")) pack_service2_test_into(tc_queue, True) # Test Service 8 - tc_queue.appendleft(("print", "\n\rTesting Service Dummy: Service 8")) + tc_queue.appendleft(("print", "Testing Service Dummy: Service 8")) pack_service8_test_into(tc_queue, True) tc_queue.appendleft(("print", "\r")) tc_queue.appendleft(("export", "log/tmtc_log_service_dummy.txt")) @@ -153,12 +155,12 @@ def pack_gps_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: gps_string = "unknown" tc_queue.appendleft(("print", "Testing " + gps_string + " Device")) # Set Mode Off - tc_queue.appendleft(("print", "\n\rTesting " + gps_string + ": Set Off")) + tc_queue.appendleft(("print", "Testing " + gps_string + ": Set Off")) mode_data = packModeData(object_id, 0, 0) command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # Set Mode On - tc_queue.appendleft(("print", "\n\rTesting " + gps_string + ": Set On")) + tc_queue.appendleft(("print", "Testing " + gps_string + ": Set On")) mode_data = packModeData(object_id, 1, 0) command = PusTelecommand(service=200, subservice=1, ssc=12, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) @@ -166,22 +168,22 @@ def pack_gps_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: sid_gps = 0 if object_id == g.GPS0_ObjectId: sid_gps = g.GPS0_SID - tc_queue.appendleft(("print", "\r\nTesting " + gps_string + ": Enable HK Reporting")) + tc_queue.appendleft(("print", "Testing " + gps_string + ": Enable HK Reporting")) command = PusTelecommand(service=3, subservice=5, ssc=13, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) elif object_id == g.GPS1_ObjectId: sid_gps = g.GPS1_SID - tc_queue.appendleft(("print", "\r\nTesting " + gps_string + ": Enable HK Reporting")) + tc_queue.appendleft(("print", "Testing " + gps_string + ": Enable HK Reporting")) command = PusTelecommand(service=3, subservice=5, ssc=14, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) # pack wait interval until mode is on and a few gps replies have been received tc_queue.appendleft(("wait", 5)) # Disable HK reporting - tc_queue.appendleft(("print", "\r\nTesting Service 3: Disable " + gps_string + " definition")) + tc_queue.appendleft(("print", "Testing Service 3: Disable " + gps_string + " definition")) command = PusTelecommand(service=3, subservice=6, ssc=15, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) # Set Mode Off - tc_queue.appendleft(("print", "\n\rTesting " + gps_string + ": Set Off")) + tc_queue.appendleft(("print", "Testing " + gps_string + ": Set Off")) mode_data = packModeData(object_id, 0, 0) command = PusTelecommand(service=200, subservice=1, ssc=13, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/tc/obsw_tc_service2.py b/tc/obsw_tc_service2.py index 717c88f7190009bf03f3ce04d8a8eaa665f81524..75bceaa4225a49a7ff2076d9da9a24846fd28931 100644 --- a/tc/obsw_tc_service2.py +++ b/tc/obsw_tc_service2.py @@ -19,30 +19,30 @@ def pack_service2_test_into(tc_queue: Deque, called_externally: bool = False) -> object_id = g.DUMMY_DEVICE_ID # dummy device # don't forget to set object mode raw (G_SERVICE 200) before calling this ! # Set Raw Mode - tc_queue.appendleft(("print", "\r\nTesting Service 2: Setting Raw Mode")) + tc_queue.appendleft(("print", "Testing Service 2: Setting Raw Mode")) mode_data = packModeData(object_id, 3, 0) command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data) tc_queue.appendleft(command.pack_command_tuple()) # toggle wiretapping raw - tc_queue.appendleft(("print", "\r\nTesting Service 2: Toggling Wiretapping Raw")) + tc_queue.appendleft(("print", "Testing Service 2: Toggling Wiretapping Raw")) wiretapping_toggle_data = pack_wiretapping_mode(object_id, 1) toggle_wiretapping_on_command = PusTelecommand(service=2, subservice=129, ssc=200, app_data=wiretapping_toggle_data) tc_queue.appendleft(toggle_wiretapping_on_command.pack_command_tuple()) # send raw command, _tm_data should be returned via TM[2,130] and TC[2,131] - tc_queue.appendleft(("print", "\r\nTesting Service 2: Sending Raw Command")) + tc_queue.appendleft(("print", "Testing Service 2: Sending Raw Command")) raw_command = g.DUMMY_COMMAND_1 raw_data = object_id + raw_command raw_command = PusTelecommand(service=2, subservice=128, ssc=201, app_data=raw_data) tc_queue.appendleft(raw_command.pack_command_tuple()) # toggle wiretapping off - tc_queue.appendleft(("print", "\r\nTesting Service 2: Toggle Wiretapping Off")) + tc_queue.appendleft(("print", "Testing Service 2: Toggle Wiretapping Off")) wiretapping_toggle_data = pack_wiretapping_mode(object_id, 0) toggle_wiretapping_off_command = PusTelecommand(service=2, subservice=129, ssc=204, app_data=wiretapping_toggle_data) tc_queue.appendleft(toggle_wiretapping_off_command.pack_command_tuple()) # send raw command which should be returned via TM[2,130] - tc_queue.appendleft(("print", "\r\nTesting Service 2: Send second raw command")) + tc_queue.appendleft(("print", "Testing Service 2: Send second raw command")) command = PusTelecommand(service=2, subservice=128, ssc=205, app_data=raw_data) tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(("print", "\r")) diff --git a/tc/obsw_tc_service200.py b/tc/obsw_tc_service200.py index 9b08445b1c42f89698ebc949f62eb8698cbed49d..6862d3e90cb038921f1605eae46f8c5cf41b4eaa 100644 --- a/tc/obsw_tc_service200.py +++ b/tc/obsw_tc_service200.py @@ -22,22 +22,22 @@ def pack_service200_test_into(tcQueue: TcQueueT) -> TcQueueT: # Object ID: Dummy Device objectId = g.DUMMY_DEVICE_ID # Set On Mode - tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode On")) + tcQueue.appendleft(("print", "Testing Service 200: Set Mode On")) modeData = packModeData(objectId, 1, 0) command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=modeData) tcQueue.appendleft(command.pack_command_tuple()) # Set Normal mode - tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Normal")) + tcQueue.appendleft(("print", "Testing Service 200: Set Mode Normal")) modeData = packModeData(objectId, 2, 0) command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=modeData) tcQueue.appendleft(command.pack_command_tuple()) # Set Raw Mode - tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Raw")) + tcQueue.appendleft(("print", "Testing Service 200: Set Mode Raw")) modeData = packModeData(objectId, 3, 0) command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=modeData) tcQueue.appendleft(command.pack_command_tuple()) # Set Off Mode - tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Off")) + tcQueue.appendleft(("print", "Testing Service 200: Set Mode Off")) modeData = packModeData(objectId, 0, 0) command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=modeData) tcQueue.appendleft(command.pack_command_tuple()) diff --git a/tc/obsw_tc_service3.py b/tc/obsw_tc_service3.py index 43a72e2254f3faac5dfb7f2f864473b189b29cc7..c94856a94cbea3157ddcd8a3c94025c1cfb9549f 100644 --- a/tc/obsw_tc_service3.py +++ b/tc/obsw_tc_service3.py @@ -29,30 +29,30 @@ def pack_service3_test_into(tc_queue: Deque) -> Deque: hkDefinition2 = sid2 + collection_interval + number_of_parameters + p1 + p2 + p3 + p4 + p5 # deleting pre-defined test entry - tc_queue.appendleft(("print", "\r\nTesting Service 3: Deleting pre-defined HK definition")) + tc_queue.appendleft(("print", "Testing Service 3: Deleting pre-defined HK definition")) command = PusTelecommand(service=3, subservice=3, ssc=3000, app_data=sid1) tc_queue.appendleft(command.pack_command_tuple()) # adding pre-defined definition to hk using test pool variables - tc_queue.appendleft(("print", "\r\nTesting Service 3: Adding pre-defined HK definition")) + tc_queue.appendleft(("print", "Testing Service 3: Adding pre-defined HK definition")) command = PusTelecommand(service=3, subservice=1, ssc=3010, app_data=hkDefinition1) tc_queue.appendleft(command.pack_command_tuple()) # adding custom definition to diagnostics using test pool variables - tc_queue.appendleft(("print", "\r\nTesting Service 3: Adding custom diganostics definition")) + tc_queue.appendleft(("print", "Testing Service 3: Adding custom diganostics definition")) command = PusTelecommand(service=3, subservice=2, ssc=3020, app_data=hkDefinition2) tc_queue.appendleft(command.pack_command_tuple()) # enable custom hk definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Enable custom definition")) + tc_queue.appendleft(("print", "Testing Service 3: Enable custom definition")) command = PusTelecommand(service=3, subservice=5, ssc=3030, app_data=sid1) tc_queue.appendleft(command.pack_command_tuple()) # enable custom diag definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Enable custom diagnostics definition")) + tc_queue.appendleft(("print", "Testing Service 3: Enable custom diagnostics definition")) command = PusTelecommand(service=3, subservice=7, ssc=3040, app_data=sid2) tc_queue.appendleft(command.pack_command_tuple()) # enable gps0 - tc_queue.appendleft(("print", "\r\nTesting Service 3: Enable GPS definition")) + tc_queue.appendleft(("print", "Testing Service 3: Enable GPS definition")) command = PusTelecommand(service=3, subservice=5, ssc=3050, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) @@ -60,27 +60,27 @@ def pack_service3_test_into(tc_queue: Deque) -> Deque: tc_queue.appendleft(("wait", 3)) # Disable custom hk definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Disable custom definition")) + tc_queue.appendleft(("print", "Testing Service 3: Disable custom definition")) command = PusTelecommand(service=3, subservice=6, ssc=3060, app_data=sid1) tc_queue.appendleft(command.pack_command_tuple()) # Disable custom diag definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Disable custom diagnostics definition")) + tc_queue.appendleft(("print", "Testing Service 3: Disable custom diagnostics definition")) command = PusTelecommand(service=3, subservice=8, ssc=3070, app_data=sid2) tc_queue.appendleft(command.pack_command_tuple()) # disable gps0 - tc_queue.appendleft(("print", "\r\nTesting Service 3: Disable GPS definition")) + tc_queue.appendleft(("print", "Testing Service 3: Disable GPS definition")) command = PusTelecommand(service=3, subservice=6, ssc=3080, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) # report custom Diag definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Reporting diag definition")) + tc_queue.appendleft(("print", "Testing Service 3: Reporting diag definition")) command = PusTelecommand(service=3, subservice=11, ssc=3100, app_data=sid2) tc_queue.appendleft(command.pack_command_tuple()) # report gps definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Reporting GPS definition")) + tc_queue.appendleft(("print", "Testing Service 3: Reporting GPS definition")) command = PusTelecommand(service=3, subservice=9, ssc=3110, app_data=sid_gps) tc_queue.appendleft(command.pack_command_tuple()) # generate one custom hk definition - tc_queue.appendleft(("print", "\r\nTesting Service 3: Generate one custom hk definition")) + tc_queue.appendleft(("print", "Testing Service 3: Generate one custom hk definition")) command = PusTelecommand(service=3, subservice=27, ssc=3120, app_data=sid1) tc_queue.appendleft(command.pack_command_tuple()) # generate one custom diag definition diff --git a/utility/obsw_args_parser.py b/utility/obsw_args_parser.py index 73756432a4304c9d7c5550fd47135c0eb2965dc0..39c7ea22101b8a148eb8445ff5c64e085e8769f6 100644 --- a/utility/obsw_args_parser.py +++ b/utility/obsw_args_parser.py @@ -54,7 +54,7 @@ def parse_input_arguments(): arg_parser.print_help() args, unknown = arg_parser.parse_known_args() for argument in vars(args): - LOGGER.debug(argument + ": " + str(getattr(args, argument))) + # LOGGER.debug(argument + ": " + str(getattr(args, argument))) pass handle_args(args, unknown) return args diff --git a/utility/obsw_tmtc_printer.py b/utility/obsw_tmtc_printer.py index e887ae948f851fe615f5f5c8edac6fb6b473e267..29ea637fde012672c619e1f331a23241bc948c23 100644 --- a/utility/obsw_tmtc_printer.py +++ b/utility/obsw_tmtc_printer.py @@ -321,6 +321,7 @@ class TmTcPrinter: :return: """ if self.print_tc: + print() if len(tc_packet) == 0: LOGGER.error("TMTC Printer: Empty packet was sent, configuration error") return