Description
I have a chart with shifting values. Somehow the memory overflows at 72% usage and the display freezes. I think it’s because the values don’t get deleted with lv_chart_set_next_value
. How would it be possible to delete the last values in the chart manually?
What MCU/Processor/Board and compiler are you using?
ESP32S3 Touch Display, framework: Arduino
What LVGL version are you using?
8.3.4
What do you want to achieve?
That the display works.
What have you tried so far?
I thought the old values would be deleted automatically with lv_chart_set_next_value
. I searched in the lv_chart.c
for functions which i could use.
init code
chart_main = lv_chart_create(tab2);
lv_obj_set_size(chart_main, 400, 200);
lv_obj_center(chart_main);
lv_obj_align(chart_main, LV_ALIGN_TOP_MID, 30, 0);
lv_chart_set_type(chart_main, LV_CHART_TYPE_LINE); /*Show lines and points too*/
lv_chart_set_update_mode(chart_main, LV_CHART_UPDATE_MODE_SHIFT);
lv_chart_set_range(chart_main, LV_CHART_AXIS_PRIMARY_Y, 0, 150);
lv_obj_add_event_cb(chart_main, draw_event_cb_chart_x_axis, LV_EVENT_DRAW_PART_BEGIN, NULL);
lv_obj_add_event_cb(chart_main, draw_event_cb_chart_y_axis, LV_EVENT_DRAW_PART_BEGIN, NULL);
// Add data series
ser_voltage_60s = lv_chart_add_series(chart_main, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y);
ser_voltage_600s = lv_chart_add_series(chart_main, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y);
ser_voltage_3600s = lv_chart_add_series(chart_main, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y);
code
lv_chart_set_next_value(chart_main, ser_voltage_600s, average_voltage_600s_value);
lv_chart_set_next_value(chart_main, ser_current_600s, average_current_600s_value);
lv_chart_set_next_value(chart_main, ser_power_600s, average_power_600s_value);
lv_chart_set_next_value(chart_main, ser_temp_600s, average_temp_600s_value);
lv_chart_refresh(chart_main);