eez-open / studio

Cross-platform low-code GUI and automation
https://www.envox.eu/studio/studio-introduction/
GNU General Public License v3.0
362 stars 73 forks source link

[LVGL]: Code-generation for User Widgets contains flow related code fragments also in lvgl only projects #373

Closed mverch67 closed 2 months ago

mverch67 commented 3 months ago

Describe the bug Code-generation for plain lvgl project leads to compiler errors when the project contains user widgets, e.g.

Compiling .pio/build/native-tft-debug/lib/device-ui/generated/ui_320x240/screens.c.o
lib/device-ui/generated/ui_320x240/screens.c: In function ‘create_screen_main_screen’:
lib/device-ui/generated/ui_320x240/screens.c:1771:75: error: ‘flowState’ undeclared (first use in this function)
 1771 |                     create_user_widget_ok_cancel_widget(obj, getFlowState(flowState, 0), 91);
      |                                                                           ^~~~~~~~~
lib/device-ui/generated/ui_320x240/screens.c:1771:75: note: each undeclared identifier is reported only once for each function it appears in
lib/device-ui/generated/ui_320x240/screens.c: In function ‘tick_screen_main_screen’:
lib/device-ui/generated/ui_320x240/screens.c:1781:52: error: ‘flowState’ undeclared (first use in this function)
 1781 |     tick_user_widget_ok_cancel_widget(getFlowState(flowState, 0), 91);
      |                                                    ^~~~~~~~~

To Reproduce Steps to reproduce the behavior:

  1. Create new plain lvgl project (i.e. no flow, no eez-framework)
  2. Create a user widget, e.g. with a panel and button
  3. Add this widget to a page
  4. Generate the code
  5. Search screen.c for "flow"

Expected behavior Generated code is compile clean.

Screenshots image

Desktop (please complete the following information):

LVGL version:

eez-studio version:

Additional context Add any other context about the problem here.

mvladic commented 3 months ago

Fixed. References to the flowState in generated code are removed when eez-flow is not used.