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