mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 11:13:53 +08:00
pandad: support GPIO recovery when in bootstub (#28090)
pandad: recover when in bootstub Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -26,7 +26,7 @@ def flash_panda(panda_serial: str) -> Panda:
|
||||
panda = Panda(panda_serial)
|
||||
|
||||
fw_signature = get_expected_signature(panda)
|
||||
internal_panda = panda.is_internal() and not panda.bootstub
|
||||
internal_panda = panda.is_internal()
|
||||
|
||||
panda_version = "bootstub" if panda.bootstub else panda.get_version()
|
||||
panda_signature = b"" if panda.bootstub else panda.get_signature()
|
||||
@@ -39,7 +39,7 @@ def flash_panda(panda_serial: str) -> Panda:
|
||||
|
||||
if panda.bootstub:
|
||||
bootstub_version = panda.get_version()
|
||||
cloudlog.info(f"Flashed firmware not booting, flashing development bootloader. Bootstub version: {bootstub_version}")
|
||||
cloudlog.info(f"Flashed firmware not booting, flashing development bootloader. {bootstub_version=}, {internal_panda=}")
|
||||
if internal_panda:
|
||||
HARDWARE.recover_internal_panda()
|
||||
panda.recover(reset=(not internal_panda))
|
||||
@@ -95,7 +95,7 @@ def main() -> NoReturn:
|
||||
panda_serials = Panda.list()
|
||||
if len(panda_serials) == 0:
|
||||
if first_run:
|
||||
cloudlog.info("Resetting internal panda")
|
||||
cloudlog.info("No pandas found, resetting internal panda")
|
||||
HARDWARE.reset_internal_panda()
|
||||
time.sleep(2) # wait to come back up
|
||||
continue
|
||||
|
||||
@@ -581,8 +581,9 @@ class Tici(HardwareBase):
|
||||
|
||||
gpio_set(GPIO.STM_RST_N, 1)
|
||||
gpio_set(GPIO.STM_BOOT0, 1)
|
||||
time.sleep(2)
|
||||
time.sleep(1)
|
||||
gpio_set(GPIO.STM_RST_N, 0)
|
||||
time.sleep(1)
|
||||
gpio_set(GPIO.STM_BOOT0, 0)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user