Skip to content

Commit aeec544

Browse files
committed
Revert "Merge pull request #841 from SpudGunMan/master"
This reverts commit b466225, reversing changes made to 2065598.
1 parent 096fec9 commit aeec544

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

meshtastic/serial_interface.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,10 @@ def __repr__(self):
9494

9595
def close(self) -> None:
9696
"""Close a connection to the device"""
97-
if hasattr(self, "stream") and self.stream and getattr(self.stream, "is_open", False):
98-
try:
99-
self.stream.flush()
100-
time.sleep(0.1)
101-
except Exception as e:
102-
logger.debug(f"Exception during flush: {e}")
103-
try:
104-
self.stream.close()
105-
except Exception as e:
106-
logger.debug(f"Exception during close: {e}")
107-
self.stream = None
97+
if self.stream: # Stream can be null if we were already closed
98+
self.stream.flush() # FIXME: why are there these two flushes with 100ms sleeps? This shouldn't be necessary
99+
time.sleep(0.1)
100+
self.stream.flush()
101+
time.sleep(0.1)
108102
logger.debug("Closing Serial stream")
109103
StreamInterface.close(self)

0 commit comments

Comments
 (0)