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

some tweak to prevent crash

parent 6dc132a0
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,8 @@ def set_communication_interface(tmtc_printer: TmTcPrinter) -> Union[Communicatio
communication_interface = DummyComIF(tmtc_printer=tmtc_printer)
if not communication_interface.valid:
LOGGER.warning("Invalid communication interface!")
return None
communication_interface.initialize()
else:
communication_interface.initialize()
return communication_interface
except (IOError, OSError):
LOGGER.error("Error setting up communication interface")
......
......@@ -123,16 +123,12 @@ class TmTcHandler:
com_interface=self.communication_interface, tm_timeout=g.G_TM_TIMEOUT,
tc_timeout_factor=g.G_TC_SEND_TIMEOUT_FACTOR
)
self.initialize_com_if_and_listener()
atexit.register(keyboard_interrupt_handler, com_interface=self.communication_interface)
def initialize_com_if_and_listener(self):
if not self.communication_interface.valid:
if self.communication_interface.valid:
self.tm_listener.start()
else:
LOGGER.info("No communication interface set for now")
LOGGER.info("TM listener will not be started")
return
self.tm_listener.start()
atexit.register(keyboard_interrupt_handler, com_interface=self.communication_interface)
def perform_operation(self):
"""
......@@ -185,6 +181,8 @@ class TmTcHandler:
service_queue = deque()
service_queue_packer = ServiceQueuePacker()
service_queue_packer.pack_service_queue(g.G_SERVICE, service_queue)
if not self.communication_interface.valid:
return
LOGGER.info("Performing service command operation")
sender_and_receiver = SequentialCommandSenderReceiver(
com_interface=self.communication_interface, tmtc_printer=self.tmtc_printer,
......
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