|
|
|
@ -54,6 +54,7 @@ def flash_panda(panda_serial : str) -> Panda: |
|
|
|
|
|
|
|
|
|
return panda |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def panda_sort_cmp(a: Panda, b: Panda): |
|
|
|
|
a_type = a.get_type() |
|
|
|
|
b_type = b.get_type() |
|
|
|
@ -71,7 +72,10 @@ def panda_sort_cmp(a : Panda, b : Panda): |
|
|
|
|
# last resort: sort by serial number |
|
|
|
|
return a.get_usb_serial() < b.get_usb_serial() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main() -> NoReturn: |
|
|
|
|
first_run = True |
|
|
|
|
|
|
|
|
|
while True: |
|
|
|
|
try: |
|
|
|
|
# Flash all Pandas in DFU mode |
|
|
|
@ -98,6 +102,7 @@ def main() -> NoReturn: |
|
|
|
|
Params().put_bool("PandaHeartbeatLost", True) |
|
|
|
|
cloudlog.event("heartbeat lost", deviceState=health, serial=panda.get_usb_serial()) |
|
|
|
|
|
|
|
|
|
if first_run: |
|
|
|
|
cloudlog.info(f"Resetting panda {panda.get_usb_serial()}") |
|
|
|
|
panda.reset() |
|
|
|
|
|
|
|
|
@ -113,6 +118,8 @@ def main() -> NoReturn: |
|
|
|
|
cloudlog.exception("Panda USB exception while setting up") |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
first_run = False |
|
|
|
|
|
|
|
|
|
# run boardd with all connected serials as arguments |
|
|
|
|
os.chdir(os.path.join(BASEDIR, "selfdrive/boardd")) |
|
|
|
|
subprocess.run(["./boardd", *panda_serials], check=True) |
|
|
|
|