How To Dynamic update table

Description

i want to make a data logger dynamicly update in lv table just like lv_chart , but it always error and make the ESP32 reboot .

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

ESP32

What LVGL version are you using?

8.3

What do you want to achieve?

Dynamic update on table

What have you tried so far?

i already using same logic like Chart

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

  lv_obj_t * table_log = lv_table_create(tab3);
  lv_obj_add_style(table_log, &style_tanggal, 0);
  lv_obj_set_width(table_log, 120);
  lv_obj_set_height(table_log, 100);
  lv_table_set_col_width(table_log, 0, 60);
  lv_table_set_col_width(table_log, 1, 60);
  lv_obj_set_style_pad_left(table_log, 0, LV_PART_ITEMS);
  lv_obj_set_style_pad_right(table_log, 0, LV_PART_ITEMS);
  lv_obj_set_style_pad_top(table_log, 3, LV_PART_ITEMS);
  lv_obj_set_style_pad_bottom(table_log, 3, LV_PART_ITEMS);
  lv_obj_set_scrollbar_mode(table_log, LV_SCROLLBAR_MODE_OFF);
  lv_obj_align(table_log, LV_ALIGN_CENTER, 0, 13 );

  /*Fill the first column*/
  lv_table_set_cell_value(table_log, 0, 0, "Time");

  /*Fill the second column*/
  lv_table_set_cell_value(table_log, 0, 1, "Value");
  
 lv_timer_t * table_updater = lv_timer_create(data_table, 10000, NULL);

  lv_obj_add_event_cb(table_log, draw_part_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);

static void data_table(lv_timer_t * timer) {
  static uint32_t cnt1 = 0;
  lv_table_set_cell_value_fmt(table_log, cnt1, 0, "%02d.%02d.%02d", now.hour(), now.minute(),  now.second());
  lv_table_set_cell_value_fmt(table_log, cnt1, 1, "%d", randomNumber);
  cnt1++;
  if(cnt1 > 6) {
    cnt1 == 0;
  } 
}

static void draw_part_event_cb(lv_event_t * e) {
  lv_obj_t * obj = lv_event_get_target(e);
  lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
  /*If the cells are drawn...*/
  if (dsc->part == LV_PART_ITEMS) {
    uint32_t row = dsc->id /  lv_table_get_col_cnt(obj);
    uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj);

    /*Make the texts in the first cell center aligned*/
    if (row == 0) {
      dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER;
      dsc->rect_dsc->bg_color = lv_color_mix((hijau), dsc->rect_dsc->bg_color, LV_OPA_20);
      dsc->rect_dsc->bg_opa = LV_OPA_COVER;
    }
    /*In the first column align the texts to the right*/
    else if (col == 0 || col == 1) {
      dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER;
    }
  }
}



## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.