diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 8a62811..86602e8 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -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() @@ -1263,9 +1271,16 @@ debugOut {stream} – 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} – If a stream is provided, any debug serial output from 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() diff --git a/setup.py b/setup.py index 35beb4b..7fbb686 100644 --- a/setup.py +++ b/setup.py @@ -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",