[esp32] Remove remaining using_esp_idf checks (#12623)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2025-12-22 15:41:14 -05:00
committed by GitHub
parent 08c0f65f30
commit 918bc4b74f
8 changed files with 20 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ _LOGGER = logging.getLogger(__name__)
def AUTO_LOAD() -> list[str]:
auto_load = ["web_server_base", "ota.web_server"]
if CORE.using_esp_idf:
if CORE.is_esp32:
auto_load.append("socket")
return auto_load

View File

@@ -146,7 +146,7 @@ def _final_validate(config):
full_config = fv.full_config.get()[CONF_I2C]
if CORE.using_zephyr and len(full_config) > 1:
raise cv.Invalid("Second i2c is not implemented on Zephyr yet")
if CORE.using_esp_idf and get_esp32_variant() in ESP32_I2C_CAPABILITIES:
if CORE.is_esp32 and get_esp32_variant() in ESP32_I2C_CAPABILITIES:
variant = get_esp32_variant()
max_num = ESP32_I2C_CAPABILITIES[variant]["NUM"]
if len(full_config) > max_num:

View File

@@ -232,6 +232,8 @@ def validate_use_legacy(value):
if (not value[CONF_USE_LEGACY]) and (CORE.using_arduino):
raise cv.Invalid("Arduino supports only the legacy i2s driver")
_set_use_legacy_driver(value[CONF_USE_LEGACY])
elif CORE.using_arduino:
_set_use_legacy_driver(True)
return value
@@ -261,8 +263,7 @@ def _final_validate(_):
def use_legacy():
legacy_driver = _get_use_legacy_driver()
return not (CORE.using_esp_idf and not legacy_driver)
return _get_use_legacy_driver()
FINAL_VALIDATE_SCHEMA = _final_validate

View File

@@ -26,7 +26,7 @@ def validate_logger(config):
logger_conf = fv.full_config.get()[CONF_LOGGER]
if logger_conf[CONF_BAUD_RATE] == 0:
raise cv.Invalid("improv_serial requires the logger baud_rate to be not 0")
if CORE.using_esp_idf and (
if CORE.is_esp32 and (
logger_conf[CONF_HARDWARE_UART] == USB_CDC
and get_esp32_variant() == VARIANT_ESP32S3
):

View File

@@ -157,14 +157,12 @@ async def to_code(config):
return
if CORE.using_arduino:
if CORE.is_esp32:
cg.add_library("ESPmDNS", None)
elif CORE.is_esp8266:
if CORE.is_esp8266:
cg.add_library("ESP8266mDNS", None)
elif CORE.is_rp2040:
cg.add_library("LEAmDNS", None)
if CORE.using_esp_idf:
if CORE.is_esp32:
add_idf_component(name="espressif/mdns", ref="1.9.1")
cg.add_define("USE_MDNS")

View File

@@ -156,7 +156,7 @@ async def to_code(config):
"High performance networking disabled by user configuration (overriding component request)"
)
if CORE.is_esp32 and CORE.using_esp_idf and should_enable:
if CORE.is_esp32 and should_enable:
# Check if PSRAM is guaranteed (set by psram component during final validation)
psram_guaranteed = psram_is_guaranteed()
@@ -210,12 +210,12 @@ async def to_code(config):
"USE_NETWORK_MIN_IPV6_ADDR_COUNT", config[CONF_MIN_IPV6_ADDR_COUNT]
)
if CORE.is_esp32:
if CORE.using_esp_idf:
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", enable_ipv6)
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6_AUTOCONFIG", enable_ipv6)
else:
if CORE.using_arduino:
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", True)
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6_AUTOCONFIG", True)
else:
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", enable_ipv6)
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6_AUTOCONFIG", enable_ipv6)
elif enable_ipv6:
cg.add_build_flag("-DCONFIG_LWIP_IPV6")
cg.add_build_flag("-DCONFIG_LWIP_IPV6_AUTOCONFIG")

View File

@@ -464,7 +464,7 @@ async def to_code(config):
)
cg.add(var.set_ap_timeout(conf[CONF_AP_TIMEOUT]))
cg.add_define("USE_WIFI_AP")
elif CORE.is_esp32 and CORE.using_esp_idf:
elif CORE.is_esp32 and not CORE.using_arduino:
add_idf_sdkconfig_option("CONFIG_ESP_WIFI_SOFTAP_SUPPORT", False)
add_idf_sdkconfig_option("CONFIG_LWIP_DHCPS", False)
@@ -509,7 +509,7 @@ async def to_code(config):
add_idf_sdkconfig_option("CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP", True)
# Apply high performance WiFi settings if high performance networking is enabled
if CORE.is_esp32 and CORE.using_esp_idf and has_high_performance_networking():
if CORE.is_esp32 and has_high_performance_networking():
# Check if PSRAM is guaranteed (set by psram component during final validation)
psram_guaranteed = psram_is_guaranteed()

View File

@@ -798,6 +798,11 @@ class EsphomeCore:
@property
def using_esp_idf(self):
_LOGGER.warning(
"CORE.using_esp_idf was deprecated in 2026.1, will change behavior in 2026.6. "
"ESP32 Arduino builds on top of ESP-IDF, so ESP-IDF features are available in both frameworks. "
"Use CORE.is_esp32 and/or CORE.using_arduino instead."
)
return self.target_framework == "esp-idf"
@property