mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-01 05:33:49 +08:00
eefc084302
version: sunnypilot v2025.003.000 (dev) date: 2025-12-18T05:48:43 master commit: 16c052af0835f049a67b80251d8cc1114fc08bb4
28 lines
698 B
Python
Executable File
28 lines
698 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import subprocess
|
|
import argparse
|
|
|
|
from panda import Panda
|
|
|
|
board_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--all", action="store_true", help="Recover all Panda devices")
|
|
args = parser.parse_args()
|
|
|
|
subprocess.check_call(f"scons -C {board_path}/.. -j$(nproc) {board_path}", shell=True)
|
|
|
|
if args.all:
|
|
serials = Panda.list()
|
|
print(f"found {len(serials)} panda(s) - {serials}")
|
|
else:
|
|
serials = [None]
|
|
|
|
for s in serials:
|
|
with Panda(serial=s) as p:
|
|
print("flashing", p.get_usb_serial())
|
|
p.flash()
|
|
exit(1 if len(serials) == 0 else 0)
|