1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-15 14:56:59 +02:00

[lvgl] Fix templated argument to lvgl.is_idle (#9014)

This commit is contained in:
Clyde Stubbs 2025-06-10 18:47:08 +10:00 committed by GitHub
parent 94848e4811
commit 1467b704b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,7 @@ from .defines import (
literal,
static_cast,
)
from .lv_validation import lv_bool, lv_color, lv_image, opacity
from .lv_validation import lv_bool, lv_color, lv_image, lv_milliseconds, opacity
from .lvcode import (
LVGL_COMP_ARG,
UPDATE_EVENT,
@ -129,14 +129,14 @@ async def lvgl_is_paused(config, condition_id, template_arg, args):
LVGL_SCHEMA.extend(
{
cv.Required(CONF_TIMEOUT): cv.templatable(
cv.positive_time_period_milliseconds
lv_milliseconds,
)
}
),
)
async def lvgl_is_idle(config, condition_id, template_arg, args):
lvgl = config[CONF_LVGL_ID]
timeout = await cg.templatable(config[CONF_TIMEOUT], [], cg.uint32)
timeout = await lv_milliseconds.process(config[CONF_TIMEOUT])
async with LambdaContext(LVGL_COMP_ARG, return_type=cg.bool_) as context:
lv_add(ReturnStatement(lvgl_comp.is_idle(timeout)))
var = cg.new_Pvariable(

View File

@ -170,6 +170,12 @@ lvgl:
lvgl.page.is_showing: page1
then:
logger.log: "Yes, page1 showing"
- if:
condition:
lvgl.is_idle:
timeout: !lambda return 5000;
then:
logger.log: LVGL is idle
on_unload:
- logger.log: page unloaded
- lvgl.widget.focus: mark