[lvgl] Add direct use of mapping (#15863)

This commit is contained in:
Clyde Stubbs
2026-07-08 13:00:42 -04:00
committed by GitHub
parent bba3a9657b
commit b787281388
6 changed files with 128 additions and 15 deletions
+2 -2
View File
@@ -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:
+28 -3
View File
@@ -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"