Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion esphome/components/lvgl/lvgl_esphome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ int16_t lv_get_needle_angle_for_value(lv_obj_t *obj, int value) {
360;
}

void lv_image_set_needle_value(lv_obj_t *obj, int value) {
// Rotation is handled by set_style_transform_rotation in the generated code;
// this just ensures the image is redrawn.
lv_obj_invalidate(obj);
}

void lv_arc_set_needle_value(lv_obj_t *obj, int value) { lv_obj_invalidate(obj); }

void IndicatorLine::set_obj(lv_obj_t *lv_obj) {
LvCompound::set_obj(lv_obj);
lv_line_set_points(lv_obj, this->points_, 2);
Expand Down Expand Up @@ -424,10 +432,14 @@ void LvButtonMatrixType::set_obj(lv_obj_t *lv_obj) {
#endif // USE_LVGL_BUTTONMATRIX

#ifdef USE_LVGL_KEYBOARD
// clang-format off
static const char *const KB_SPECIAL_KEYS[] = {
"abc", "ABC", "1#",
"abc",
"ABC",
"1#",
// maybe add other special keys here
};
// clang-format on

void LvKeyboardType::set_obj(lv_obj_t *lv_obj) {
LvCompound::set_obj(lv_obj);
Expand Down
7 changes: 4 additions & 3 deletions esphome/components/lvgl/widgets/meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,13 @@ async def create_to_code(self, config: dict, parent: MockObj):
if t == CONF_IMAGE:
add_lv_use(CONF_IMAGE)
src = v[CONF_SRC]
src_data = CORE.data[IMAGE_DOMAIN][str(src)]
src_data = CORE.data[IMAGE_DOMAIN]["metadata"][str(src)]
pivot_x = await pixels.process(v[CONF_PIVOT_X])
pivot_y = await pixels.process(
v.get(CONF_PIVOT_Y, src_data[CONF_HEIGHT] // 2)
v.get(CONF_PIVOT_Y, src_data.height // 2)
)
props = {
CONF_X: src_data[CONF_WIDTH] // 2 - pivot_x,
CONF_X: src_data.width // 2 - pivot_x,
"transform_pivot_x": pivot_x,
"transform_pivot_y": pivot_y,
CONF_SRC: src,
Expand All @@ -533,6 +533,7 @@ async def create_to_code(self, config: dict, parent: MockObj):
CONF_ALIGN: CHILD_ALIGNMENTS.CENTER,
}
iw = await widget_to_code(props, image_indicator_type, scale_var)
await iw.set_property(CONF_SRC, await lv_image.process(src))
await set_indicator_values(iw, v)

# Add a pivot
Expand Down