Skip to content

Commit

Permalink
Change snek device baud rates with property interface
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
keith-packard committed Nov 20, 2024
1 parent 6c74a02 commit daa93f8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mu/modes/snek.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,18 @@ def set_ready(self):
return
self.ready = True
if self.flowcontrol:
for self._baudrate in snek_bauds:
logger.info("Try baudrate %d" % self._baudrate)
self.serial.setBaudRate(self._baudrate)
self.serial.write(b"\x14\n")
for baudrate in snek_bauds:
logger.info("Try baudrate %d" % baudrate)
self.baudrate = baudrate
self.serial.write(b"\x14")
self.serial.waitForReadyRead(250)
if self.got_dc4:
logger.info("Autobaud response detected")
break
logger.info("No autobaud response")
else:
self._baudrate = snek_bauds[0]
logger.info("Using default baudrate %d" % self._baudrate)
self.serial.setBaudRate(self._baudrate)
logger.info("Using default baudrate %d" % snek_bauds[0])
self.baudrate = snek_bauds[0]
self.write(self.pending)
self.pending = b""

Expand Down

0 comments on commit daa93f8

Please sign in to comment.