Skip to content

Commit f6ce342

Browse files
committed
Change snek device baud rates with property interface
Use the base baudrate property setter instead of directly calling QtSerial as that avoids re-setting the rate to the current rate which can confusing the target with two baud rate settings. Signed-off-by: Keith Packard <[email protected]>
1 parent f8d5948 commit f6ce342

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mu/modes/snek.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,18 @@ def set_ready(self):
6060
return
6161
self.ready = True
6262
if self.flowcontrol:
63-
for self._baudrate in snek_bauds:
64-
logger.info("Try baudrate %d" % self._baudrate)
65-
self.serial.setBaudRate(self._baudrate)
66-
self.serial.write(b"\x14\n")
63+
for baudrate in snek_bauds:
64+
logger.info("Try baudrate %d" % baudrate)
65+
self.baudrate = baudrate
66+
self.serial.write(b"\x14")
6767
self.serial.waitForReadyRead(250)
6868
if self.got_dc4:
6969
logger.info("Autobaud response detected")
7070
break
7171
logger.info("No autobaud response")
7272
else:
73-
self._baudrate = snek_bauds[0]
74-
logger.info("Using default baudrate %d" % self._baudrate)
75-
self.serial.setBaudRate(self._baudrate)
73+
logger.info("Using default baudrate %d" % snek_bauds[0])
74+
self.baudrate = snek_bauds[0]
7675
self.write(self.pending)
7776
self.pending = b""
7877

0 commit comments

Comments
 (0)