Compare commits

..

9 Commits

Author SHA1 Message Date
royjr 64ce0c8133 Update opendbc_repo 2026-03-03 21:05:35 -05:00
royjr 8d3809fde0 Merge branch 'master' into gv80-2021-uae 2026-03-03 20:59:13 -05:00
royjr d7554250f3 Update opendbc_repo 2026-03-03 20:59:08 -05:00
royjr aedfd67ba0 Merge branch 'master' into gv80-2021-uae 2026-03-01 13:14:22 -05:00
royjr cca5d3c385 Update opendbc_repo 2026-03-01 13:14:14 -05:00
royjr 9eff40b904 Merge branch 'master' into gv80-2021-uae 2026-02-13 10:43:34 -05:00
royjr 88423f0bc0 Update opendbc_repo 2026-02-13 10:43:27 -05:00
Jason Wen bbc39225b9 Merge remote-tracking branch 'commaai/openpilot/master' into gv80-2021-uae
# Conflicts:
#	opendbc_repo
2025-03-08 22:41:39 -05:00
Jason Wen 5b375c9b1f bump opendbc 2025-02-25 12:06:54 -08:00
3 changed files with 24 additions and 36 deletions
+15 -21
View File
@@ -32,7 +32,8 @@ def flash_panda(panda_serial: str) -> Panda:
raise
# skip flashing if the detected panda is not supported
if panda.get_type() not in Panda.SUPPORTED_DEVICES:
supported_panda = check_panda_support(panda)
if not supported_panda:
cloudlog.warning(f"Panda {panda_serial} is not supported (hw_type: {panda.get_type()}), skipping flash...")
return panda
@@ -68,19 +69,10 @@ def flash_panda(panda_serial: str) -> Panda:
return panda
def check_panda_support(panda_serials: list[str]) -> bool:
unsupported = []
for serial in panda_serials:
panda = Panda(serial)
hw_type = panda.get_type()
panda.close()
if hw_type in Panda.SUPPORTED_DEVICES:
return True
unsupported.append((serial, hw_type))
for serial, hw_type in unsupported:
cloudlog.warning(f"Panda {serial} is not supported (hw_type: {hw_type}), skipping...")
def check_panda_support(panda) -> bool:
hw_type = panda.get_type()
if hw_type in Panda.SUPPORTED_DEVICES:
return True
return False
@@ -134,17 +126,13 @@ def main() -> None:
cloudlog.info(f"{len(panda_serials)} panda(s) found, connecting - {panda_serials}")
# custom flasher for xnor's Rivian Longitudinal Upgrade Kit
flash_rivian_long(panda_serials)
# skip flashing and health check if no supported panda is detected
if not check_panda_support(panda_serials):
continue
# Flash the first panda
panda_serial = panda_serials[0]
panda = flash_panda(panda_serial)
# flash Rivian longitudinal upgrade panda
flash_rivian_long(panda)
# Ensure internal panda is present if expected
if HARDWARE.has_internal_panda() and not panda.is_internal():
cloudlog.error("Internal panda is missing, trying again")
@@ -155,6 +143,12 @@ def main() -> None:
# log panda fw version
params.put("PandaSignatures", panda.get_signature())
# skip health check if the detected panda is not supported
supported_panda = check_panda_support(panda)
if not supported_panda:
cloudlog.warning(f"Panda {panda.get_usb_serial()} is not supported (hw_type: {panda.get_type()}), skipping health check...")
continue
# check health for lost heartbeat
health = panda.health()
if health["heartbeat_lost"]:
@@ -74,7 +74,7 @@ def _flash_panda(panda: Panda) -> None:
panda.reconnect()
def flash_rivian_long(panda_serials: list[str]) -> None:
def flash_rivian_long(panda: Panda) -> None:
if not os.path.isfile(FW_PATH):
cloudlog.error(f"Rivian longitudinal upgrade firmware not found at {FW_PATH}")
return
@@ -83,19 +83,13 @@ def flash_rivian_long(panda_serials: list[str]) -> None:
cloudlog.info("Not a Rivian, skipping longitudinal upgrade...")
return
for serial in panda_serials:
panda = Panda(serial)
# only flash external black pandas (HW_TYPE_BLACK = 0x03)
if panda.get_type() == b'\x03' and not panda.is_internal():
try:
_flash_panda(panda)
cloudlog.info(f"Successfully flashed xnor's Rivian Longitudinal Upgrade Kit: {serial}")
except Exception:
cloudlog.exception(f"Failed to flash xnor's Rivian Longitudinal Upgrade Kit: {serial}")
panda.close()
return
# only flash external black pandas (HW_TYPE_BLACK = 0x03)
if panda.get_type() == b'\x03' and not panda.is_internal():
try:
_flash_panda(panda)
except Exception:
cloudlog.exception(f"Failed to flash F4 panda {panda.get_usb_serial()}")
if __name__ == '__main__':
flash_rivian_long(Panda.list())
flash_rivian_long(Panda())