tools/mpremote: Support any prompt string when detecting soft reset.

The prompt may be changed by sys.ps1.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-03-25 12:39:12 +11:00
parent b312a7abf5
commit 35dbde163a

View File

@ -653,12 +653,12 @@ class PyboardExtended(Pyboard):
# Check if a soft reset occurred.
if data_all.find(b"MPY: soft reboot") == -1:
return
if data_all.endswith(b">>> "):
in_friendly_repl = True
elif data_all.endswith(b">"):
if data_all.endswith(b">"):
in_friendly_repl = False
prompt = b">"
else:
return
in_friendly_repl = True
prompt = data_all.rsplit(b"\r\n", 1)[-1]
# Clear state while board remounts, it will be re-set once mounted.
self.mounted = False
@ -676,9 +676,6 @@ class PyboardExtended(Pyboard):
# Exit raw REPL if needed, and wait for the friendly REPL prompt.
if in_friendly_repl:
self.exit_raw_repl()
prompt = b">>> "
else:
prompt = b">"
self.read_until(len(prompt), prompt)
out_callback(prompt)
self.serial = SerialIntercept(self.serial, self.cmd)