What MCU/Processor/Board and compiler are you using?
esp32, esp-wrover-kit
What LVGL version are you using?
8.2
What do you want to achieve?
When increasing the value in varTask , the value increased is refreshed on the screen in guiTask.
What have you tried so far?
I have tried lv_timer_create, lv_obj_add_event_cb.
I checked that the timer function or event_cb is running, but lv_label_set_text_fmt() does not work.
xTaskCreatePinnedToCore(guiTask, "gui", 4096 * 2, NULL, 2, NULL, 1);
xTaskCreatePinnedToCore(varTask, "var", 4096, NULL, 3, NULL, 1);
static void varTask(void *pvParameters)
{
while (1)
{
vTaskDelay(pdMS_TO_TICKS(100));
var++;
lv_event_send(Label, LV_EVENT_VALUE_CHANGED, NULL);
}
}
static void guiTask(void *pvParameter)
{
Label = lv_label_create(ui_Screen1);
…
lv_label_set_text_fmt(Label, "%d", var);
lv_obj_add_event_cb(Label, label_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
while (1)
{
vTaskDelay(pdMS_TO_TICKS(10));
if (pdTRUE == xSemaphoreTake(xGuiSemaphore, portMAX_DELAY))
{
lv_task_handler();
xSemaphoreGive(xGuiSemaphore);
}
}
}
void label_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
if(code == LV_EVENT_VALUE_CHANGED) {
lv_label_set_text_fmt(ui_Screen1_Label2, "%d", var);
lv_obj_invalidate(ui_Screen1_Label2);
Serial.print("LV_EVENT_CHG\n");
}
}
//void label_timer_cb(lv_timer_t * timer)
//{
// lv_label_set_text_fmt(ui_Screen1_Label2, "%d", var);
// Serial.print("label_timer_cb\n");
//}