Howto get events(button and switches) to work on Arduino IDE

Okay i see people are asking how to get the buttons to work in Arduino IDE, but no real answer. As i was one of those people asking as well. with no real helpful reply. but I finally got it work for me.
I set it to export as *.cpp in your project preference .
exported project as per usual

then go to ui_events.cpp copy all the events and paste into ui.ino then you can delete ui_events.cpp or rename to ui_evets.cpp-bak

then load ui.ino and edit to your desired event actions for each event - and compile and upload with ArduinoIDE

1 Like

In v1.2.3 it should work better.

In project properties you can select

This lv_event.c/cpp won’t be created and you can add the events anywhere you wish. (E.g. in the INO file).

Please let me know if it work on your end too.

that is what i am doing sort of doing to get it to work …But I generate the .cpp then copy the events to my ino. then delete events.cpp. all is good now on that front and working fine.

but running into other issues;

  1. for some reason once i pass ~100 label the screen boots up and stays black and is frozen as it no longer receives serial inputs which come every 5-10 seconds to uart2
  2. animation does not work for me. I get compiling errors but I think that is related to the lvgl library that at version 8.2. when i upgrade to 8.3 I do not get errors but the screen is sent into an endless crash loop ( even on previously working sketches ) . so i will sit down one day and look to see what the animation difference between the different 8.2 and 8.3 library version and modify the output manually to be compatible.
  3. for some reason squareline does not generate all of the events in ui_events.cpp. so I just add in the missing ones manually when I copy them over to ui.ino ( but I mentioned this in you bug section yesterday)

Probably it’s an out of memory issue. Try increasing LV_MEM_SIZE in lv_conf.h.

True, it turned out that the new way we manage the animations are not compatible with v8.2. we are thinking about how to manage it.

thank you for the reply –
as to LV_MEM_SIZE in lv_conf.h. I find this in the config file

    /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
    #define LV_MEM_SIZE (48U * 1024U)   

un certain what I should modify 48U or 1024 or both

It’s just a simple multiplication so you can modify any of these or just write a number there (e.g. 60000), however for the sake of readibility I’d write e.g. 64 * 1024.

thank you again for the replay --curios do you have keep it divisible by 8 like how it is for audio encoding and other computer stuff . for best results divisible by 8 works best

It’s not required at all, I just like round number :smiley:

62148 would work equally good as well.

okay that solved my issue of black screen when I loaded after a certain point . i changed it to 56U. and all is well and workng fine…

on other issue I mention before having problem starting squarestudio. it start and then shut off right away… and I had to start older version first ( or hammer away clicking to start the program) and then the newer one would start… – well i change my video card from an AMD radeon to Nvidia GTx and the problem disappeared . though other problems arose from that. first the trial time reset which was fine but . I now have hard time creating and exporting projects. I get an exception of NULL value when I try… it is either get the exception when creating a project, if it makes it past that point . I get an exception on when trying to export … to correct the issue when it arises I have shut off the computer restart then maybe I can created or maybe not . if it does not create or export after the 1st restart. restart again then open an older program first then the newer version will then create and export again ( the older versions do not have the same issue as V1.2.3 they will create and export but they are not compatible with the with what was created with 1.2.3 so they either do not display or only display partially

@sash Hi, please send the log of a problematic run, and if it crash, we need the crashlogs too.
We are very sorry, but we can’t help without the logs.

@Marton okay as to log file - where do they exist. or is that what is displayed in console… how does one export from there as it seams I can not copy paste only take snapshot

while i was hunting around looking for log export option… I think I see the problem… none of the boards are currently loading … once i fight with it to finally load the boards then it will export … it currently still stuck like this so I leave it like this until you reply with other info if required.

this was also a fresh start the computer was turned off. and when i shut the computer down yesterday all was working fine. this morning it back to the same

version 1.2.3 load with out any boards

version 1.1.1 loads with boards

since I have not heard from you in the last 7 hrs I will now restarted to try to get it to work … if you need more info I will grab it… since the the problem is very persistent . I might switch back to the radeon and see if it goes away. as it was more functional fighting with it to start and clicking it several times run then to have it start consistently with nvidia GT video card and not have any boards load and having to restart and fight with it to load the boards