How to scroll the label text circulary only when the application is idle?

Unfortunately, using a label with circular text scrolling significantly slows down the entire application. Is there any way to solve this problem? For example, scroll only when FreeRTOS is idle. Or use a task with a lower priority.

I don’t see why that would not be possible, check out the “long modes”:
https://docs.lvgl.io/8.3/widgets/core/label.html?highlight=label#long-modes

I think you can just change the mode from CIRCULAR to WRAP and it will quit scrolling.

Doing based on idle result chaotic scrolling maybe this helps you Setting anim initial/repeat delay for label in normal scroll mode - How-to - LVGL Forum

This is how I solved this problem using a task with the lowest priority. Now the main task is not distracted by scroll text and works faster. The larger the delay, the smoother the line moves. With a small delay, the movement becomes intermittent.

char logoText[] = "KORAD       KA3005D          DIGITAL CONTROL DC  POWER SUPPLY       30V 5A";
char * gLogoText;
uint16_t gLogoLength;


//-------------- setup ---------------
gLogoText = logoText;
gLogoLength = sizeof(logoText);
lv_label_set_long_mode(logoLabel1, LV_LABEL_LONG_CLIP);


xTaskCreatePinnedToCore(MainDisplayTask, "MainDisplayTask", 4096,  NULL, 1, &ntMainDisplayTaskHandler, 0);
xTaskCreatePinnedToCore(IdleTask, "IdleTask", 512,  NULL, tskIDLE_PRIORITY, &ntIdleTaskHandler, 0);

//----------- Idle Task --------------

void IdleTask(void *pvParameter)
{
  static uint16_t scrollIdx = 0;
  while(1) {
    uint16_t len = gLogoLength;
    char text[len--];
    uint16_t partLen = len - scrollIdx;
    memcpy(text, gLogoText + scrollIdx, partLen);
    memcpy(text + partLen, gLogoText, scrollIdx);
    text[len] = 0;
    scrollIdx++;
    if (scrollIdx == len) scrollIdx = 0;

    lv_label_set_text(logoLabel1, text);
    vTaskDelay(200);
  }
}
1 Like