From 4982d0920ebd247758aa6321bb36a5eede0bd775 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 29 May 2021 11:04:01 +1000 Subject: [PATCH] tools/pyboard.py: Track raw REPL state via in_raw_repl variable. Signed-off-by: Damien George --- tools/pyboard.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/pyboard.py b/tools/pyboard.py index 29a15f7eae..220c010937 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -255,6 +255,7 @@ class Pyboard: def __init__( self, device, baudrate=115200, user="micro", password="python", wait=0, exclusive=True ): + self.in_raw_repl = False self.use_raw_paste = True if device.startswith("exec:"): self.serial = ProcessToSerial(device[len("exec:") :]) @@ -348,8 +349,11 @@ class Pyboard: print(data) raise PyboardError("could not enter raw repl") + self.in_raw_repl = True + def exit_raw_repl(self): self.serial.write(b"\r\x02") # ctrl-B: enter friendly REPL + self.in_raw_repl = False def follow(self, timeout, data_consumer=None): # wait for normal output