2022-08-24 17:17:02 -07:00
|
|
|
from panda import Panda, PandaDFU
|
|
|
|
|
from panda.tests.libs.resetter import Resetter
|
|
|
|
|
|
|
|
|
|
|
2022-08-31 12:15:36 -07:00
|
|
|
# resets power for both jungles(ports 1 and 2) and USB hubs(port 3)
|
|
|
|
|
# puts pandas into DFU mode and flashes bootstub + app
|
2022-08-24 17:17:02 -07:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
r = Resetter()
|
|
|
|
|
|
|
|
|
|
r.enable_boot(True)
|
2022-08-31 12:15:36 -07:00
|
|
|
r.cycle_power(delay=5, ports=[1,2,3])
|
2022-08-24 17:17:02 -07:00
|
|
|
r.enable_boot(False)
|
|
|
|
|
|
|
|
|
|
pandas = PandaDFU.list()
|
|
|
|
|
print(pandas)
|
2022-09-09 20:13:06 -07:00
|
|
|
assert len(pandas) == 8
|
2022-08-24 17:17:02 -07:00
|
|
|
|
|
|
|
|
for serial in pandas:
|
|
|
|
|
p = PandaDFU(serial)
|
|
|
|
|
p.recover()
|
|
|
|
|
|
2022-08-31 12:15:36 -07:00
|
|
|
r.cycle_power(delay=5, ports=[1,2])
|
2022-08-24 17:17:02 -07:00
|
|
|
|
|
|
|
|
pandas = Panda.list()
|
|
|
|
|
print(pandas)
|
2022-09-09 20:13:06 -07:00
|
|
|
assert len(pandas) == 8
|
2022-08-24 17:17:02 -07:00
|
|
|
|
|
|
|
|
for serial in pandas:
|
|
|
|
|
pf = Panda(serial)
|
|
|
|
|
if pf.bootstub:
|
|
|
|
|
pf.flash()
|
|
|
|
|
pf.close()
|
|
|
|
|
|
2022-08-31 12:15:36 -07:00
|
|
|
r.cycle_power(delay=0, ports=[1,2])
|
2022-08-24 17:17:02 -07:00
|
|
|
r.close()
|