mirror of
https://github.com/esphome/esphome.git
synced 2025-07-29 06:36:45 +00:00
[lvgl] Fix templated argument to lvgl.is_idle
(#9014)
This commit is contained in:
parent
94848e4811
commit
1467b704b8
@ -21,7 +21,7 @@ from .defines import (
|
|||||||
literal,
|
literal,
|
||||||
static_cast,
|
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 (
|
from .lvcode import (
|
||||||
LVGL_COMP_ARG,
|
LVGL_COMP_ARG,
|
||||||
UPDATE_EVENT,
|
UPDATE_EVENT,
|
||||||
@ -129,14 +129,14 @@ async def lvgl_is_paused(config, condition_id, template_arg, args):
|
|||||||
LVGL_SCHEMA.extend(
|
LVGL_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
cv.Required(CONF_TIMEOUT): cv.templatable(
|
cv.Required(CONF_TIMEOUT): cv.templatable(
|
||||||
cv.positive_time_period_milliseconds
|
lv_milliseconds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
async def lvgl_is_idle(config, condition_id, template_arg, args):
|
async def lvgl_is_idle(config, condition_id, template_arg, args):
|
||||||
lvgl = config[CONF_LVGL_ID]
|
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:
|
async with LambdaContext(LVGL_COMP_ARG, return_type=cg.bool_) as context:
|
||||||
lv_add(ReturnStatement(lvgl_comp.is_idle(timeout)))
|
lv_add(ReturnStatement(lvgl_comp.is_idle(timeout)))
|
||||||
var = cg.new_Pvariable(
|
var = cg.new_Pvariable(
|
||||||
|
@ -170,6 +170,12 @@ lvgl:
|
|||||||
lvgl.page.is_showing: page1
|
lvgl.page.is_showing: page1
|
||||||
then:
|
then:
|
||||||
logger.log: "Yes, page1 showing"
|
logger.log: "Yes, page1 showing"
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lvgl.is_idle:
|
||||||
|
timeout: !lambda return 5000;
|
||||||
|
then:
|
||||||
|
logger.log: LVGL is idle
|
||||||
on_unload:
|
on_unload:
|
||||||
- logger.log: page unloaded
|
- logger.log: page unloaded
|
||||||
- lvgl.widget.focus: mark
|
- lvgl.widget.focus: mark
|
||||||
|
Loading…
x
Reference in New Issue
Block a user