diff --git a/board/jungle/__init__.py b/board/jungle/__init__.py index 87cfd678..77a6e3c7 100644 --- a/board/jungle/__init__.py +++ b/board/jungle/__init__.py @@ -83,11 +83,10 @@ class PandaJungle(Panda): return McuType.H7 raise ValueError(f"unknown HW type: {hw_type}") - def up_to_date(self) -> bool: - current = self.get_signature() - fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn.replace("panda", "panda_jungle")) - expected = Panda.get_signature_from_firmware(fn) - return (current == expected) + def up_to_date(self, fn=None) -> bool: + if fn is None: + fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn.replace("panda", "panda_jungle")) + return super().up_to_date(fn=fn) # ******************* health ******************* diff --git a/python/__init__.py b/python/__init__.py index bfa37684..c073c78a 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -492,6 +492,10 @@ class Panda: pass def flash(self, fn=None, code=None, reconnect=True): + if self.up_to_date(fn=fn): + logging.debug("flash: already up to date") + return + if not fn: fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn) assert os.path.isfile(fn) @@ -556,9 +560,10 @@ class Panda: serials = Panda.list() return True - def up_to_date(self) -> bool: + def up_to_date(self, fn=None) -> bool: current = self.get_signature() - fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn) + if fn is None: + fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn) expected = Panda.get_signature_from_firmware(fn) return (current == expected)