Skip to content
Merged
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
10 changes: 6 additions & 4 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ 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 @@ -430,8 +429,10 @@ 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, self._mcu_type.config.app_fn)
fn = os.path.join(FW_PATH, 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 @@ -446,7 +447,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=self._mcu_type)
Panda.flash_static(self._handle, code, mcu_type=mcu_type)

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

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

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