From d73384ae46999b99b852b2f9f691b7d9dc86001d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 7 Feb 2026 19:07:15 -0600 Subject: [PATCH] revert this after https://github.com/libretiny-eu/libretiny/pull/361 --- esphome/components/libretiny/__init__.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/esphome/components/libretiny/__init__.py b/esphome/components/libretiny/__init__.py index 7cd1dc545f6..6898f6c897f 100644 --- a/esphome/components/libretiny/__init__.py +++ b/esphome/components/libretiny/__init__.py @@ -33,9 +33,6 @@ from .const import ( CONF_UART_PORT, FAMILIES, FAMILY_BK7231N, - FAMILY_BK7231Q, - FAMILY_BK7231T, - FAMILY_BK7251, FAMILY_COMPONENT, FAMILY_FRIENDLY, FAMILY_RTL8710B, @@ -55,14 +52,20 @@ CODEOWNERS = ["@kuba2k2"] AUTO_LOAD = ["preferences"] IS_TARGET_PLATFORM = True -# BK72XX SDK options to disable unused features. +# BK7231N SDK options to disable unused features. # Disabling BLE saves ~21KB RAM and ~200KB Flash because BLE init code is # called unconditionally by the SDK. ESPHome doesn't use BLE on LibreTiny. # +# This only works on BK7231N (BLE 5.x). Other BK72XX chips using BLE 4.2 +# (BK7231T, BK7231Q, BK7251) cannot disable BLE via custom_options because +# the LibreTiny builder reads CFG_SUPPORT_BLE from the sys_config file at +# build-script time to decide which sources to compile - the custom_options +# override only affects C preprocessor defines, not the builder's Python logic. +# # Other options like CFG_TX_EVM_TEST, CFG_RX_SENSITIVITY_TEST, CFG_SUPPORT_BKREG, # CFG_SUPPORT_OTA_HTTP, and CFG_USE_SPI_SLAVE were evaluated but provide no # NOLINT # measurable benefit - the linker already strips unreferenced code via -gc-sections. -_BK72XX_SYS_CONFIG_OPTIONS = [ +_BK7231N_SYS_CONFIG_OPTIONS = [ "CFG_SUPPORT_BLE=0", ] @@ -383,14 +386,9 @@ async def component_to_code(config): cg.add_platformio_option("custom_fw_version", __version__) # Apply chip-specific SDK options to save RAM/Flash - if config[CONF_FAMILY] in ( - FAMILY_BK7231N, - FAMILY_BK7231Q, - FAMILY_BK7231T, - FAMILY_BK7251, - ): + if config[CONF_FAMILY] == FAMILY_BK7231N: cg.add_platformio_option( - "custom_options.sys_config#h", _BK72XX_SYS_CONFIG_OPTIONS + "custom_options.sys_config#h", _BK7231N_SYS_CONFIG_OPTIONS ) # Disable LWIP statistics to save RAM - not needed in production