mirror of
https://github.com/esphome/esphome.git
synced 2024-12-21 16:27:44 +01:00
[lvgl] Bugfixes (#7896)
This commit is contained in:
parent
982ce1db72
commit
d0958f7cf2
@ -38,7 +38,7 @@ def literal(arg):
|
|||||||
def call_lambda(lamb: LambdaExpression):
|
def call_lambda(lamb: LambdaExpression):
|
||||||
expr = lamb.content.strip()
|
expr = lamb.content.strip()
|
||||||
if expr.startswith("return") and expr.endswith(";"):
|
if expr.startswith("return") and expr.endswith(";"):
|
||||||
return expr[7:][:-1]
|
return expr[6:][:-1].strip()
|
||||||
return f"{lamb}()"
|
return f"{lamb}()"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ static const display::ColorBitness LV_BITNESS = display::ColorBitness::COLOR_BIT
|
|||||||
inline void lv_img_set_src(lv_obj_t *obj, esphome::image::Image *image) {
|
inline void lv_img_set_src(lv_obj_t *obj, esphome::image::Image *image) {
|
||||||
lv_img_set_src(obj, image->get_lv_img_dsc());
|
lv_img_set_src(obj, image->get_lv_img_dsc());
|
||||||
}
|
}
|
||||||
|
inline void lv_disp_set_bg_image(lv_disp_t *disp, esphome::image::Image *image) {
|
||||||
|
lv_disp_set_bg_image(disp, image->get_lv_img_dsc());
|
||||||
|
}
|
||||||
#endif // USE_LVGL_IMAGE
|
#endif // USE_LVGL_IMAGE
|
||||||
|
|
||||||
// Parent class for things that wrap an LVGL object
|
// Parent class for things that wrap an LVGL object
|
||||||
|
@ -35,6 +35,11 @@ LINE_SCHEMA = {
|
|||||||
cv.GenerateID(CONF_POINT_LIST_ID): cv.declare_id(lv_point_t),
|
cv.GenerateID(CONF_POINT_LIST_ID): cv.declare_id(lv_point_t),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LINE_MODIFY_SCHEMA = {
|
||||||
|
cv.Optional(CONF_POINTS): cv_point_list,
|
||||||
|
cv.GenerateID(CONF_POINT_LIST_ID): cv.declare_id(lv_point_t),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class LineType(WidgetType):
|
class LineType(WidgetType):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -43,6 +48,7 @@ class LineType(WidgetType):
|
|||||||
LvType("lv_line_t"),
|
LvType("lv_line_t"),
|
||||||
(CONF_MAIN,),
|
(CONF_MAIN,),
|
||||||
LINE_SCHEMA,
|
LINE_SCHEMA,
|
||||||
|
modify_schema=LINE_MODIFY_SCHEMA,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def to_code(self, w: Widget, config):
|
async def to_code(self, w: Widget, config):
|
||||||
|
@ -333,7 +333,7 @@ lvgl:
|
|||||||
id: button_button
|
id: button_button
|
||||||
width: 20%
|
width: 20%
|
||||||
height: 10%
|
height: 10%
|
||||||
transform_angle: !lambda return 180*100;
|
transform_angle: !lambda return(180*100);
|
||||||
arc_width: !lambda return 4;
|
arc_width: !lambda return 4;
|
||||||
border_width: !lambda return 6;
|
border_width: !lambda return 6;
|
||||||
shadow_ofs_x: !lambda return 6;
|
shadow_ofs_x: !lambda return 6;
|
||||||
@ -577,7 +577,7 @@ lvgl:
|
|||||||
- 180, 60
|
- 180, 60
|
||||||
- 240, 10
|
- 240, 10
|
||||||
on_click:
|
on_click:
|
||||||
- lvgl.widget.update:
|
- lvgl.line.update:
|
||||||
id: lv_line_id
|
id: lv_line_id
|
||||||
line_color: 0xFFFF
|
line_color: 0xFFFF
|
||||||
- lvgl.page.next:
|
- lvgl.page.next:
|
||||||
|
Loading…
Reference in New Issue
Block a user