tools: Allow pyboard.py to work when boot.py prints things.

This commit is contained in:
Dave Hylands 2015-12-03 16:05:53 -08:00 committed by Damien George
parent cbc489dff5
commit 519cef813e
1 changed files with 8 additions and 2 deletions

View File

@ -165,8 +165,14 @@ class Pyboard:
raise PyboardError('could not enter raw repl') raise PyboardError('could not enter raw repl')
self.serial.write(b'\x04') # ctrl-D: soft reset self.serial.write(b'\x04') # ctrl-D: soft reset
data = self.read_until(1, b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n') data = self.read_until(1, b'soft reboot\r\n')
if not data.endswith(b'soft reboot\r\nraw REPL; CTRL-B to exit\r\n'): if not data.endswith(b'soft reboot\r\n'):
print(data)
raise PyboardError('could not enter raw repl')
# By splitting this into 2 reads, it allows boot.py to print stuff,
# which will show up after the soft reboot and before the raw REPL.
data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n')
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n'):
print(data) print(data)
raise PyboardError('could not enter raw repl') raise PyboardError('could not enter raw repl')