Commit 260dc5b3 authored by Rahix's avatar Rahix
Browse files

fix(pycard10): Make pycard10 reset pycardium via os.exec("")



This will result in more reliably reaching a clean state.
Co-Authored-By: schneider's avatarschneider <schneider@muc.ccc.de>
Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent a9c9d666
......@@ -130,10 +130,12 @@ class PyCard10(Pyboard):
None
"""
self.soft_reset()
self.serial.write(b"\x03\x03") # ctrl-C twice: interrupt any running program
self.serial.write(b"\x02") # ctrl-B: ensue it's the normal mode
self.serial.write(b'__import__("os").exec("")\r') # Reset to REPL
# flush input (without relying on serial.flushInput())
n = self.serial.inWaiting()
while n > 0:
......@@ -176,8 +178,6 @@ class PyCard10(Pyboard):
self.serial.write(b"\x04") # ctrl-D: do the reset
time.sleep(1) # Give epicardium some time to cycle pycardium
n = self.serial.inWaiting()
while n > 0:
self.serial.read(n)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment