V1.4 - A nasty surprise for the unsuspecting

  • SquareLine Studio version: 1.4
  • Operating system: MacOS
  • Target hardware: N/A

Like many, I have always exported the UI files directly into the sketch folder where the main .ino sketch lives. This makes it easy to update the UI, export and then immediately do a compile in the Arduino IDE.

But in an attempt to clean up old files, SLS 1.4 deletes every file in the export directory before exporting the new files. What a surprise when I modifiied code in my main sketch, only to find the new sketch wiped out when I subsequently exported the UI from SLS.

One way around this is to always export the UI files to another directory and then copy the files into the main sketch folder. An unwelcomed extra step in the workflow.

The other way is the revert to SLS v1.3.4. That is what I am choosing to do for now.

Good to know it’s more convenient for you and others to have the exported UI files of ‘ui’ folder directly in the sketch folder. But yes, SquareLine Studio 1.4.0 now deletes the contents of the UI folder selectively (leaving e.g. ui_events.c) before exporting the UI to ensure there are no residues left which could cause compile errors (I see your comments in the corresponding topic: SLS exports a deleted screen and breaks compilation ). The UI files are in the ‘ui’ folder for a reason, not to coincide with your project files using them. Probably there’s a way to determine for sure which files are residues of deleted screens/etc. and which are your own code, but in SquareLine Studio there doesn’t seem to be a handling for this scenario currently. Anyway, thanks for the feedback, this feature request gives a material for further discussions.

I’ve gone back to V1.4 to give it a second try.

I think that having it export into a separate directory probably isn’t a bad idea after all. While this is an extra step in my former workflow, I can see certain advantages now.

Thanks for your reply and thoughts.

1 Like

Hi, in 1.3.4 when check the option dont export “Call functions export file” the ui_events.cpp, dont export. but dont delete it, on 1.4.0 delete the file, please can you recover the last export type on next version 1.4.1.

Thanks

Not sure I get every details of what you mean. Could you please rephrase it?

When Export UI Files, in Project settings, if option “Call functions export file” is mark with “dont export”, dont export file ui_event.cpp, but if exist, is deleted, this is the problem.

Hermit, did you see the issue?

I reproduced what you mean. The ui_events.c/.cpp file gets deleted when you press ‘Create Template Project’ menupoint, but not deleted when you press only ‘Export UI Files’ menupoint. I guess it’s the intended operation in SquareLine Studio 1.4 because it now deletes unnecessary files or residues of previous exports (as it was requested several times.) Maybe a filter to check if it contains custom code, and not deleting if it is, would be more adequate working in your case. I’ll ask about this from the responsible staff.

This is also causing me problems… I think is nice to have the ui files in a seperate folder, it makes things more organised. But how would you include this folder in the main sketch? I’m getting errors when I compile the code, that I have “Undefined references to …” and I know is due to the seperate ui folder that I created.

I’m using Arduino IDE. I have also changed the ui.h file in the main sketch so it is pointing to the right location. But I’m still getting errors.

@subzero89
I have opted to do it the Neanderthal way… copy the newly generated UI files from the UI folder into the main sketch folder. One can always write a script to make it a one-click procedure.

Yes, but is additional step in the process which is annoying, specially when you test the code and the gui multiplie times, which I do…Now I cant get the functions in the code to be recognized by Arduino. Which is also do to the the way the source folders are being structered… I really hope we can get a nicer fix for this.

I finally fixed the problem. Here are a summary for the things I had to do to fix it:

  1. Use Squareline Studio to generate the templets files and folders when you export your ui. This will generate the libraries and the files and folders for the ui plus the uno file for arduino.
  2. Open the uno file in arduino and change the sketchbook location in File > Preference to the root folder that was exported from Squareline Studio.
  3. Now Arduino will find some updates for the libraries that is included in your folder, which is either the TFT_eSPI or/and the lvgl library.
  4. here is the tricky part that gave me allot of headache. DON’T update the lvgl library to the latest one, this will give you variable declaration issues. Instead use version 8.4.0 . this worked for me.
  5. You can update the TFT_eSPI library to the latest one, it should not cause any problems.
  6. Now compile to make sure it compiles successfully.
  7. Now every time you make changes in your Squareline Studio for your gui, just export the ui files to yourProjectName/libraries/ui/src. This will overwrite you ui files but without modifying your other files and your uno file.

I hope this helps!

1 Like