mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 11:26:39 +00:00
[lvgl] Add direct use of mapping (#15863)
This commit is contained in:
@@ -91,8 +91,8 @@ binary_sensor:
|
||||
animation: move_right
|
||||
time: 600ms
|
||||
- platform: lvgl
|
||||
id: button_checker
|
||||
name: LVGL button
|
||||
id: common_button_checker
|
||||
name: Common button
|
||||
widget: spin_up
|
||||
on_state:
|
||||
then:
|
||||
|
||||
@@ -263,6 +263,9 @@ lvgl:
|
||||
bg_opa: !lambda return 0.5;
|
||||
- lvgl.image.update:
|
||||
id: lv_image
|
||||
src:
|
||||
mapping: image_map
|
||||
value: !lambda return round(1.0);
|
||||
scale: !lambda return 512;
|
||||
rotation: !lambda return 100;
|
||||
pivot_x: !lambda return 20;
|
||||
@@ -388,9 +391,16 @@ lvgl:
|
||||
text_font: montserrat_40
|
||||
border_post: true
|
||||
on_press:
|
||||
lvgl.label.update:
|
||||
id: hello_label
|
||||
text: Goodbye
|
||||
- lvgl.label.update:
|
||||
id: hello_label
|
||||
text:
|
||||
mapping: lvgl_string_map
|
||||
value: !lambda return 2;
|
||||
- lvgl.label.update:
|
||||
id: hello_label
|
||||
text:
|
||||
mapping: lvgl_string_map
|
||||
value: 2
|
||||
on_click:
|
||||
then:
|
||||
- lvgl.animimg.stop: anim_img
|
||||
@@ -1496,6 +1506,21 @@ image:
|
||||
invert_alpha: true
|
||||
transparency: alpha_channel
|
||||
|
||||
mapping:
|
||||
- id: image_map
|
||||
from: int
|
||||
to: image
|
||||
entries:
|
||||
0: cat_image
|
||||
1: dog_image
|
||||
- id: lvgl_string_map
|
||||
from: int
|
||||
to: string
|
||||
entries:
|
||||
0: "First"
|
||||
1: "Second"
|
||||
2: "Third"
|
||||
|
||||
color:
|
||||
- id: light_blue
|
||||
hex: "3340FF"
|
||||
|
||||
Reference in New Issue
Block a user