@@ -118,7 +118,7 @@ def reset(self):
118118 self .write (b'\r ' + REPL .CHAR_CTRL_B ) # enter or reset friendly repl
119119 data = self .read_until (b'>>> ' )
120120
121- def execute (self , code , timeout = 10 , async = False ):
121+ def execute (self , code , timeout = 10 , wait_for_response = False ):
122122 self .read () # Throw away
123123
124124 self .write (REPL .CHAR_CTRL_A )
@@ -127,7 +127,7 @@ def execute(self, code, timeout=10, async=False):
127127 self .write (code )
128128
129129 self .write (REPL .CHAR_CTRL_D )
130- if async :
130+ if wait_for_response :
131131 return b'' , b''
132132 self .read_until (b'OK' )
133133
@@ -424,10 +424,11 @@ def close(self):
424424 self .serial .close ()
425425 self .serial = None
426426
427- def exec (self , command , timeout = 10 , async = False ):
427+ def exec (self , command , timeout = 10 , wait_for_response = False ):
428428 with self .repl as repl :
429429 try :
430- output , error = repl .execute (command , timeout = timeout , async = async )
430+ output , error = repl .execute (command , timeout = timeout ,
431+ wait_for_response = wait_for_response )
431432 except OSError as e :
432433 if self .debug :
433434 print ('exec: session: ' , self .repl .session )
@@ -451,7 +452,8 @@ def eval(self, expression, timeout=10):
451452 def _reset (self , mode = 'NORMAL' ):
452453 self .exec ("import microcontroller;microcontroller.on_next_reset(microcontroller.RunMode.%s)" % mode )
453454 try :
454- self .exec ("import microcontroller;microcontroller.reset()" , async = True )
455+ self .exec ("import microcontroller;microcontroller.reset()" ,
456+ wait_for_response = True )
455457 except OSError :
456458 pass
457459
0 commit comments