OK, maybe I misunderstand what should be happening when you create an Arduino .ino file in SLS but here’s my take…
I can get a sketch to render correctly when I use the app to create some widgets etc, but the touch functionality is so far not operational i.e. I have not managed to get the touch screen functionality of my LilyGo boards working at all using SLS. So, this has led me to investigate which of the libraries the code is accessing when it is compiled.
For example, part of the auto-code generation of SLS is to include two libraries in the
/Libraries folder of the folder where your project is located, I see both the TFT_eSPI and LVGL libraries contained in this folder. However, upon compilation the code does not refer to these libraries, moreover it refers to libraries created in the
/Arduino15 folder which was created when the ArduinoIDE was initially installed, and were installed as part of the board packages selected.
Now, which libraries should the SLS code in the
/UI directory be referencing ? Is it the libraries in the
/Arduino15/Libraries folder. or the libraries in the
If it is not the latter, then why are those libraries even created as part of the project, or have I missed a step in the process somewhere here? Surely for example, the #include
#include "lvgl.h" folder referenced in the .ino code generated by SLS should be the
/YourProjectName/Libraries/lvgl folder, yes? and not any other /lvgl folder on the computer?
@kisvegabor - could you or anyone elaborate and explain for me please? Many thanks.
Take a look at the README of the exported project. It says:
Go to File/Preferences and set Sketchbook location to the path of your UI project (where this README is located)
Well blow me down with a feather :). OK, that was the first part of my issue. I thought I had done this, but I missed the fact the when I exported again SLS created a new folder in the existing folder so the Sketchbook location was not correct. Apologies.
So… now on to further investigation. The correct libraries are being referenced now but there’s still no touch screen activity on my slider. I have added the event in the Events tab for the slider - have I done this correctly?
Regarding the touch, we haven’t found a touch library which is as flexible as TFT_eSPI, so the touch is not supported in the exported project out of the box.
Fortunately, there are many Arduino libs for various touch controllers that you can easily integrate using the skeleton in the INO file.
In the event you are trying to apply a bar related action on a slider. I suggest just creating a slider first and trying make it adjustable with touchpad without any extra events.
Thanks again for your reply, much appreciated. Yes, I agree with you that the TFT_eSPI library is pretty wonderful when it comes to graphics and layouts (as is lvgl) but for touch actions and events… not so! I will investigate what you suggest and if I get success will report here as always.
On to the point you make that I quoted, I wonder if I might make a suggestion that I think would help many of your users.
It would be extremely helpful, particularly for us self taught developers, if you could show some form of process / overview / ‘what happens’ in the overall structure of the .ino and associated files when a SquareLine Studio project is exported into a template and UI files. Not sure I am articulating what I am suggesting very clearly here, but for example, looking at the
void loop() in the .ino file (something in which most of us are familiar with) it says…
> void loop()
> lv_timer_handler(); /* let the GUI do its work */
now, I appreciate we can look into what …
/* let the GUI do its work */ … actually means, but an overall process diagram or summary type overview might also help - not just for that specific comment, but for the whole process. What does the
lv_timer_handler() actually do? What widgets if any are they attached to? What is the duration / frequency of any event handled? What are the events that it handles? Have I added any widgets that are handled by this? If so, where are they? You see where I am going here…?
I appreciate we can insert our own code into the loop or create functions / classes / methods that are all called from within the
void loop(), but some additional clarification might help.
I will take a look further at the touchlib.h library and try to get that to act upon the slider I added in my code (something which I also need to be easy to locate within the SLS generated code - where is it?).
Sorry if I haven’t articulated myself very clearly, and maybe it’s all already there in the documentation… but this is just my thought. Cheers.
Thank you for the feedback. It’s very valuable!
What about adding something like this?
/* LVGL will handle redrawing, input device, animation and event handling in lv_timer_handler
* You can call your own functions besides lv_timer_handler but keep in mind that
* it might run longer if larger areas needs to be redrawn*/
You’re very welcome, I will continue to contribute as I find ways of moving forward with SLS.
Over the next week, I will start to add some of my own functions to the void Loop() code, that specifically update areas of the screen ‘enclosed’ in the GUI design; eg: I have a few temp/pressure/humid sensors that I have been working with, I will write some code as a function that displays these values which is then called int he loop and see how well it integrates with the gui. I also want to try to get at least some touch functionality in sliders and widgets created with SLS.
I will report back in time.
Thanks again for your replies, it shows you are interested, so my thanks to you for that.