mirror of
https://jihulab.com/mr-one/openpilot.git
synced 2026-10-26 20:43:49 +08:00
编辑pandad.py
This commit is contained in:
+17
-13
@@ -16,12 +16,8 @@ from openpilot.sunnypilot.selfdrive.pandad.rivian_long_flasher import flash_rivi
|
||||
|
||||
|
||||
def get_expected_signature() -> bytes:
|
||||
try:
|
||||
fn = os.path.join(FW_PATH, McuType.H7.config.app_fn)
|
||||
return Panda.get_signature_from_firmware(fn)
|
||||
except Exception:
|
||||
cloudlog.exception("Error computing expected signature")
|
||||
return b""
|
||||
fn = os.path.join(FW_PATH, McuType.H7.config.app_fn)
|
||||
return Panda.get_signature_from_firmware(fn)
|
||||
|
||||
def flash_panda(panda_serial: str) -> Panda:
|
||||
try:
|
||||
@@ -103,13 +99,21 @@ def main() -> None:
|
||||
|
||||
# Handle missing internal panda
|
||||
if no_internal_panda_count > 0:
|
||||
if no_internal_panda_count == 3:
|
||||
cloudlog.info("No pandas found, putting internal panda into DFU")
|
||||
HARDWARE.recover_internal_panda()
|
||||
else:
|
||||
cloudlog.info("No pandas found, resetting internal panda")
|
||||
HARDWARE.reset_internal_panda()
|
||||
time.sleep(3) # wait to come back up
|
||||
cloudlog.info("No pandas found, resetting internal panda")
|
||||
HARDWARE.reset_internal_panda()
|
||||
# The internal panda takes a few seconds to boot its app after a reset.
|
||||
# Wait for it to come back in normal mode before deciding to flash.
|
||||
panda_serials: list[str] = []
|
||||
for _ in range(16):
|
||||
panda_serials = Panda.list()
|
||||
if len(panda_serials) == 1:
|
||||
try:
|
||||
with Panda(panda_serials[0]) as p:
|
||||
if not p.bootstub:
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(0.5)
|
||||
|
||||
# Flash all Pandas in DFU mode
|
||||
dfu_serials = PandaDFU.list()
|
||||
|
||||
Reference in New Issue
Block a user