Skip to content

fix: migrate LVGL 8 API calls to LVGL 9#87

Open
pfefferle wants to merge 1 commit into
m5stack:mainfrom
pfefferle:fix/lvgl-9-migration
Open

fix: migrate LVGL 8 API calls to LVGL 9#87
pfefferle wants to merge 1 commit into
m5stack:mainfrom
pfefferle:fix/lvgl-9-migration

Conversation

@pfefferle
Copy link
Copy Markdown
Contributor

Summary

ESPHome 2026.4.0 upgraded the bundled LVGL from 8.x to 9.x, which is a breaking API change. The Tab5 scripts currently fail to compile against the new LVGL version with errors like:

error: too few arguments to function 'void lv_canvas_set_px(lv_obj_t*, int32_t, int32_t, lv_color_t, lv_opa_t)'
error: invalid conversion from 'void*' to 'lv_obj_t*'

This PR migrates the affected calls to the LVGL 9 API:

  • lv_canvas_set_px — added the now-required lv_opa_t opacity argument (LV_OPA_COVER for the existing fully-opaque behavior).
  • lv_event_get_target — switched to lv_event_get_target_obj, the LVGL-9-native typed helper. The old name now returns void * because the target isn't always an lv_obj_t anymore.
  • lv_obj_clear_flag / lv_obj_clear_state — renamed to lv_obj_remove_flag / lv_obj_remove_state. The old names still work via compat wrappers but were renamed in LVGL 9 and may be dropped in future ESPHome releases.

Files touched:

  • common/tab5-scripts.yaml
  • common/tab5-ha-hmi.yaml

No behavioral change — pure API migration.

Test plan

  • Build the m5stack-tab5 example against ESPHome 2026.4.0+ and confirm it compiles.
  • Flash to a Tab5 and verify the color palette indicator (uses lv_event_get_target_obj and lv_canvas_set_px) still tracks touch input and updates the selected color.
  • Verify the AC HMI panel still enables/disables correctly when the bound entity becomes unavailable (exercises the lv_obj_remove_flag / lv_obj_remove_state paths).

ESPHome 2026.4.0 upgraded to LVGL 9, which broke the Tab5 scripts:

- lv_canvas_set_px gained a required lv_opa_t opacity argument
- lv_event_get_target now returns void *; use lv_event_get_target_obj
  for a typed lv_obj_t * (safer for non-object dispatchers)
- lv_obj_clear_flag / lv_obj_clear_state were renamed to
  lv_obj_remove_flag / lv_obj_remove_state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant