Voltmeter with a comma values

Hi all

Not sure if I am in teh right forum

I want to create a voltmeter with a range of 10 - 15 volts. The display should show one decimal place. Since lv_meter_set_indicator_end_value does not accept decimal values, my idea is to set the range to 100 - 150, so a voltage of 12.4V becomes 124. This works so far. My problem is that the main tick labels now also show 100 - 150. How can I adjust the labels to show 10 - 15?
As ESP_Panel_Library at the moment do not support Version 9.x, I am limitet to Version 8.3

That is my code

       // Create the meter
       _meter = lv_meter_create(_panel);
       lv_obj_set_size(_meter, 200, 200);
       lv_obj_align(_meter, LV_ALIGN_CENTER, 0, -40);
       lv_obj_set_style_bg_color(_meter, lv_color_black(), 0);

       /*Remove the circle from the middle*/
       lv_obj_remove_style(_meter, NULL, LV_PART_INDICATOR);

       // Add a scale to the meter
       lv_meter_scale_t* scale_ = lv_meter_add_scale(_meter);
       lv_meter_set_scale_ticks(_meter, scale_, _numberOfTicks, 2, 10, lv_palette_main(LV_PALETTE_GREY)); // _numberOfTicks Ticks für den Bereich 10-15V
       lv_meter_set_scale_major_ticks(_meter, scale_, 10, 4, 15, lv_color_white(), 10); // Major Ticks alle 1V
       lv_meter_set_scale_range(_meter, scale_, 100, 150, 270, 90);
       lv_obj_set_style_text_color(_meter, lv_color_white(), LV_PART_TICKS);

       // Add an arc indicator to the meter
       _indic = lv_meter_add_arc(_meter, scale_, 10, lv_palette_main(LV_PALETTE_GREEN), 0);

image

Inside the function draw_ticks_and_labels(…)
within the function, text formatting is performed for display on the label.

Change the function, or add an additional parameter with which you will set an additional condition when formatting, data type (int, float), and number of decimal places

line with code lv_snprintf(buf, sizeof(buf), “%” LV_PRId32, value_of_line);, should be replaced with e.g.: (this is just for a test)

  float number = (float)value_of_line;
  int int_part = (int)(number / 10);       
  int decimal_part = (int)((number / 10 - int_part) * 10); 
  lv_snprintf(buf, sizeof(buf), "%d,%d", int_part, decimal_part);