mirror of
https://github.com/meshtastic/python.git
synced 2026-01-03 21:37:57 -05:00
Revert "Merge pull request #841 from SpudGunMan/master"
This reverts commitb4662251ed, reversing changes made to2065598754.
This commit is contained in:
@@ -94,16 +94,10 @@ class SerialInterface(StreamInterface):
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close a connection to the device"""
|
||||
if hasattr(self, "stream") and self.stream and getattr(self.stream, "is_open", False):
|
||||
try:
|
||||
self.stream.flush()
|
||||
time.sleep(0.1)
|
||||
except Exception as e:
|
||||
logger.debug(f"Exception during flush: {e}")
|
||||
try:
|
||||
self.stream.close()
|
||||
except Exception as e:
|
||||
logger.debug(f"Exception during close: {e}")
|
||||
self.stream = None
|
||||
if self.stream: # Stream can be null if we were already closed
|
||||
self.stream.flush() # FIXME: why are there these two flushes with 100ms sleeps? This shouldn't be necessary
|
||||
time.sleep(0.1)
|
||||
self.stream.flush()
|
||||
time.sleep(0.1)
|
||||
logger.debug("Closing Serial stream")
|
||||
StreamInterface.close(self)
|
||||
|
||||
Reference in New Issue
Block a user