mirror of
https://github.com/meshtastic/python.git
synced 2026-08-01 17:47:24 -04:00
1.1.23 fix #41 pyserial also drives usb control signals wrong on windows
This commit is contained in:
@@ -614,8 +614,6 @@ class StreamInterface(MeshInterface):
|
||||
"""Write an array of bytes to our stream and flush"""
|
||||
self.stream.write(b)
|
||||
self.stream.flush()
|
||||
while self.stream.out_waiting != 0:
|
||||
time.sleep(0.1) # It seems that on windows flush might return before all bytes actually sent?
|
||||
|
||||
def _readBytes(self, len):
|
||||
"""Read an array of bytes from our stream"""
|
||||
@@ -722,11 +720,11 @@ class SerialInterface(StreamInterface):
|
||||
|
||||
# rts=False Needed to prevent TBEAMs resetting on OSX, because rts is connected to reset
|
||||
self.stream.port = devPath
|
||||
# OS-X seems to have a bug in its serial driver. It ignores that we asked for no RTSCTS
|
||||
# OS-X/Windows 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':
|
||||
if platform.system() != 'Linux':
|
||||
self.stream.rts = False
|
||||
self.stream.open()
|
||||
|
||||
@@ -736,7 +734,7 @@ class SerialInterface(StreamInterface):
|
||||
def _disconnected(self):
|
||||
"""We override the superclass implementation to close our port"""
|
||||
|
||||
if platform.system() == 'Darwin':
|
||||
if platform.system() != 'Linux':
|
||||
self.stream.rts = True # Return RTS high, so that the reset button still works
|
||||
|
||||
StreamInterface._disconnected(self)
|
||||
|
||||
Reference in New Issue
Block a user