mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 23:54:04 +08:00
[lvgl] Fix templated argument to lvgl.is_idle (#9014)
CI / Create common environment (push) Has been cancelled
CI / Check ruff (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (macOS-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.10) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Run pytest (windows-latest, 3.11) (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / Run script/clang-tidy for ZEPHYR (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test ${{ matrix.file }} (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / CI Status (push) Has been cancelled
YAML lint / yamllint (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04-arm) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04-arm) (push) Has been cancelled
Stale / stale (push) Has been cancelled
Stale / close-issues (push) Has been cancelled
Lock / lock (push) Has been cancelled
Publish Release / Initialize build (push) Has been cancelled
Publish Release / Build and publish to PyPi (push) Has been cancelled
Publish Release / Build ESPHome amd64 (push) Has been cancelled
Publish Release / Build ESPHome arm64 (push) Has been cancelled
Publish Release / Publish ESPHome docker to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome docker to ghcr (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to ghcr (push) Has been cancelled
Publish Release / deploy-ha-addon-repo (push) Has been cancelled
Publish Release / deploy-esphome-schema (push) Has been cancelled
CI / Create common environment (push) Has been cancelled
CI / Check ruff (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (macOS-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.10) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Run pytest (windows-latest, 3.11) (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / Run script/clang-tidy for ZEPHYR (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test ${{ matrix.file }} (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / CI Status (push) Has been cancelled
YAML lint / yamllint (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04-arm) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04-arm) (push) Has been cancelled
Stale / stale (push) Has been cancelled
Stale / close-issues (push) Has been cancelled
Lock / lock (push) Has been cancelled
Publish Release / Initialize build (push) Has been cancelled
Publish Release / Build and publish to PyPi (push) Has been cancelled
Publish Release / Build ESPHome amd64 (push) Has been cancelled
Publish Release / Build ESPHome arm64 (push) Has been cancelled
Publish Release / Publish ESPHome docker to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome docker to ghcr (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to dockerhub (push) Has been cancelled
Publish Release / Publish ESPHome ha-addon to ghcr (push) Has been cancelled
Publish Release / deploy-ha-addon-repo (push) Has been cancelled
Publish Release / deploy-esphome-schema (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user