mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
[lvgl] Fix text component (#7563)
This commit is contained in:
parent
1a567b6986
commit
fc97a6d1e3
3 changed files with 13 additions and 3 deletions
|
@ -34,13 +34,13 @@ async def to_code(config):
|
||||||
widget = widget[0]
|
widget = widget[0]
|
||||||
await wait_for_widgets()
|
await wait_for_widgets()
|
||||||
async with LambdaContext([(cg.std_string, "text_value")]) as control:
|
async with LambdaContext([(cg.std_string, "text_value")]) as control:
|
||||||
await widget.set_property("text", "text_value.c_str())")
|
await widget.set_property("text", "text_value.c_str()")
|
||||||
lv.event_send(widget.obj, API_EVENT, None)
|
lv.event_send(widget.obj, API_EVENT, cg.nullptr)
|
||||||
control.add(textvar.publish_state(widget.get_value()))
|
control.add(textvar.publish_state(widget.get_value()))
|
||||||
async with LambdaContext(EVENT_ARG) as lamb:
|
async with LambdaContext(EVENT_ARG) as lamb:
|
||||||
lv_add(textvar.publish_state(widget.get_value()))
|
lv_add(textvar.publish_state(widget.get_value()))
|
||||||
async with LvContext(paren):
|
async with LvContext(paren):
|
||||||
widget.var.set_control_lambda(await control.get_lambda())
|
lv_add(textvar.set_control_lambda(await control.get_lambda()))
|
||||||
lv_add(
|
lv_add(
|
||||||
paren.add_event_cb(
|
paren.add_event_cb(
|
||||||
widget.obj,
|
widget.obj,
|
||||||
|
|
|
@ -135,3 +135,9 @@ wifi:
|
||||||
time:
|
time:
|
||||||
platform: sntp
|
platform: sntp
|
||||||
id: time_id
|
id: time_id
|
||||||
|
|
||||||
|
text:
|
||||||
|
- id: lvgl_text
|
||||||
|
platform: lvgl
|
||||||
|
widget: hello_label
|
||||||
|
mode: text
|
||||||
|
|
|
@ -151,6 +151,10 @@ lvgl:
|
||||||
align: center
|
align: center
|
||||||
text_font: montserrat_40
|
text_font: montserrat_40
|
||||||
border_post: true
|
border_post: true
|
||||||
|
on_press:
|
||||||
|
lvgl.label.update:
|
||||||
|
id: hello_label
|
||||||
|
text: Goodbye
|
||||||
on_click:
|
on_click:
|
||||||
then:
|
then:
|
||||||
- lvgl.animimg.stop: anim_img
|
- lvgl.animimg.stop: anim_img
|
||||||
|
|
Loading…
Reference in a new issue