Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LVGL] Led Color uses incomplete lv_led_t typedef #681

Open
arturv2000 opened this issue Dec 29, 2024 · 1 comment
Open

[LVGL] Led Color uses incomplete lv_led_t typedef #681

arturv2000 opened this issue Dec 29, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@arturv2000
Copy link

arturv2000 commented Dec 29, 2024

Describe the bug
Setting the LED color to be setup via a vatiable, the code generated cannot compile

{
        int32_t new_val = get_var_cable_status_color();
        uint32_t cur_val = lv_color_to_u32(((lv_led_t *)objects.led_cable_status)->color);
        if (new_val != cur_val) {
            tick_value_change_obj = objects.led_cable_status;
            lv_led_set_color(objects.led_cable_status, lv_color_hex(new_val));
            tick_value_change_obj = NULL;
        }
    }

Error generated:

../Middleware/eez-gui/Feira_GUI/src/ui/screens.c:355:85: error: invalid use of incomplete typedef 'lv_led_t'
  355 |         uint32_t cur_val = lv_color_to_u32(((lv_led_t *)objects.led_actuator_status)->color);
      |                                                                                     ^~
../Middleware/eez-gui/Feira_GUI/src/ui/screens.c:364:82: error: invalid use of incomplete typedef 'lv_led_t'

To Reproduce
Steps to reproduce the behavior:

  1. Add a LED to a screen
  2. Create a variable for the LED Color (in my case of type int32_t)
  3. Assign the LED Color to the variable
  4. See error

Expected behavior
No error being generated by compiler

Workaround

Add this include on top of file screens.c

#include "lvgl/src/lvgl_private.h"

Not sure if we are suppose to use that include outside of LVGL internal code. The biggest problem may be that there is no API to get the current LED Color.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [Windows 11]
  • Version [0.21.0]
  • Compiler: gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10)

** LVGL version (if used)**

  • 9.x

Additional context
Add any other context about the problem here.

@mvladic
Copy link
Contributor

mvladic commented Dec 30, 2024

Thanks for the detailed analysis of the problem. I am aware of this problem from before and the LVGL project that uses EEZ Flow does indeed include this private header file, but I forgot to do the same in the project that does not use EEZ Flow.

As a workaround for now you can add this include in screens.c template file in Settings:

image

@mvladic mvladic added this to the 0.22.0 milestone Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants