What MCU/Processor/Board and compiler are you using?
ESP32 in Arduino IDE
What LVGL version are you using?
v 7.11
What do you want to achieve?
I would like to change color of the wifi symbol when value of the glolbal variable change.
What have you tried so far?
I tried to find some examples, but so far none of them point me to the right direction.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
Ok, but this will be just one time change, right? Sorry, I probably not made it clear, that I want to recolor symbol if value of the variable change. So if I´m connected, it will be green and if I lost connection, it will be grey. That is the reason why I try it via event callback.
Simple way is put this instructions inside main loop:
if ((WiFi.status() != WL_CONNECTED) ) {
change wifi label colour here
and call WiFi.reconnect(); if you want reconnect automatically // in wifi reconnect you can put default colour if connected
}
or use a handler that change colours when status wifi change for example this:
void Wifi_disconnected(WiFiEvent_t event, WiFiEventInfo_t info){
Serial.println("Disconnected from WIFI access point");
Serial.print("WiFi lost connection. Reason: ");
Serial.println(info.disconnected.reason);
Serial.println("Reconnecting...");
change label colours
and call WiFi.reconnect(); if you want reconnect automatically
}