Squareline GUI + Sunton ESP32-8048S043 4.3" 800x480 capacitive touch display

But for my last puzzle piece I need some further help.

I now have everything setup, display works with Squareline GUI and touch as well.

What I am trying to achieve is when a button on the Squareline GUI is pressed, a HEAD http request is send.

I have the connect to Wifi and Http request script and it works in the main.cpp:

// Wifi Setup
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "PUT-SSID-HERE";     // Replace with your network SSID (name)
const char* password = "PUT-PW-HERE";   // Replace with your network password

void setup() {
  Serial.begin(115200); // Begin serial communication at 9600 baud rate

  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void sendHEADRequest(String url) {
  HTTPClient http;
  // Your URL for the HEAD request
  http.begin(url);
  int httpCode = http.sendRequest("HEAD");
  //http.end();
}

void loop()
{
  // Head Request Test -> BLUE COLOR
  sendHEADRequest("http://192.168.178.59/win&A=128&FX=0&R=0&G=0&B=255"); // Replace with your URL
  Serial.println("Head request send!!!");
  delay(3000); // Debouncing delay
}

But putting the code in the main.cpp obviously does not work in combination with the button press. I identified the function call for my button is in “ui.c”:

///////////////////// FUNCTIONS ////////////////////
void ui_event_Button1( lv_event_t * e) {
    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_RELEASED) {
      _ui_screen_change( &ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0, &ui_Screen2_screen_init);
      _ui_screen_delete( &ui_Screen1);
}

But if I just change it to:

void ui_event_Button1( lv_event_t * e) {
    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_RELEASED) {
      _ui_screen_change( &ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0, &ui_Screen2_screen_init);
      _ui_screen_delete( &ui_Screen1);
      sendHEADRequest("http://192.168.178.59/win&A=128&FX=0&R=0&G=255&B=0"); // Replace with your URL
}

… it throws a couple of errors because of course the ui.c files is not aware of the libraries and function definitions.

I am quite new to C … could someone help me understand this and get it to work? What would be the easiest way to make “ui.c” aware of the function … or to put it there directly? But then I get a few errors because some libraries are missing / not correctly routed to that file…