Call function that is in the main ui.ino

What do you want to achieve?

I have created an event with a button that calls a function called calibrate. i clicked don’t export function, as I thought this would mean it would look in the main ui.ino. I created a void calibrate() in the main ino but I keep getting this message.

e:\My Drive\NEW\NEW\SquareLine_Project\libraries\ui\src/ui.c:157: undefined reference to `calibrate’

I have this in my ui.c

    lv_event_code_t event_code = lv_event_get_code(e);
    lv_obj_t * target = lv_event_get_target(e);
    if(event_code == LV_EVENT_PRESSED) {
        _ui_screen_change(ui_Main, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);

I have tried renaming the void calibrate() to void calibrate (e) still the same. I’m confused on how to make this happen.


  • SquareLine Studio version:
  • Operating system:
  • Target hardware:
    esp32 using arduino ide

You’ve already defined it in ui.ino, and you’re trying to use it in your ui.c. Go through these steps:

  1. Declare your functions in ui.h - stick a void calibrate(); along with the rest of the declarations in that file
  2. Look in ui_events.c, and if there are any conflicting function declarations, delete it since it will conflict with what you have in ui.ino, but you should be fine to skip this step since you checked off “don’t export function”
  3. Delete any custom function declarations in ui_events.h since you already declared them all in ui.h

Any time you want to use a custom function, you have define it somewhere (like you did in the ui.ino) AND declare it in the header file (ui.h).

dude your a legend thank you .


Can we access function from other files ?

My file structure :
- hc_manager.cpp :
function hc_execute();
- ui.c
- ui_events.c
event on button1 to call hc_execute()

I want to execute hc_execute() from hc_manager from the ui_events
Is that possible ?