Manually update data on my screen

ESP32 dev module

LVGL version 3.8.5

Hello everyone,
In my application I want every 5 minutes to check if the time has changed, and if so, update the data shown on the screen with new data.
There hasn’t been any change event that could trigger a refresh, my data is not updated.
How I could manually activate the data refresh of my screen? I have tried several ways, but I can’t.
Thank you.

void loop() {
  lv_task_handler();
  vTaskDelay(5);

  if ((millis() - timing) > 300000) {    // Ejecuto cada 5 mtos. eControl. 300.000 ms.
    timing = millis();   
    eControl();
    //lv_scr_load(ui_Inicio);
    lv_disp_trig_activity( dispp );
  }

  if ( (millis() - dormir) > 30000 && !TFT_On == 0) {  // Apago el TFT si nadie hace nada en 30 seg. 30000
    digitalWrite(mosfet, HIGH);
    TFT_On = 0;
  }

  esp_task_wdt_reset(); //Tranquilizo al perro

  buttonState = digitalRead(GPIO_NUM_35);
  if( buttonState == LOW ) esp_deep_sleep_start();
}

I don’t see any screen element (button, label, textbox etc.) which you want to change.

One possibility, e.g. to update a label text, make the label text object a global variable, so you can change the text of a label from any other location in code.
As I don’t know from where you want to change I can’t give you more hints.

Hi Rob, thanks for your help.
Basically, in the SETUP of the eControl.ino program I extract data from a web server and assemble an array with the prices per hour of the day.
I check what time it is and display on the screen the data corresponding to that time in the fields: ec_hora, ec_prec, ec_horb, ec_preb and ec_porc. This does it correctly.
Subsequently, in the LOOP every 5 minutes I check the time again and if it changes I update the price data of that new time on the screen. This is what I can’t get.

// -------------------------------------------- SETUP ----------------------------------------------
void setup() {
  Serial.begin(115200);
  delay(1000);

  lv_init(); 
  
#if LV_USE_LOG != 0
  lv_log_register_print_cb(my_print); 
#endif

  eControl();

  tft.begin();
  tft.setRotation(1);
  uint16_t calData[5] = { 185, 3534, 246, 3604, 1 };
  tft.setTouch(calData);

  lv_disp_draw_buf_init(&draw_buf, buf, NULL, screenWidth * screenHeight / 10);
  /*Inicializo el TFT*/
  static lv_disp_drv_t disp_drv; 
  lv_disp_drv_init(&disp_drv);
  disp_drv.hor_res = 320;  /*Indico la resolucion de la pantalla*/
  disp_drv.ver_res = 240;
  disp_drv.flush_cb = my_disp_flush;
  disp_drv.draw_buf = &draw_buf;
  lv_disp_drv_register(&disp_drv);
  /*Inicializo el controlador del dispositivo de entrada (ficticio)*/
  static lv_indev_drv_t indev_drv; 
  lv_indev_drv_init(&indev_drv);
  indev_drv.type = LV_INDEV_TYPE_POINTER;
  indev_drv.read_cb = my_touchpad_read;
  lv_indev_drv_register(&indev_drv);

  ui_init();
  esp_task_wdt_init(WDT_TIMEOUT, true);   //Activamos perro para reiniciar ESP32
  esp_task_wdt_add(NULL);                 //añadir subproceso actual al reloj WDT
}
void loop() {
  lv_task_handler();
  vTaskDelay(5);

  if ((millis() - timing) > 300000) {    // Ejecuto cada 5 mtos. eControl. 300.000 ms.
    timing = millis();   
    eControl();
    //lv_scr_load(ui_Inicio);
    //lv_disp_trig_activity( dispp );
  }

  if ( (millis() - dormir) > 30000 && !TFT_On == 0) {  // Apago el TFT si nadie hace nada en 30 seg. 30000
    digitalWrite(mosfet, HIGH);
    TFT_On = 0;
  }

  esp_task_wdt_reset(); //Tranquilizo al perro

  buttonState = digitalRead(GPIO_NUM_35);
  if( buttonState == LOW ) esp_deep_sleep_start();
}

All the fields that I mention are in global variables, but I think the problem is that since there are no changes in the objects on the screen, lv_task_handler() simply does not perform the refresh. I have tried to put printf() in ui_Start_screen_init(void) and the first time it shows its step in the console, but then it never renders them again.
I do not know if I have explained myself, if you need any clarification do not hesitate to ask me.
Greetings.


#include "ui.h"
#include "ui_helpers.h"
#include <string.h>
///////////////////// VARIABLES ////////////////////
void ui_event_Inicio(lv_event_t * e);
lv_obj_t * ui_Inicio;

lv_obj_t * ui_Inicio_IBInicio;
void ui_event_Inicio_IBInicio(lv_event_t * e);

lv_obj_t * ui_Inicio_IBProxi;
void ui_event_Inicio_IBProxi(lv_event_t * e);

lv_obj_t * ui_Inicio_PanelAhora;
lv_obj_t * ui_Inicio_Label2;
lv_obj_t * ui_Inicio_Label5;
lv_obj_t * ui_Inicio_Label6;
lv_obj_t * ui_Inicio_PrecioAh;
lv_obj_t * ui_Inicio_PanelDespues;
lv_obj_t * ui_Inicio_Label3;
lv_obj_t * ui_Inicio_HoraDe;
lv_obj_t * ui_Inicio_PrecioDe;
lv_obj_t * ui_Inicio_Porcentaje;

const char * ec_ssid;
const char * ec_pass;
const char * ec_hora;
const char * ec_porc;
const char * ec_esta;
const char * ec_prec;
const char * ec_scro;
const char * ec_horb;
const char * ec_preb;
const char * ec_estb;
const char * ec_prox;
int estados[24];
int estadop[24];
int carga;
int cargap;
int TFT_On;
int Wifi_On;
char * swifi_con;

void ui_Inicio_screen_init(void)
{
    ui_Inicio = lv_obj_create(NULL);
    lv_obj_clear_flag(ui_Inicio, LV_OBJ_FLAG_SCROLLABLE);     

    ui_Inicio_IBInicio = lv_btn_create(ui_Inicio);
    lv_obj_set_width(ui_Inicio_IBInicio, lv_pct(16));
    lv_obj_set_height(ui_Inicio_IBInicio, 40);
    lv_obj_set_x(ui_Inicio_IBInicio, -126);
    lv_obj_set_y(ui_Inicio_IBInicio, -96);
    lv_obj_set_align(ui_Inicio_IBInicio, LV_ALIGN_CENTER);
    lv_obj_add_flag(ui_Inicio_IBInicio, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_Inicio_IBInicio, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_img_src(ui_Inicio_IBInicio, &ui_img_adslwifi_png,
                                LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_IBInicio, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui_Inicio_IBInicio, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_IBInicio, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_IBProxi = lv_btn_create(ui_Inicio);
    lv_obj_set_height(ui_Inicio_IBProxi, 40);
    lv_obj_set_width(ui_Inicio_IBProxi, 50);
    lv_obj_set_x(ui_Inicio_IBProxi, 130);
    lv_obj_set_y(ui_Inicio_IBProxi, -96);
    lv_obj_set_align(ui_Inicio_IBProxi, LV_ALIGN_CENTER);
    lv_obj_add_flag(ui_Inicio_IBProxi, LV_OBJ_FLAG_SCROLL_ON_FOCUS); 
    lv_obj_clear_flag(ui_Inicio_IBProxi, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_img_src(ui_Inicio_IBProxi, &ui_img_proxi_png,
                                LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_IBProxi, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui_Inicio_IBProxi, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_IBProxi, 2, LV_PART_MAIN | LV_STATE_DEFAULT);  

    ui_Inicio_PanelAhora = lv_obj_create(ui_Inicio);
    lv_obj_set_height(ui_Inicio_PanelAhora, 113);
    lv_obj_set_width(ui_Inicio_PanelAhora, lv_pct(48));
    lv_obj_set_x(ui_Inicio_PanelAhora, -79);
    lv_obj_set_y(ui_Inicio_PanelAhora, -13);
    lv_obj_set_align(ui_Inicio_PanelAhora, LV_ALIGN_CENTER);
    lv_obj_clear_flag(ui_Inicio_PanelAhora, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0x0EE524), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_Inicio_PanelAhora, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_PanelAhora, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_PanelAhora, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_Label2 = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_width(ui_Inicio_Label2, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label2, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label2, -38);
    lv_obj_set_y(ui_Inicio_Label2, -37);
    lv_obj_set_align(ui_Inicio_Label2, LV_ALIGN_CENTER);
    ec_text = textos[0];
    lv_label_set_text(ui_Inicio_Label2, ec_text);// "Ahora");
    lv_obj_set_style_text_font(ui_Inicio_Label2, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_Label5 = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_width(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label5, 6);
    lv_obj_set_y(ui_Inicio_Label5, 0);
    lv_obj_set_align(ui_Inicio_Label5, LV_ALIGN_CENTER);
    char dest[6];      
    strcpy(dest, ":00 h.");
    ec_hora = strcat(ec_hora, dest);                                          
    lv_label_set_text(ui_Inicio_Label5, ec_hora); 
    lv_obj_set_style_text_font(ui_Inicio_Label5, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_PrecioAh = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_height(ui_Inicio_PrecioAh, 18);
    lv_obj_set_width(ui_Inicio_PrecioAh, lv_pct(98));
    lv_obj_set_x(ui_Inicio_PrecioAh, 1);
    lv_obj_set_y(ui_Inicio_PrecioAh, 39);
    lv_obj_set_align(ui_Inicio_PrecioAh, LV_ALIGN_CENTER);
    lv_obj_set_style_text_font(ui_Inicio_PrecioAh, &ui_font_Font16, LV_PART_MAIN | LV_STATE_DEFAULT);
    strcpy(dest, " €\/KWh");
    ec_prec = strcat(ec_prec, dest);
    lv_label_set_text( ui_Inicio_PrecioAh, ec_prec );    

    ui_Inicio_PanelDespues = lv_obj_create(ui_Inicio);
    lv_obj_set_height(ui_Inicio_PanelDespues, 113);
    lv_obj_set_width(ui_Inicio_PanelDespues, lv_pct(48));
    lv_obj_set_x(ui_Inicio_PanelDespues, 77);
    lv_obj_set_y(ui_Inicio_PanelDespues, -13);
    lv_obj_set_align(ui_Inicio_PanelDespues, LV_ALIGN_CENTER);
    lv_obj_clear_flag(ui_Inicio_PanelDespues, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_opa(ui_Inicio_PanelDespues, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_PanelDespues, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_PanelDespues, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_Label3 = lv_label_create(ui_Inicio_PanelDespues);
    lv_obj_set_width(ui_Inicio_Label3, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label3, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label3, -5);
    lv_obj_set_y(ui_Inicio_Label3, -35);
    lv_obj_set_align(ui_Inicio_Label3, LV_ALIGN_CENTER);
    ec_text = textos[1];
    lv_label_set_text(ui_Inicio_Label3, ec_text);//" Mejor hoy");
    lv_obj_set_style_text_font(ui_Inicio_Label3, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_HoraDe = lv_label_create(ui_Inicio_PanelDespues);
    lv_obj_set_width(ui_Inicio_HoraDe , LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_HoraDe , LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_HoraDe, 6);
    lv_obj_set_y(ui_Inicio_HoraDe, 0);
    lv_obj_set_align(ui_Inicio_HoraDe, LV_ALIGN_CENTER);
    char desp[6];
    strcpy(desp, ":00 h.");
    ec_horb = strcat(ec_horb, desp);                                          
    lv_label_set_text(ui_Inicio_HoraDe, ec_horb);
    lv_obj_set_style_text_font(ui_Inicio_HoraDe, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_PrecioDe = lv_label_create(ui_Inicio_PanelDespues);
    lv_obj_set_height(ui_Inicio_PrecioDe, 18);
    lv_obj_set_width(ui_Inicio_PrecioDe, lv_pct(100));
    lv_obj_set_x(ui_Inicio_PrecioDe, 1);
    lv_obj_set_y(ui_Inicio_PrecioDe, 38);
    lv_obj_set_align(ui_Inicio_PrecioDe, LV_ALIGN_CENTER);
    lv_obj_set_style_text_font(ui_Inicio_PrecioDe, &ui_font_Font16, LV_PART_MAIN | LV_STATE_DEFAULT);    
    strcpy(desp, " €\/KWh");
    ec_preb = strcat(ec_preb, desp);
    lv_label_set_text(ui_Inicio_PrecioDe, ec_preb); 

    ui_Inicio_Porcentaje = lv_label_create(ui_Inicio);
    lv_obj_set_width(ui_Inicio_Porcentaje, 150);
    lv_obj_set_height(ui_Inicio_Porcentaje, 55);
    lv_obj_set_x(ui_Inicio_Porcentaje, 6);
    lv_obj_set_y(ui_Inicio_Porcentaje, 85);
    lv_obj_set_align(ui_Inicio_Porcentaje, LV_ALIGN_CENTER);
    char duno[1];      
    strcpy(duno, "%");
    ec_porc = strcat(ec_porc, duno);
    lv_label_set_text(ui_Inicio_Porcentaje, ec_porc); 
    lv_label_set_recolor(ui_Inicio_Porcentaje, "true");

    lv_obj_set_style_text_opa(ui_Inicio_Porcentaje, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui_Inicio_Porcentaje, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui_Inicio_Porcentaje, &ui_font_Big__Font, LV_PART_MAIN | LV_STATE_DEFAULT);

    int ret;
    strcpy(duno, "0");
        if (strncmp(ec_esta, duno, 1) == 0) {
          lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0x08C22A), LV_PART_MAIN | LV_STATE_DEFAULT);//0x0BFF01
          lv_obj_set_style_text_color(ui_Inicio_Porcentaje, lv_color_hex(0x08C22A), LV_PART_MAIN | LV_STATE_DEFAULT);
        }
        if (strncmp(ec_estb, duno, 1) == 0) lv_obj_set_style_bg_color(ui_Inicio_PanelDespues, lv_color_hex(0x08C22A), LV_PART_MAIN | LV_STATE_DEFAULT);

    strcpy(duno, "1");
        if (strncmp(ec_esta, duno, 1) == 0) {
          lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0xF7BF05), LV_PART_MAIN | LV_STATE_DEFAULT);
          lv_obj_set_style_text_color(ui_Inicio_Porcentaje, lv_color_hex(0xF7BF05), LV_PART_MAIN | LV_STATE_DEFAULT);
        }
        if (strncmp(ec_estb, duno, 1) == 0) lv_obj_set_style_bg_color(ui_Inicio_PanelDespues, lv_color_hex(0xF7BF05), LV_PART_MAIN | LV_STATE_DEFAULT);

    strcpy(duno, "2");
        if (strncmp(ec_esta, duno, 1) == 0) {
          lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0xFE0000), LV_PART_MAIN | LV_STATE_DEFAULT);
          lv_obj_set_style_text_color(ui_Inicio_Porcentaje, lv_color_hex(0xFE0000), LV_PART_MAIN | LV_STATE_DEFAULT);
        }
        if (strncmp(ec_estb, duno, 1) == 0) lv_obj_set_style_bg_color(ui_Inicio_PanelDespues, lv_color_hex(0xFE0000), LV_PART_MAIN | LV_STATE_DEFAULT);

      if ( carga == 0 ) {
          lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0x6C6868), LV_PART_MAIN | LV_STATE_DEFAULT);
          lv_obj_set_style_text_color(ui_Inicio_Porcentaje, lv_color_hex(0x6C6868), LV_PART_MAIN | LV_STATE_DEFAULT);
          lv_obj_set_style_bg_color(ui_Inicio_PanelDespues, lv_color_hex(0x6C6868), LV_PART_MAIN | LV_STATE_DEFAULT);
      }
    lv_obj_add_event_cb(ui_Inicio_PanelAhora, ui_event_Inicio_PanelAhora, LV_EVENT_CLICKED, NULL);
    lv_obj_add_event_cb(ui_Inicio_PanelDespues, ui_event_Inicio_PanelDespues, LV_EVENT_CLICKED, NULL);
    lv_obj_add_event_cb(ui_Inicio_IBInicio, ui_event_Inicio_IBInicio, LV_EVENT_CLICKED, NULL);
    lv_obj_add_event_cb(ui_Inicio_IBProxi, ui_event_Inicio_IBProxi, LV_EVENT_CLICKED, NULL);
}

void ui_init(void) {     
    w_pais = i_pais;
    w_idioma = i_idio;
    lv_disp_t * dispp = lv_disp_get_default();
    lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
                                               true, LV_FONT_DEFAULT);
    lv_disp_set_theme(dispp, theme);

    ui_Inicio_screen_init();
    lv_disp_load_scr( ui_Inicio );
}

I have tried to activate in the LOOP a refresh event to the ui_Inicio screen:
lv_event_send(ui_Inicio, LV_EVENT_REFRESH, NULL);
and then in ui.c
I’ve added a new event control to ui_Inicio:
lv_obj_add_event_cb(ui_Inicio, ui_Inicio_update_event_cb, LV_EVENT_REFRESH, NULL);
and in the function ui_Inicio_update_event_cb I do a lv_label_set_text(ui_Inicio_Label5, ec_hora); to update the value of ui_home_Label5, but it does nothing.
What I’m trying to do is ok?

void loop() {
 lv_task_handler();
 vTaskDelay(5);

 if ((millis() - timing) > 300000) {    // Ejecuto cada 5 mtos. eControl. 300.000 ms.
   timing = millis();   
   eControl();
   lv_event_send(ui_Inicio, LV_EVENT_REFRESH, NULL);
 }

 if ( (millis() - dormir) > 30000 && !TFT_On == 0) {  // Apago el TFT si nadie hace nada en 30 seg. 30000
   digitalWrite(mosfet, HIGH);
   TFT_On = 0;
 }

 esp_task_wdt_reset(); //Tranquilizo al perro

 buttonState = digitalRead(GPIO_NUM_35);
 if( buttonState == LOW ) esp_deep_sleep_start();
}
void ui_Inicio_update_event_cb(lv_obj_t * objeto, lv_event_t e) {
    char dest[6];      
    strcpy(dest, ":00 h.");
    ec_hora = strcat(ec_hora, dest);                                          
    lv_label_set_text(ui_Inicio_Label5, ec_hora);
}

void ui_Inicio_screen_init(void)
{
    ui_Inicio = lv_obj_create(NULL);
    lv_obj_clear_flag(ui_Inicio, LV_OBJ_FLAG_SCROLLABLE);     

    ui_Inicio_IBInicio = lv_btn_create(ui_Inicio);
    lv_obj_set_width(ui_Inicio_IBInicio, lv_pct(16));
    lv_obj_set_height(ui_Inicio_IBInicio, 40);
    lv_obj_set_x(ui_Inicio_IBInicio, -126);
    lv_obj_set_y(ui_Inicio_IBInicio, -96);
    lv_obj_set_align(ui_Inicio_IBInicio, LV_ALIGN_CENTER);
    lv_obj_add_flag(ui_Inicio_IBInicio, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_Inicio_IBInicio, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_img_src(ui_Inicio_IBInicio, &ui_img_adslwifi_png,
                                LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_IBInicio, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui_Inicio_IBInicio, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_IBInicio, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_PanelAhora = lv_obj_create(ui_Inicio);
    lv_obj_set_height(ui_Inicio_PanelAhora, 113);
    lv_obj_set_width(ui_Inicio_PanelAhora, lv_pct(48));
    lv_obj_set_x(ui_Inicio_PanelAhora, -79);
    lv_obj_set_y(ui_Inicio_PanelAhora, -13);
    lv_obj_set_align(ui_Inicio_PanelAhora, LV_ALIGN_CENTER);
    lv_obj_clear_flag(ui_Inicio_PanelAhora, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_color(ui_Inicio_PanelAhora, lv_color_hex(0x0EE524), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_Inicio_PanelAhora, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_Inicio_PanelAhora, lv_color_hex(0x06FA1F), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_Inicio_PanelAhora, 2, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_Label2 = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_width(ui_Inicio_Label2, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label2, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label2, -38);
    lv_obj_set_y(ui_Inicio_Label2, -37);
    lv_obj_set_align(ui_Inicio_Label2, LV_ALIGN_CENTER);
    ec_text = textos[0];
    lv_label_set_text(ui_Inicio_Label2, ec_text);// "Ahora");
    lv_obj_set_style_text_font(ui_Inicio_Label2, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    ui_Inicio_Label5 = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_width(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label5, 6);
    lv_obj_set_y(ui_Inicio_Label5, 0);
    lv_obj_set_align(ui_Inicio_Label5, LV_ALIGN_CENTER);
    char dest[6];      
    strcpy(dest, ":00 h.");
    ec_hora = strcat(ec_hora, dest);                                          
    lv_label_set_text(ui_Inicio_Label5, ec_hora); 
    lv_obj_set_style_text_font(ui_Inicio_Label5, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);

    lv_obj_add_event_cb(ui_Inicio, ui_Inicio_update_event_cb, LV_EVENT_REFRESH, NULL);
}

Not related to your question,
but, sorry, you are doing so much wrong.
You didn’t really understand what strings (char[]) in C are and how to work with them!

Where to begin?

   char dest[6];      
    strcpy (dest, ":00 h.");

You reserve a char array for the string, but only 6 bytes, although you need more.
Your strcpy (dest, ":00 h."); needs 7 bytes in total (don’t forget the null termination!). Your stack will get corrupted.
Always use this one:

  char dest[10];      // A little bit more than you would need at first

  dest[0] = 0;
  strncat (dest, ":00 h.", 10 - 1);   // Length is one less as maximum buffer, so there is place for the null termination.

In your previous post, you have this:

const char * ec_hora;

... 
// Later in ui_inicio_screen_init ()

char dest[6];      
strcpy(dest, ":00 h.");                 
ec_hora = strcat(ec_hora, dest); 

That will fail either. As far as I can see, ec_hora is just a pointer, pointing to nowhere.
You can’t copy (strcat) a string (char[]) to a pointer pointing to nowhere.

And that’s only what I found with a short look. But I think all the places where you want to do string manipulations are the same.

String with char[] (and the related C function sprintf, strcat, strcpy etc.) can not be compared to C++ Strings. C++ Strings to a memory allocation in background.

The truth is that it is the first time that I program in C, I have programmed in many other languages COBOL, RPG, Visual Basic, Android, but I have to admit that the treatment of strings and pointers in C is complicated and it is difficult for me to understand it.
Thanks for your corrections. I have changed:

char dest[10];      
strcpy(dest, ":00 h.");                 
ec_hora = strcat(ec_hora, dest); 

And it works for me and shows the value of ec_hora correctly on the screen.
What would be, according to you, the correct way to add to the content of const char * ec_hora the text “:00 h.”

First, it make no sense, to copy the string ":00 h." to local variable/array.
You can do that directly with

strcat (ec_hora, ":00 h."); 

Second (once more): Do not use the C string functions like strcpy, strcat, sprintf etc.
Especially if you are unexperienced in C. Using string functions in C is one of the most causes for corrupted programs.
Use strncat, snprintf etc.

This will result in corrupted stack:

void my_func (void) {
  char atext[10];

  strcpy (atext, "1234567890abcd");
}

Better, but not the best:
This example would not overwrite the stack, but it will miss the null termination.
That means, if you print the string ‘atext’ it might look the following .1234567890?-?§%§"!?=di( depending what is on the stack.

void my_func (void) {
  char atext[10];

  strncpy (atext, "1234567890abcd", 10);
  printf (atext);
}

Better:
In this case nothing is overwritten, and the string is null terminated.

my_func () {
  char atext[10 + 1];

  atext[0] = 0;    // Make an empty string
  strncat (atext, "1234567890abcd", 10);
}

When using global string (e.g. for ec_hora) I would recommend the following:

#define  MAX_STRING_EC_HORA    10 

char ec_hora[MAX_STRING_EC_HORA + 1];     // + 1 space for the null termination!

void my_func (void) {
  ec_hora[0] = 0;    // Create empty ec_hora string;

  strncat (ec_hora, "1234567890abcd", MAX_STRING_EC_HORA);
}

Whereas this will fail because the third parameter (MAX_STRING_EC_HORA) only will:

#define  MAX_STRING_EC_HORA    10 

char ec_hora[MAX_STRING_EC_HORA + 1];

void my_func (void) {
  ec_hora[0] = 0;  // Create empty ec_hora string;

  strncat (ec_hora, "1234567890abcd", MAX_STRING_EC_HORA); // Till here it's ok.
  strncat (ec_hora, "hijklm", MAX_STRING_EC_HORA);   // That will overwrite other memory
}

This would be ok, but of course the resulting string would only contain “1234567890”:

#define  MAX_STRING_EC_HORA    10 

char ec_hora[MAX_STRING_EC_HORA + 1];

void my_func (void) {
  snprintf (ec_hora, MAX_STRING_EC_HORA, "%s%s", "1234567890abcd", "hijklm");
}

Additional explanation: C strings need a null termination.
That means that C recognizes the end of a string by finding a byte which is 0.

Ok, thanks for your lesson. I think I have understood how strings work in C. :pray:

Some additional lesson (which came in mind).
I think some people are not aware about possible problems when using utf-8 character encoding.
Which is a kind of standard today.

You have a utf-8 encoded source file, and you are using non ASCII characters (because using Spanish, French, German or whatever text):

char mytext[5 + 1];

sprintf (mytext, "áéíóú");

You would think, that this should work!?
No it doesn’t. You have a corrupting piece of code.
You think you have five characters (“áéíóú”) and you have reserved space for five chars + one for the null termination.
But that is not true, because the string/text “áéíóú” needs ten character + one for null termination.
In utf-8 encoding, each of these characters needs two bytes. Only characters whithin the range of 0x20 to 0x7f (pure ASCII) needs only one character.

Again, using sprintf, stcat etc. is a potential risk. Using snprintf, strncat, might not correctly work, in case your buffer size is too small, but you are not getting in risk of getting your program to crash or at least have some strange behaviour.

Hello, I have to get the screen refresh to work. I tell you:
In the LOOP include lv_obj_add_event_cb(ui_Start, ui_Start_update_event, LV_EVENT_REFRESH, NULL);

void loop() {
  lv_task_handler();
  vTaskDelay(5);

  if ((millis() - timing) > 300000) {    // Ejecuto cada 5 mtos. eControl. 300.000 ms.
    timing = millis();   
    eControl();
    if(hora_encurso != hora_cambio) {
       lv_event_send(ui_Inicio, LV_EVENT_REFRESH, NULL);
       hora_cambio = hora_encurso;
    }
  }

And in ui.c:

void ui_Inicio_update_event(lv_event_t e) {
  ui_Inicio_screen_init();
  lv_disp_load_scr( ui_Inicio );                                   
}

void ui_Inicio_screen_init(void)
{
    ui_Inicio = lv_obj_create(NULL);
    lv_obj_clear_flag(ui_Inicio, LV_OBJ_FLAG_SCROLLABLE);  

    ui_Inicio_Label5 = lv_label_create(ui_Inicio_PanelAhora);
    lv_obj_set_width(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_Inicio_Label5, LV_SIZE_CONTENT);
    lv_obj_set_x(ui_Inicio_Label5, 6);
    lv_obj_set_y(ui_Inicio_Label5, 0);
    lv_obj_set_align(ui_Inicio_Label5, LV_ALIGN_CENTER);                                         
    lv_label_set_text(ui_Inicio_Label5, strncat(ec_hora, ":00 h.", 10)); 
    lv_obj_set_style_text_font(ui_Inicio_Label5, &ui_font_Font20, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_add_event_cb(ui_Inicio, ui_Inicio_update_event, LV_EVENT_REFRESH, NULL);
}
Thank you very much for your help. :pray: