Add reboot at the end of pair.py

This commit is contained in:
Viktor Dragomiretskyy 2020-07-09 09:22:49 +12:00
parent 086b9e9b6c
commit 38ccc1e5a7

32
pair.py
View file

@ -7,7 +7,7 @@ from proto9x.flash import read_tls_flash
from proto9x.init_flash import init_flash from proto9x.init_flash import init_flash
from proto9x.upload_fwext import upload_fwext from proto9x.upload_fwext import upload_fwext
from proto9x.init_db import init_db from proto9x.init_db import init_db
from proto9x.sensor import sensor from proto9x.sensor import sensor, reboot
#usb.trace_enabled=True #usb.trace_enabled=True
#tls.trace_enabled=True #tls.trace_enabled=True
@ -21,20 +21,24 @@ def restart():
tls.parseTlsFlash(read_tls_flash()) tls.parseTlsFlash(read_tls_flash())
tls.open() tls.open()
usb.open() try:
print('Initializing flash...') usb.open()
init_flash() print('Initializing flash...')
init_flash()
restart() restart()
print('Uploading firmware...') print('Uploading firmware...')
upload_fwext() upload_fwext()
restart() restart()
print('Calibrating...') print('Calibrating...')
sensor.open(False) sensor.open(False)
sensor.calibrate() sensor.calibrate()
print('Init database...') print('Init database...')
init_db() init_db()
print('That\'s it, pairing\'s finished') print('That\'s it, pairing\'s finished')
finally:
sleep(1)
reboot()