LVGL hangs in platformIO

I have a very perplexing issue. In my main.ccp
void loop() {
lv_timer_handler(); /* let the GUI do its work /
delay(10); /
let this time pass */
lv_timer_handler();
lv_task_handler();
ui_tick();
// put your main code here, to run repeatedly:
myctr = myctr + 1;
if (myctr > 1000) myctr = 0;
Serial.println(myctr);
}
while the loop is running. I see the number increase (All good)
I can navigate from screen to screen (No issues) and the counter still show
Pressing the Scan button calls the lvgl function “btnScanNetwork”
void action_btn_scan_network(lv_event_t *e) {
if (e == NULL) {
Serial.println(“Event is null”);
} else {
Serial.println(“Event is not null”);
set_var_var_networks(ScanWiFi().c_str()); (a call to grab all the WiFi networks, update the lvgl variable var_networks. The options of the dropdown are from that variable )
}
}
This works to a point. no other lvgl events take place, the Serial.println(“Event is not null”); doesn’t work, the counter stops incrementing (loop is not returned to)
What am I missing here? thanks in advance



Hi

Not a concrete explanation, but some questions / remarks (I don’t use Arduino framework, so some comments may not apply)…

In your loop, you don’t to call lv_timer_handler repeatedly and aldo lv_task_handler, you can have just:

void loop()
{
    lv_timer_handler(); /* let the GUI do its work /
    ui_tick();
    delay(10); / let this time pass */
    // put your main code here, to run repeatedly:
    myctr = myctr + 1;
    if (myctr > 1000)
        myctr = 0;
    Serial.println(myctr);
}

Not that this is probably causing any issue…

Regarding the event, you don’t see the print Serial.println(“Event is not null”);? seems strange since in your picture the dropdown is populated. Maybe some quirk of the function, i think this doens0t write immediately to serial port but stores data to be sent via DMA/IRQ (but may be very wrong about this)…

Is the call to ScanWiFi() blocking? I mean if it’s going to do the scan of wifi networks it could block for a couple of seconds, don’t know if LVGL likes to be starved for long period of time.

Does the variable where you “store” the result in set_var_var_networks is large enough?

Assuming this is an ESP32 platform, do you get a kernel Panic and related serial output? Eventually something related to WDT Task not being refreshed.

If you don’t have LVGL logs enable, maybe enable them (need to configure a callback, don’t know if printf exists/works in this case), it could be complaining of lack of memory or something like that and sometimes that leads to a blocking state waiting for WDT restart. Just make sure that the level is at least LV_LOG_LEVEL_WARN and that LV_USE_ASSERT_NULL and LV_USE_ASSERT_MALLOC are enabled (these are the default settings).

All,
I went the way of EEZ studio without flow and did all the calls in PlatformIO.
Made life a lot easier.