Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions board/jungle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def wrapper(self, *args, **kwargs):

class PandaJungleDFU(PandaDFU):
def recover(self):
fn = os.path.join(FW_PATH, self.get_mcu_type().config.bootstub_fn.replace("panda", "panda_jungle"))
fn = os.path.join(FW_PATH, self._mcu_type.config.bootstub_fn.replace("panda", "panda_jungle"))
with open(fn, "rb") as f:
code = f.read()
self.program_bootstub(code)
Expand Down Expand Up @@ -52,7 +52,7 @@ def spi_connect(cls, serial, ignore_version=False):

def flash(self, fn=None, code=None, reconnect=True):
if not fn:
fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn.replace("panda", "panda_jungle"))
fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn.replace("panda", "panda_jungle"))
super().flash(fn=fn, code=code, reconnect=reconnect)

def recover(self, timeout: int | None = 60, reset: bool = True) -> bool:
Expand Down
10 changes: 4 additions & 6 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def connect(self, claim=True, wait=False):
self._serial = serial
self._connect_serial = serial
self._handle_open = True
self._mcu_type = self.get_mcu_type()
self.health_version, self.can_version, self.can_health_version = self.get_packets_versions()
logger.debug("connected")

Expand Down Expand Up @@ -429,10 +430,8 @@ def flash(self, fn=None, code=None, reconnect=True):
if hw_type not in self.SUPPORTED_DEVICES:
raise RuntimeError(f"HW type {hw_type.hex()} is deprecated and can no longer be flashed.")

mcu_type = self.get_mcu_type()

if not fn:
fn = os.path.join(FW_PATH, mcu_type.config.app_fn)
fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn)
assert os.path.isfile(fn)
logger.debug("flash: main version is %s", self.get_version())
if not self.bootstub:
Expand All @@ -447,7 +446,7 @@ def flash(self, fn=None, code=None, reconnect=True):
logger.debug("flash: bootstub version is %s", self.get_version())

# do flash
Panda.flash_static(self._handle, code, mcu_type=mcu_type)
Panda.flash_static(self._handle, code, mcu_type=self._mcu_type)

# reconnect
if reconnect:
Expand Down Expand Up @@ -636,8 +635,7 @@ def get_usb_serial(self):
return self._serial

def get_dfu_serial(self):
mcu_type = self.get_mcu_type()
return PandaDFU.st_serial_to_dfu_serial(self._serial, mcu_type)
return PandaDFU.st_serial_to_dfu_serial(self._serial, self._mcu_type)

def get_uid(self):
"""
Expand Down
Loading