Skip to content
Snippets Groups Projects
Commit abcc41a1 authored by Robin Mueller's avatar Robin Mueller
Browse files

some bugfixes

parent 67d4e7de
No related branches found
No related tags found
No related merge requests found
......@@ -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 3 -s 2 -p -c 1" />
<option name="PARAMETERS" value="-m 3 -s 2 -c 1 --COM /dev/ttyUSB1" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
......
......@@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="C:\Users\Robin\NoSyncDokumente\sourceobsw\tmtc\obsw_tmtc_client.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
<option name="PARAMETERS" value="-m 5 -c 1 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
......
......@@ -109,7 +109,7 @@ class CommandSenderReceiver:
self._tmtc_printer.print_string(print_string)
elif queue_entry_first == "export":
export_name = queue_entry_second
self._tmtc_printer.print_to_file(export_name, True)
self._tmtc_printer.print_to_file(export_name, False)
elif queue_entry_first == "timeout":
self._tm_timeout = queue_entry_second
else:
......
......@@ -23,26 +23,26 @@ class MultipleCommandSenderReceiver(SequentialCommandSenderReceiver):
Wait intervals can be specified with wait time between the send bursts.
This is generally done in the separate test classes in UnitTest
"""
def __init__(self, comInterface: CommunicationInterface, tmtcPrinter: TmTcPrinter,
tcQueue: Deque, tmListener: TmListenerT, waitIntervals: list,
waitTime: Union[float, list], printTm: bool):
def __init__(self, com_interface: CommunicationInterface, tmtc_printer: TmTcPrinter,
tc_queue: Deque, tm_listener: TmListenerT, wait_intervals: list,
wait_time: Union[float, list], print_tm: bool):
"""
TCs are sent in burst when applicable. Wait intervals can be specified by supplying
respective arguments
:param comInterface:
:param tmtcPrinter:
:param tcQueue:
:param waitIntervals: List of pause intervals. For example [1,3] means that a wait_time
:param com_interface:
:param tmtc_printer:
:param tc_queue:
:param wait_intervals: List of pause intervals. For example [1,3] means that a wait_time
is applied after
sendinf the first and the third telecommand
:param waitTime: List of wait times or uniform wait time as float
:param printTm:
:param wait_time: List of wait times or uniform wait time as float
:param print_tm:
"""
super().__init__(com_interface=comInterface, tmtc_printer=tmtcPrinter,
tm_listener=tmListener, tc_queue=tcQueue)
self.waitIntervals = waitIntervals
self.waitTime = waitTime
self.printTm = printTm
super().__init__(com_interface=com_interface, tmtc_printer=tmtc_printer,
tm_listener=tm_listener, tc_queue=tc_queue)
self.waitIntervals = wait_intervals
self.waitTime = wait_time
self.printTm = print_tm
self.tmInfoQueue = deque()
self.tcInfoQueue = deque()
self.pusPacketInfo = []
......@@ -68,7 +68,7 @@ class MultipleCommandSenderReceiver(SequentialCommandSenderReceiver):
def __handle_tc_resending(self):
while not self.__all_replies_received:
if self._tc_queue.empty():
if self._tc_queue.__len__ == 0:
if self._start_time == 0:
self._start_time = time.time()
self._check_for_timeout()
......@@ -104,10 +104,10 @@ class MultipleCommandSenderReceiver(SequentialCommandSenderReceiver):
self._tm_listener.tmInfoQueue.clear()
@staticmethod
def wait_for_last_replies_listening(waitTime: float):
def wait_for_last_replies_listening(wait_time: float):
elapsed_time_seconds = 0
start_time = time.time()
while elapsed_time_seconds < waitTime:
while elapsed_time_seconds < wait_time:
elapsed_time_seconds = time.time() - start_time
......
......@@ -88,9 +88,9 @@ class TestService(unittest.TestCase):
:return:
"""
module_tester = MultipleCommandSenderReceiver(
comInterface=self.communication_interface, tmtcPrinter=self.tmtc_printer,
tmListener=self.tm_listener, tcQueue=self.test_queue, waitIntervals=self.wait_intervals,
waitTime=self.wait_time, printTm=g.G_PRINT_RAW_TM)
com_interface=self.communication_interface, tmtc_printer=self.tmtc_printer,
tm_listener=self.tm_listener, tc_queue=self.test_queue, wait_intervals=self.wait_intervals,
wait_time=self.wait_time, print_tm=g.G_PRINT_RAW_TM)
(tc_info_queue, tm_info_queue) = module_tester.send_tc_queue_and_return_info()
assertion_dict = self._analyse_tm_tc_info(tm_info_queue, tc_info_queue)
return assertion_dict
......
......@@ -23,19 +23,19 @@ class TmTcPrinter:
"""
This class handles printing to the command line and to files.
"""
def __init__(self, displayMode: str = "long", doPrintToFile: bool = False,
printTc: bool = True):
def __init__(self, display_mode: str = "long", do_print_to_file: bool = True,
print_tc: bool = True):
"""
:param displayMode: "long" or "short" TODO: replace by enum
:param doPrintToFile: if true, print to file
:param printTc: if true, print TCs
:param display_mode: "long" or "short" TODO: replace by enum
:param do_print_to_file: if true, print to file
:param print_tc: if true, print TCs
"""
self.print_buffer = ""
# global print buffer which will be useful to print something to file
self.file_buffer = ""
self.display_mode = displayMode
self.do_print_to_file = doPrintToFile
self.print_tc = printTc
self.display_mode = display_mode
self.do_print_to_file = do_print_to_file
self.print_tc = print_tc
def print_telemetry(self, packet: PusTelemetry):
"""
......@@ -199,6 +199,7 @@ class TmTcPrinter:
str_to_print = "["
for byte in byte_array:
str_to_print += str(hex(byte)) + " , "
str_to_print = str_to_print.rstrip(' ')
str_to_print = str_to_print.rstrip(',')
str_to_print += ']'
return str_to_print
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment