From e8c5dfca3ecc959f17722bdafb13471ad4e3f1a0 Mon Sep 17 00:00:00 2001 From: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Date: Tue, 24 Mar 2026 02:09:30 +1000 Subject: [PATCH] [lvgl] Various fixes (#15098) --- esphome/components/lvgl/__init__.py | 8 +++++++- esphome/components/lvgl/lvgl_esphome.h | 2 +- esphome/components/lvgl/widgets/textarea.py | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/esphome/components/lvgl/__init__.py b/esphome/components/lvgl/__init__.py index c37a32ecca..a6afa12afa 100644 --- a/esphome/components/lvgl/__init__.py +++ b/esphome/components/lvgl/__init__.py @@ -226,6 +226,9 @@ async def to_code(configs): config_0 = configs[0] # Global configuration if CORE.is_esp32: + # Skip compiling lvgl examples + add_idf_sdkconfig_option("CONFIG_LV_BUILD_EXAMPLES", False) + add_idf_sdkconfig_option("CONFIG_LV_BUILD_DEMOS", False) if get_esp32_variant() == VARIANT_ESP32P4: add_idf_sdkconfig_option("CONFIG_LV_DRAW_BUF_ALIGN", 64) # disable use of PPA for fills until upstream bugs fixed @@ -406,7 +409,10 @@ async def to_code(configs): lv_conf_h_file = CORE.relative_src_path(LV_CONF_FILENAME) write_file_if_changed(lv_conf_h_file, generate_lv_conf_h()) cg.add_build_flag("-DLV_CONF_H=1") - cg.add_build_flag(f'-DLV_CONF_PATH=\\"{LV_CONF_FILENAME}\\"') + # handle windows paths in a way that doesn't break the generated C++ + lv_conf_h_path = Path(lv_conf_h_file).as_posix() + cg.add_build_flag(f'-DLV_CONF_PATH=\\"{lv_conf_h_path}\\"') + cg.add_build_flag("-DLV_KCONFIG_IGNORE") for prop in df.get_remapped_uses(): df.LOGGER.warning( diff --git a/esphome/components/lvgl/lvgl_esphome.h b/esphome/components/lvgl/lvgl_esphome.h index 8e34f16c98..66f823d549 100644 --- a/esphome/components/lvgl/lvgl_esphome.h +++ b/esphome/components/lvgl/lvgl_esphome.h @@ -71,7 +71,7 @@ inline void lv_style_set_text_font(lv_style_t *style, const font::Font *font) { lv_style_set_text_font(style, font->get_lv_font()); } #endif -#ifdef USE_IMAGE +#if defined(USE_LVGL_IMAGE) && defined(USE_IMAGE) // Shortcut / overload, so that the source of an image can easily be updated // from within a lambda. inline void lv_image_set_src(lv_obj_t *obj, esphome::image::Image *image) { diff --git a/esphome/components/lvgl/widgets/textarea.py b/esphome/components/lvgl/widgets/textarea.py index e5ab884685..baa40ee2c6 100644 --- a/esphome/components/lvgl/widgets/textarea.py +++ b/esphome/components/lvgl/widgets/textarea.py @@ -16,6 +16,7 @@ from ..lv_validation import lv_bool, lv_int, lv_text from ..schemas import TEXT_SCHEMA from ..types import LvText from . import Widget, WidgetType +from .label import CONF_LABEL CONF_TEXTAREA = "textarea" @@ -46,6 +47,9 @@ class TextareaType(WidgetType): TEXTAREA_SCHEMA, ) + def get_uses(self): + return (CONF_LABEL,) + async def to_code(self, w: Widget, config: dict): for prop in (CONF_TEXT, CONF_PLACEHOLDER_TEXT, CONF_ACCEPTED_CHARS): if (value := config.get(prop)) is not None: