Merge pull request #3006 from sommersoft/update_cpboard_py
Fix Backwards Logic of 'wait_for_response' In #3005
This commit is contained in:
commit
6ff7e25397
|
@ -127,7 +127,7 @@ class REPL:
|
||||||
self.write(b"\r" + REPL.CHAR_CTRL_B) # enter or reset friendly repl
|
self.write(b"\r" + REPL.CHAR_CTRL_B) # enter or reset friendly repl
|
||||||
data = self.read_until(b">>> ")
|
data = self.read_until(b">>> ")
|
||||||
|
|
||||||
def execute(self, code, timeout=10, wait_for_response=False):
|
def execute(self, code, timeout=10, wait_for_response=True):
|
||||||
self.read() # Throw away
|
self.read() # Throw away
|
||||||
|
|
||||||
self.write(REPL.CHAR_CTRL_A)
|
self.write(REPL.CHAR_CTRL_A)
|
||||||
|
@ -136,7 +136,7 @@ class REPL:
|
||||||
self.write(code)
|
self.write(code)
|
||||||
|
|
||||||
self.write(REPL.CHAR_CTRL_D)
|
self.write(REPL.CHAR_CTRL_D)
|
||||||
if wait_for_response:
|
if not wait_for_response:
|
||||||
return b"", b""
|
return b"", b""
|
||||||
self.read_until(b"OK")
|
self.read_until(b"OK")
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ class CPboard:
|
||||||
self.serial.close()
|
self.serial.close()
|
||||||
self.serial = None
|
self.serial = None
|
||||||
|
|
||||||
def exec(self, command, timeout=10, wait_for_response=False):
|
def exec(self, command, timeout=10, wait_for_response=True):
|
||||||
with self.repl as repl:
|
with self.repl as repl:
|
||||||
try:
|
try:
|
||||||
output, error = repl.execute(
|
output, error = repl.execute(
|
||||||
|
@ -483,7 +483,7 @@ class CPboard:
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.exec(
|
self.exec(
|
||||||
"import microcontroller;microcontroller.reset()", wait_for_response=True
|
"import microcontroller;microcontroller.reset()", wait_for_response=False
|
||||||
)
|
)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue