python-validity/pair.py
Viktor Dragomiretskyy 269fd1955e A bit of refactoring
2019-08-26 23:05:42 +12:00

36 lines
665 B
Python

from time import sleep
from proto97.usb import usb
from proto97.tls import tls
from proto97.flash import read_flash
from proto97.init_flash import init_flash
from proto97.upload_fwext import upload_fwext
from proto97.calibrate import calibrate
from proto97.init_db import init_db
def restart():
sleep(2)
tls.reset()
usb.open()
usb.send_init()
tls.parseTlsFlash(read_flash(1, 0, 0x1000))
tls.open()
usb.open()
print('Initializing flash...')
init_flash()
restart()
print('Uploading firmware...')
upload_fwext()
restart()
print('Calibrating...')
calibrate()
print('Init database...')
init_db()
print('That\'s it, pairing\'s finished')