From 1ffad74f88e5683d9cd7c472e823928e28037e9e Mon Sep 17 00:00:00 2001 From: Robbe Derks Date: Fri, 5 Dec 2025 23:06:56 +0100 Subject: [PATCH] Revert `mcu_type` changes (#2303) * Revert "Fix mcu_type for deprecated pandas (#2296)" This reverts commit 6c9064c4cf1fe4baadc2f8f9e356c9e967720630. * Revert "Fix mcu_type in jungle (#2300)" This reverts commit 1e8fa512cacdefae5bd20df7dfe666fafb83403d. --- board/jungle/__init__.py | 4 ++-- python/__init__.py | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/board/jungle/__init__.py b/board/jungle/__init__.py index 84286c9e..dfb7d98c 100644 --- a/board/jungle/__init__.py +++ b/board/jungle/__init__.py @@ -23,7 +23,7 @@ def ensure_jungle_health_packet_version(fn): 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) @@ -52,7 +52,7 @@ class PandaJungle(Panda): 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: diff --git a/python/__init__.py b/python/__init__.py index 2c9f7cd5..0f18a523 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -209,6 +209,7 @@ class Panda: 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") @@ -429,10 +430,8 @@ class Panda: 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: @@ -447,7 +446,7 @@ class Panda: 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: @@ -636,8 +635,7 @@ class Panda: 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): """