About lv_label_set_text_fmt float

lv_label_set_text_fmt(label_current_x,"%f",0.545);

Wrong display character f

There is a setting for this in lv_conf.h.

I can’t find it. Can you tell me?

I don’t want to set font, I want to display floating point and the display character f

If you are not using a custom printf implementation:

If you are using a custom printf implementation, you will have to check its configuration.

2 Likes

Good thank you

Just an update for those using LVGL V9: I’ve run into this same issue, so here’s what fixes it now.

Set “LV_USE_FLOAT” in the config to 1.

/* Use `float` as `lv_value_precise_t` */
#define LV_USE_FLOAT            1

Hi,

I am using LVGL V9.1.0, however, setting

#define LV_USE_FLOAT 1

does not work for me. In the lv_conf.h file, I’ve also set

/* clang-format off */
#if 1 /*Set it to "1" to enable content*/

When I use

lv_label_set_text_fmt(maxOD, "Max. OD: %f", maxODValue);

it still gives

Max. OD: f

as output. Any idea what I am missing?