1
0
Fork 0

tools: wasptool: Add support for --reset

This commit is contained in:
Daniel Thompson 2020-04-17 17:17:24 +01:00
parent 777a150c9d
commit fe43091bcf

View file

@ -104,6 +104,14 @@ def handle_exec(c, fname):
if not verbose:
c.logfile = None
def handle_reset(c):
c.send('\x05')
c.expect('=== ')
c.sendline('import machine')
c.sendline('machine.reset()')
c.expect('=== ')
c.send('\x04')
def handle_rtc(c):
# Wait for the clock to tick over to the next second
now = then = time.localtime()
@ -142,6 +150,8 @@ if __name__ == '__main__':
help='Execute the contents of a file')
parser.add_argument('--eval',
help='Execute the provided python string')
parser.add_argument('--reset', action='store_true',
help="Reboot the device (and don't stay in bootloader mode)")
parser.add_argument('--rtc', action='store_true',
help='Set the time on the WASP device')
parser.add_argument('--upload',
@ -178,4 +188,8 @@ if __name__ == '__main__':
console.close()
os.execl(pynus, pynus)
if args.reset:
handle_reset(console)
sys.exit(0)
unsync(console)