IPv6 can't be enabled for libretiny (#6387)

This commit is contained in:
Jimmy Hedman 2024-03-17 22:06:02 +01:00 committed by Jesse Hills
parent 22f427165f
commit 4429e5ae56
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -6,6 +6,9 @@ from esphome.components.esp32 import add_idf_sdkconfig_option
from esphome.const import ( from esphome.const import (
CONF_ENABLE_IPV6, CONF_ENABLE_IPV6,
CONF_MIN_IPV6_ADDR_COUNT, CONF_MIN_IPV6_ADDR_COUNT,
PLATFORM_ESP32,
PLATFORM_ESP8266,
PLATFORM_RP2040,
) )
CODEOWNERS = ["@esphome/core"] CODEOWNERS = ["@esphome/core"]
@ -16,25 +19,30 @@ IPAddress = network_ns.class_("IPAddress")
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.Optional(CONF_ENABLE_IPV6, default=False): cv.boolean, cv.SplitDefault(CONF_ENABLE_IPV6): cv.All(
cv.boolean, cv.only_on([PLATFORM_ESP32, PLATFORM_ESP8266, PLATFORM_RP2040])
),
cv.Optional(CONF_MIN_IPV6_ADDR_COUNT, default=0): cv.positive_int, cv.Optional(CONF_MIN_IPV6_ADDR_COUNT, default=0): cv.positive_int,
} }
) )
async def to_code(config): async def to_code(config):
cg.add_define("USE_NETWORK_IPV6", config[CONF_ENABLE_IPV6]) if CONF_ENABLE_IPV6 in config:
cg.add_define("USE_NETWORK_MIN_IPV6_ADDR_COUNT", config[CONF_MIN_IPV6_ADDR_COUNT]) cg.add_define("USE_NETWORK_IPV6", config[CONF_ENABLE_IPV6])
if CORE.using_esp_idf: cg.add_define(
add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", config[CONF_ENABLE_IPV6]) "USE_NETWORK_MIN_IPV6_ADDR_COUNT", config[CONF_MIN_IPV6_ADDR_COUNT]
add_idf_sdkconfig_option(
"CONFIG_LWIP_IPV6_AUTOCONFIG", config[CONF_ENABLE_IPV6]
) )
else: if CORE.using_esp_idf:
if config[CONF_ENABLE_IPV6]: add_idf_sdkconfig_option("CONFIG_LWIP_IPV6", config[CONF_ENABLE_IPV6])
cg.add_build_flag("-DCONFIG_LWIP_IPV6") add_idf_sdkconfig_option(
cg.add_build_flag("-DCONFIG_LWIP_IPV6_AUTOCONFIG") "CONFIG_LWIP_IPV6_AUTOCONFIG", config[CONF_ENABLE_IPV6]
if CORE.is_rp2040: )
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6") else:
if CORE.is_esp8266: if config[CONF_ENABLE_IPV6]:
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY") cg.add_build_flag("-DCONFIG_LWIP_IPV6")
cg.add_build_flag("-DCONFIG_LWIP_IPV6_AUTOCONFIG")
if CORE.is_rp2040:
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6")
if CORE.is_esp8266:
cg.add_build_flag("-DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY")