diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 86602e8..32c7f9e 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -128,6 +128,7 @@ import sys import traceback import time import base64 +import platform from . import mesh_pb2 from . import util from pubsub import pub @@ -515,7 +516,12 @@ class StreamInterface(MeshInterface): # rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset self.stream.port = devPath - self.stream.rts = False + # OS-X seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS + # control and will always drive RTS either high or low (rather than letting the CP102 leave + # it as an open-collector floating pin). Since it is going to drive it anyways we want to make + # sure it is driven low, so that the TBEAM won't reset + if platform.system() == 'Darwin': + self.stream.rts = False self.stream.open() self._rxThread = threading.Thread(target=self.__reader, args=()) @@ -584,14 +590,14 @@ class StreamInterface(MeshInterface): elif ptr == 1: # looking for START2 if c != START2: - self.rfBuf = empty # failed to find start2 + self._rxBuf = empty # failed to find start2 elif ptr >= HEADER_LEN: # we've at least got a header # big endian length follos header packetlen = (self._rxBuf[2] << 8) + self._rxBuf[3] if ptr == HEADER_LEN: # we _just_ finished reading the header, validate length if packetlen > MAX_TO_FROM_RADIO_SIZE: - self.rfBuf = empty # length ws out out bounds, restart + self._rxBuf = empty # length ws out out bounds, restart if len(self._rxBuf) != 0 and ptr + 1 == packetlen + HEADER_LEN: try: @@ -609,7 +615,8 @@ class StreamInterface(MeshInterface): 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 + if platform.system() == 'Darwin': + self.stream.rts = True # Return RTS high, so that the reset button still works self.stream.close() self._disconnected() @@ -1278,7 +1285,12 @@ debugOut {stream} – If a stream is provided, any debug serial output from # rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset self.stream.port = devPath - self.stream.rts = False + # OS-X seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS + # control and will always drive RTS either high or low (rather than letting the CP102 leave + # it as an open-collector floating pin). Since it is going to drive it anyways we want to make + # sure it is driven low, so that the TBEAM won't reset + if platform.system() == 'Darwin': + self.stream.rts = False self.stream.open() self._rxThread = threading.Thread(target=self.__reader, args=()) @@ -1347,14 +1359,14 @@ debugOut {stream} – If a stream is provided, any debug serial output from elif ptr == 1: # looking for START2 if c != START2: - self.rfBuf = empty # failed to find start2 + self._rxBuf = empty # failed to find start2 elif ptr >= HEADER_LEN: # we've at least got a header # big endian length follos header packetlen = (self._rxBuf[2] << 8) + self._rxBuf[3] if ptr == HEADER_LEN: # we _just_ finished reading the header, validate length if packetlen > MAX_TO_FROM_RADIO_SIZE: - self.rfBuf = empty # length ws out out bounds, restart + self._rxBuf = empty # length ws out out bounds, restart if len(self._rxBuf) != 0 and ptr + 1 == packetlen + HEADER_LEN: try: @@ -1372,7 +1384,8 @@ debugOut {stream} – If a stream is provided, any debug serial output from 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 + if platform.system() == 'Darwin': + 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 7fbb686..6446664 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ with open("README.md", "r") as fh: # This call to setup() does all the work setup( name="meshtastic", - version="1.0.9", + version="1.0.10", description="Python API & client shell for talking to Meshtastic devices", long_description=long_description, long_description_content_type="text/markdown",