Animation problem

ui.c:320:43: warning: assignment to ‘lv_img_dsc_t **’ {aka ‘struct **’} from incompatible pointer type ‘const lv_img_dsc_t **’ {aka ‘const struct **’} [-Wincompatible-pointer-types]
PropertyAnimation_0_user_data->imgset = ui_imgset_;

I have a simple animation, but dont know why i get this error .
Simply an imge is added that is intended to blink.

Any one have idea to avoir this message error.

Thanks

Images require right names, but for blinking is simpler one image and recolor

Thanks for your answer but i dont really understand.

Animation Image (lv_animimg) — LVGL documentation

and recolor is explained in img docu.

ok i will check thanks

It seems the ‘const’ modifier is added to the type of ui_imgset_ array in ui.c but it’s assigned in the animation-initialization function to a non-const member (imgset of ui_anim_user_data_t struct) in ui_helpers.h. The problem can (and ideally should be) resolved in the exported code by either adding the const qualifier before lv_img_dsc_t ** imgset in ui_helpers.h or adding a casting in the animation-initializer of ui.c after the equal sign, like: PropertyAnimation_0_user_data->imgset = (lv_img_dsc_t**) ui_imgset_;
(I added this observation to the SquareLine Studio issue tracker.)
If you don’t want to disturb the exported code (which is intended not to be modified), you can also add -Wno-incompatible-pointer-types flag to you compiler to turn off this particular warning.

1 Like

First of thanks ,
I really appriciate that you took time and answer me with so much details.
I dont know if many people do in these days.

Your answer corrected my bug but thing is why a simple image blinking animation is causing appliation crash do you see any reason or solution for this.?

Thanks

Hello,

I am using a panel (which has a blinking animation), which i change parent on multipule screens . every time i move to next screen i change parent of my panel conating animation to next screen and when i come back i change again parent again.

May be you can find some advices for me.

for each screen i am doing this simply

lv_obj_set_parent(ui_Paneltemperature, ui_Screen1);

I’m glad if I can help. Some tips about the crash issue above:
In case you use temporary screens, I guess you should check first if the parent screen really exists, before using lv_obj_set_parent. On the other hand, it should be checked for the animation itself if the target object and its parent really exists (lv_obj_is_valid). Probably it’s not a good idea to keep the animation running while the parent-change procedure of the target-object is happening. (Not sure, but it might take some loops until it settles.) Pausing animation might be done by deleting its callback temporarily, IIRC there were discussions about it here at this forum, and seems to be one at LVGL-forum (Pause/ Resume animation - How-to - LVGL Forum).
If you want to leave this problem alltogether, you can create the animated object on the top-layer. SquareLine studio doesn’t have a flag for it yet, but you can do it in the exported LVGL code afterwards. ( Displays — LVGL documentation )