mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
* small speedup * cleanup * parallel connect * little more * less flaky * update number of pandas Co-authored-by: Bruce Wayne <batman@comma.ai>
41 lines
1.0 KiB
Python
Executable File
41 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import concurrent.futures
|
|
|
|
from panda import Panda, PandaDFU
|
|
from panda.tests.libs.resetter import Resetter
|
|
|
|
# Reset + flash all CI hardware to get it into a consistent state
|
|
# * ports 1-2 are jungles
|
|
# * port 3 is for the USB hubs
|
|
if __name__ == "__main__":
|
|
r = Resetter()
|
|
|
|
r.enable_boot(True)
|
|
r.cycle_power(delay=7, ports=[1, 2, 3])
|
|
r.enable_boot(False)
|
|
|
|
pandas = PandaDFU.list()
|
|
print("DFU pandas:", pandas)
|
|
assert len(pandas) == 7
|
|
|
|
with concurrent.futures.ProcessPoolExecutor(max_workers=len(pandas)) as exc:
|
|
def recover(serial):
|
|
PandaDFU(serial).recover()
|
|
list(exc.map(recover, pandas, timeout=20))
|
|
|
|
r.cycle_power(delay=7, ports=[1, 2])
|
|
|
|
pandas = Panda.list()
|
|
print(pandas)
|
|
assert len(pandas) == 7
|
|
|
|
with concurrent.futures.ProcessPoolExecutor(max_workers=len(pandas)) as exc:
|
|
def flash(serial):
|
|
with Panda(serial) as pf:
|
|
if pf.bootstub:
|
|
pf.flash()
|
|
list(exc.map(flash, pandas, timeout=20))
|
|
|
|
r.cycle_power(delay=0, ports=[1, 2])
|
|
r.close()
|