1.0.9 fix RTS handling

This commit is contained in:
geeksville
2020-09-16 09:40:48 -07:00
parent 8c86a49b63
commit 3e0cc15b37
2 changed files with 25 additions and 7 deletions

View File

@@ -508,9 +508,16 @@ class StreamInterface(MeshInterface):
self.devPath = devPath
self._rxBuf = bytes() # empty
self._wantExit = False
# Note: we provide None for port here, because we will be opening it later
self.stream = serial.Serial(
devPath, 921600, exclusive=True, timeout=0.5)
self.stream.setRTS(False)
None, 921600, exclusive=True, timeout=0.5)
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
self.stream.port = devPath
self.stream.rts = False
self.stream.open()
self._rxThread = threading.Thread(target=self.__reader, args=())
MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto)
@@ -599,9 +606,10 @@ class StreamInterface(MeshInterface):
pass
except serial.SerialException as ex:
logging.warn(
"Meshtastic erial port disconnected, disconnecting...")
f"Meshtastic serial port disconnected, disconnecting... {ex}")
finally:
logging.debug("reader is exiting")
self.stream.rts = True # Return RTS high, so that the reset button still works
self.stream.close()
self._disconnected()</code></pre>
</details>
@@ -1263,9 +1271,16 @@ debugOut {stream} &ndash; If a stream is provided, any debug serial output from
self.devPath = devPath
self._rxBuf = bytes() # empty
self._wantExit = False
# Note: we provide None for port here, because we will be opening it later
self.stream = serial.Serial(
devPath, 921600, exclusive=True, timeout=0.5)
self.stream.setRTS(False)
None, 921600, exclusive=True, timeout=0.5)
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
self.stream.port = devPath
self.stream.rts = False
self.stream.open()
self._rxThread = threading.Thread(target=self.__reader, args=())
MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto)
@@ -1354,9 +1369,10 @@ debugOut {stream} &ndash; If a stream is provided, any debug serial output from
pass
except serial.SerialException as ex:
logging.warn(
&#34;Meshtastic erial port disconnected, disconnecting...&#34;)
f&#34;Meshtastic serial port disconnected, disconnecting... {ex}&#34;)
finally:
logging.debug(&#34;reader is exiting&#34;)
self.stream.rts = True # Return RTS high, so that the reset button still works
self.stream.close()
self._disconnected()</code></pre>
</details>

View File

@@ -1,3 +1,5 @@
# Note: you shouldn't need to run this script manually. It is run implicitly by the pip3 install command.
import pathlib
from setuptools import setup
@@ -10,7 +12,7 @@ with open("README.md", "r") as fh:
# This call to setup() does all the work
setup(
name="meshtastic",
version="1.0.8",
version="1.0.9",
description="Python API & client shell for talking to Meshtastic devices",
long_description=long_description,
long_description_content_type="text/markdown",