From 352129e77e0e1053b04499d597f46de7598beef9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 25 Aug 2026 15:05:44 -0500 Subject: [PATCH] Use the shared pch registration helper --- esphome/components/rp2/__init__.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/esphome/components/rp2/__init__.py b/esphome/components/rp2/__init__.py index 52562ab97a..ddf3331b85 100644 --- a/esphome/components/rp2/__init__.py +++ b/esphome/components/rp2/__init__.py @@ -6,7 +6,7 @@ from string import ascii_letters, digits import subprocess from typing import Any -from esphome.build_helpers.pch import pch_enabled +from esphome.build_helpers.pch import pch_extra_scripts import esphome.codegen as cg import esphome.config_validation as cv from esphome.const import ( @@ -341,12 +341,10 @@ async def to_code(config: ConfigType) -> None: cg.add_define("ESPHOME_VARIANT", VARIANT_FRIENDLY[variant]) cg.add_define(ThreadModel.SINGLE) - extra_scripts = ["pre:ccache.py"] - # Generation-time gate: the script itself has no enable check - if pch_enabled(): - extra_scripts.append("post:pch.py") - extra_scripts.append("post:post_build.py") - cg.add_platformio_option("extra_scripts", extra_scripts) + cg.add_platformio_option( + "extra_scripts", + ["pre:ccache.py", *pch_extra_scripts(), "post:post_build.py"], + ) conf = config[CONF_FRAMEWORK] cg.add_platformio_option("framework", "arduino")