Declaring a Function in Squirelene and implementing it in main()

I’m making an application using squireline and an Arduino template. When modifying any detail in the project, the contents of the /ui folder are reset, including functions that I may have implemented.

I would like to implement the functions outside the /ui folder, so I don’t lose my work. For example, I would like to implement the functions declared in Squireline within the main() function.

Does anyone have any tips on how I can do this. This way I only need to worry about copying and pasting the /ui folder. I know it’s possible because I have an old project that does this without giving a duplicate function declaration error.

In my old project, there is the declaration of the function prototype and there is the empty function, but there is no conflict with the functions of the same name that are in main().

I would like to not have to change the source files generated by squireline, I would like to just copy the /ui folder and compile without error.

thanks

When you define a CALL_FUNCTION action you have the option to ‘don’t export’ it, just check it in the inspector panel below the name of the function. In that case it will be referred to but not created in ui_events.c. You should define it yourself in a scope where the exported ui-code can see it. (Not sure if main.c is the best place for that, especially not as nested in the main() function you mention several times. But it might depend on your toolchain.)

Thanks for your help.

1 Like