Bug? Arc Recoloring / Color changes


Recoloring of Arc does not work.

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

Change Arc Color multiple times

I’m trying to recolor a created arc. The Arc can be colored in the same function as it’s been created.
Afterwards, the coloring stops working. I’ve tried even deleting the Arc, but although the Object is deleted and not in the memory anymore, the arc is still being shown.

obj_report_style_change and obj_invalidate doesn’t change anything. Even wrote it before and after the color change takes place.

static lv_style_t style;
lv_obj_t * arc;
lv_palette_t currentColor = LV_PALETTE_NONE;

/*Create an Arc*/
void ArcSetup() {
    arc = lv_arc_create(lv_scr_act());

    lv_obj_set_size(arc, 240, 240);
    lv_arc_set_bg_angles(arc, 0, 360);
    lv_obj_remove_style(arc, NULL, LV_PART_KNOB);   /*Be sure the knob is not displayed*/
    lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);  /*To not allow adjusting by click*/
    lv_obj_add_style(arc, &style, 0);
    lv_arc_set_value(arc, 0);

    ArcColor(LV_PALETTE_INDIGO);  //ArcColor works when called from here

void ArcColor(lv_palette_t color) {
    if (color != currentColor) {
        currentColor = color;

        Serial.println("Change color");

        //lv_style_reset(&style); //Does not reset color

        //lv_obj_del(arc); //Object is deleted, but Arc still showing

        //lv_obj_remove_style(arc,&style, LV_STATE_ANY); //USELESS

        //lv_obj_set_style_arc_color(arc, lv_palette_main(color), LV_STATE_ANY); //USELESS
        //lv_style_set_bg_color(&style, lv_palette_main(color)); //USELESS


        lv_style_set_arc_color(&style, lv_palette_main(color));


The first time ArcColor() is called ( from ArcSetup() ), it does work!
But if i.e. I call it from loop(), although I can see the prints (correct with color enum ID), arc color is unchanged.

lv_obj_del(arc) does NOT remove the arc from the screen :frowning:

Show loop code and check lvtick is active

lv_tick_inc(5); was missing :frowning: