tools: wasptool: Add support for --reset
This commit is contained in:
parent
777a150c9d
commit
fe43091bcf
1 changed files with 14 additions and 0 deletions
|
@ -104,6 +104,14 @@ def handle_exec(c, fname):
|
||||||
if not verbose:
|
if not verbose:
|
||||||
c.logfile = None
|
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):
|
def handle_rtc(c):
|
||||||
# Wait for the clock to tick over to the next second
|
# Wait for the clock to tick over to the next second
|
||||||
now = then = time.localtime()
|
now = then = time.localtime()
|
||||||
|
@ -142,6 +150,8 @@ if __name__ == '__main__':
|
||||||
help='Execute the contents of a file')
|
help='Execute the contents of a file')
|
||||||
parser.add_argument('--eval',
|
parser.add_argument('--eval',
|
||||||
help='Execute the provided python string')
|
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',
|
parser.add_argument('--rtc', action='store_true',
|
||||||
help='Set the time on the WASP device')
|
help='Set the time on the WASP device')
|
||||||
parser.add_argument('--upload',
|
parser.add_argument('--upload',
|
||||||
|
@ -178,4 +188,8 @@ if __name__ == '__main__':
|
||||||
console.close()
|
console.close()
|
||||||
os.execl(pynus, pynus)
|
os.execl(pynus, pynus)
|
||||||
|
|
||||||
|
if args.reset:
|
||||||
|
handle_reset(console)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
unsync(console)
|
unsync(console)
|
||||||
|
|
Loading…
Add table
Reference in a new issue