lvgl / lv_demos

Examples, tutorials and applications for the LVGL embedded GUI library

Home Page:https://lvgl.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lv_demo_widgets problem - no buffer size info

tdjastrzebski opened this issue · comments

I think I found a problem in lv_demo_widgets.c. chart_event_cb() and shop_chart_event_cb() functions contain this line providing chart tick labels:

lv_snprintf(dsc->text, sizeof(dsc->text), "%s", month[dsc->value]);

The problem is sizeof(dsc->text) yields a pointer size (=4U) while the actual buffer length specified in lv_chart.c draw_x_ticks() function is 16 (hardcoded):

char buf[16];
...
part_draw_dsc.text = buf;
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);

Perhaps .textSize property should be added to lv_obj_draw_part_dsc_t in addition to the buffer pointer .text.
Demo code as is currently can render only 3 chart tick label characters.
LVGL rev 8.1-Dev (current)

Good catch!

I agree with your suggestion. Could you send a pull request?

Both PRs are merged so I close this issue.