i hope is preloaded into cache, but seems not, or only actual png.
Howto preload multiple decoded images for one object?
What have you tried so far?
In conf i setup #define LV_MEM_BUF_MAX_NUM 16 cached images and mem custom.
I see one workaround create all object over and hide unhide, but this isnt good.
The image caching mechanism will cache the images when they are opened (used) for the first time.
If you would like to preload the image you can do this:
lv_img_decoder_dsc_t decoder;
lv_img_decoder_open(&decoder, &img_wink_png, lv_color_hex(0x000000), 0);
//Image header info is in decoder.header;
//The decompressed image is in decoder.img_data;
//Create an lv_img_dsc_t manually from decoder.header and decoder.img_data
lv_img_decoder_close(&decoder);
I debug 8.3.7 and my result is caching works, but is cleared by start any animation.
My 5 pngs is precached properly and next try showing is without decode.
But call this Tpan1_Animation(ui_TopPanel1, 0); or any other
and next show decode repeat plus i check free mem and after call anim mem go back to free state.
LOG first num is free mem cached all 5 pngs
2686964 loop … 36852
2686964 loop … 36852
Handled Headphone anim
4128756 loop … 36852
Handled Headphone
4128756 loop … 36852
[Error] (412.738, +368195) decoder_open: PNG decoded
(in lv_png.c line #178)
[Error] (412.845, +107) decoder_open: PNG decoded
(in lv_png.c line #178)
[Error] (413.238, +393) decoder_open: PNG decoded
(in lv_png.c line #178)
3342324 loop … 36852
3342324 loop … 36852
cached ok 3 images to next anim
I need solve this bug.
Error isnt error i only use LV_LOG_ERROR("
On other button is assigned animation start for testing. Any animation created in SQS, but maybe not all , i test normal image with fade rotation and zoom.
First use roller all images is decoded and after this only show ok. But use anim start decode logged as in previous log info…
Pre-cache i test, but now check only cache system in lvgl. First use in roller log png decoding (precache) and after this it must never ocur. Actualy this work, but animation break it.
We need locate why break and how block images stay in cache.
//Create an lv_img_dsc_t manually from decoder.header and decoder.img_data
I dont understand , how this help. I test your code and decoding png is logged , but if i use source img in my code , decoding repeat and dont use predecoded. And i mean if i assign imgdsc as in comment this helps, but still will erased by next animation.
yes decode and dont trash and perfect is command for predecode, without this first show is slow and block GUI
plus define memory size free limit for no trash.
For example here i have 4M RAM and trash can start is less as an define 2M free
This dont help me, start begin, why animation erase all cached images?
How workaround decode to my malloc area and leave?
And special question can be C:\Program Files\SquareLine Studio 1.3.2\lvgl\lv_font_conv-win.exe used for cmdline convert png to c file with raw mode or other exe? Now is very annoy use online convert for every required image…
My def is 16 and images png 6. Still you dont reply why erased.
And animations invoke this 100% as showed in log. When animation is disabled/not used images stay in cache.
Plus @kisvegabor your code create memory chaos. Example idea first image decoded 300x200 second 301x201 third 302x203. After this memory is …
because 4M free mem:
1.image decoder reserve space and decode 300x200x4 … you copy 300x200x4 and leave it static. Mark area free
2.image cant use area and place decoding after static and repeat
3…
after this we have in RAM space image space image space image …
Areas with space is unusable for cache or decode next images bigger as 1.
Ok i use simple trick precache bigest image as first. Then memory storing images is filled continuosly and i see one interesant joke. LVGL Cached images fill bigger space as my stored. Seems because png decoder always reserve WxHx4 bytes , but for lvgl in 16 bit mode reconvert to WxHx3 . But in cache space leave reserved . In my precache memcpy is less space used and images stay in memory…
@kisvegabor and i still dont have info why little simple animation erase all lvgl cached images at once