Hello all
I am using LVGL V8 arduino library, with ESP32S3, finally I was able to load a 100x100 PNG image from SD card, using PNG Decoder (lv_png.c).
Here is the part of my code creating this image:
ui_Image2 = lv_img_create(ui_Screen1);
lv_obj_set_width(ui_Image2, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image2, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image2, 0);
lv_obj_set_y(ui_Image2, 0);
lv_obj_set_align(ui_Image2, LV_ALIGN_CENTER);
lv_img_set_src(ui_Image2, "S:/wifi100.png");
I turned on logging to make some debugging, and I see that decoder_open is called 10 times, and then no more calls, even though I use “lv_img_set_src” just once.
At this specific line (lv_png.c #156), I added:
LV_LOG_WARN(“error %u: %s\n”, error, lodepng_error_text(error));
[Warn] (1.160, +1160) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (1.302, +142) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (1.443, +141) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (1.584, +141) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (1.725, +141) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (1.867, +142) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (2.008, +141) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (2.149, +141) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (2.291, +142) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
[Warn] (2.434, +143) decoder_open: pngdatasize is 40035, width , 100, height, 100 (in lv_png.c line #156)
No more prints afterwards from lv_png.c
In order to check if it a problem of refresh, or other calls to “lv_timer_handler”,
I added a text box which increments its value in the while loop:
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
lv_label_set_text(ui_lblIP, ((String)i).c_str()); // worked just fine , carefull for overflow
i++;
delay (1000);
}
I can confirm that decode_png is not called when lv_timer_handler is called repeatedly during the loop, it is called until all the PNG image is loaded, but the strange thing is that it is repeated 10 times.
Thank you