Attempting to build a UI interface that has buttons and a slider indicator to show the level of food in a hopper. This is an Arduino project that will eventually run on an ESP32 device with a 480x320 LCD touch display.
What have you tried so far?
Built the project in SquareLine Studio with two screens as step 1. This version compiled and functioned on the ESP32 the same as it did in SLS. Clicking on the button took me to the other screen.
After I added the slider widget and renamed the buttons from the default, the code no longer compiles in the Arduino compiler. Now it throws an error about “ui_Button1” being undeclared. I saved and exported the project files successfully.
I discovered that the error is being caused by missing declarations in the ui.c file. I’m not sure why they are missing so if anyone can help out that would be great.
When I compile in the Arduino IDE it fails on missing declarations in the ui.c file. If I add the missing declaration to the respective ui.c init function as shown below in the images then it no longer fails on that issue.
The first image shows the compile error for missing declaration for ui_Label14. The second image shows me adding the declaration to the ui.c “ui_Screen2_screen_init()” function. After that the compile does not error on this but finds another missing declaration. Anyone know why it is doing this?
I seem to have a workaround for this that doesn’t involve adding missing declarations to the ui.c file but there is definitely a bug in the SLS export code.
I created a new project and in project settings I set the “Flat export” setting to cause all files to be in the same directory. My project now compiles in the Arduino IDE.
Im in the same situation, the export files in arduino is catastrofic !!
When you rename or delete screens or controls do not delete del old declarations. Also depend of the case, the code for expotation has a big bug !
But…looks nobody care .
We could not reproduce the bug you mention, for us after recreating a similar project in SLS-v1.3.3 with Arduino-TFT_eSPI 1.1.1 and similar chain of modifications, every button variable was exported fine by using ‘Export UI files’ menupoint, and the project was recompiled successfully in Arduino-IDE.
In any case, the above mentioned workaround mentioned by @Buster999 might help in your situation: According to SquareLine documentation, the ‘Flat’ export-mode is purposefully created to ease the building of projects in Arduino-IDE.
See more here: ‘Project Settings’ part of the Document
See the extract from the documentation:
" * Flat export - If Flat export is enabled in Project settings then all the UI files will be exported into a single folder, instead of into screens, fonts, images, etc folders. It might be useful for some build systems (e.g. Arduino) where directories are not processed."