mirror of
https://github.com/esphome/esphome.git
synced 2026-02-21 00:45:35 -07:00
[core] Deprecate using_esp_idf, replace with is_esp32
Arduino on ESP32 now builds ESP-IDF as a component, so add_idf_sdkconfig_option() and add_idf_component() work with both Arduino and ESP-IDF frameworks. The using_esp_idf property is deprecated and now emits a warning. All internal usages have been replaced with is_esp32. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -262,7 +262,7 @@ def _final_validate(_):
|
||||
|
||||
def use_legacy():
|
||||
legacy_driver = _get_use_legacy_driver()
|
||||
return not (CORE.using_esp_idf and not legacy_driver)
|
||||
return not (CORE.is_esp32 and not legacy_driver)
|
||||
|
||||
|
||||
FINAL_VALIDATE_SCHEMA = _final_validate
|
||||
|
||||
@@ -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
|
||||
):
|
||||
|
||||
@@ -164,7 +164,7 @@ async def to_code(config):
|
||||
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")
|
||||
|
||||
@@ -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,8 @@ 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:
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", True)
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6_AUTOCONFIG", True)
|
||||
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")
|
||||
|
||||
@@ -468,7 +468,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:
|
||||
add_idf_sdkconfig_option("CONFIG_ESP_WIFI_SOFTAP_SUPPORT", False)
|
||||
add_idf_sdkconfig_option("CONFIG_LWIP_DHCPS", False)
|
||||
|
||||
@@ -513,7 +513,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()
|
||||
|
||||
|
||||
@@ -798,6 +798,11 @@ class EsphomeCore:
|
||||
|
||||
@property
|
||||
def using_esp_idf(self):
|
||||
# Deprecated: use is_esp32 instead, as Arduino also builds ESP-IDF
|
||||
logging.getLogger(__name__).warning(
|
||||
"CORE.using_esp_idf is deprecated, use CORE.is_esp32 instead. "
|
||||
"Arduino on ESP32 also uses ESP-IDF."
|
||||
)
|
||||
return self.target_framework == "esp-idf"
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user