What MCU/Processor/Board and compiler are you using?
Compiler: Eclipse running on Xilinx SDK
Board: Xilinx Development board
What LVGL version are you using?
8.1
What do you want to achieve?
I want to add custom labelling to a gauge. In lvgl version 7, I was able to do this with the use of the lv_gauge_set_formatter_cb function. This is how I did it:
lv_gauge_set_formatter_cb(vacuumPressureGauge, Vacuum_GaugeFormat);
static void Vacuum_GaugeFormat(lv_obj_t* gauge, char* buf, int bufSz, int value)
{
snprintf(buf, bufSz, "E-%d", value/100 - 8);
}
However, this function no longer exists in LVGL version 8 and I don’t know how to add custom labelling to the gauge anymore
What have you tried so far?
The only thing that seemed to change the labels on the gauge for me was using the lv_meter_set_scale_range function. However, this function only creates a linear gauge and does not allow me to create a logarithmic gauge with custom labelling values.
Screenshot and/or video
Here’s how the gauge looked in my version 7 build (which I want to emulate in my version 8 build):
I’m also looking for an alternative to lv_gauge_set_formatter_cb in LVGL 8. A few weeks ago I tried to revive an old thread about this topic, but sadly haven’t gotten any replies yet.
Kinda stupid of me that I’ve always overlooked the part in the documentation where it literally explains how to do this with events… (Meter (lv_meter) — LVGL documentation)