How to set the distance between meter scale and the border of the meter

What LVGL version are you using?



I want to set the distance between meter scale and the border of the meter.

Some guys said that changing the r_mod of struct lv_meter_scale_t could achieve this. Here is the defination:

typedef struct {
    lv_color_t tick_color;
    uint16_t tick_cnt;
    uint16_t tick_length;
    uint16_t tick_width;

    lv_color_t tick_major_color;
    uint16_t tick_major_nth;
    uint16_t tick_major_length;
    uint16_t tick_major_width;

    int16_t label_gap;
    int16_t label_color;

    int32_t min;
    int32_t max;
    int16_t r_mod;
    uint16_t angle_range;
    int16_t rotation;
} lv_meter_scale_t;

I tried set r_mod different values, but they don’t work as expected.

   static lv_obj_t *time_meter = lv_meter_create(parent);
    lv_obj_set_size(time_meter, width, height);

    lv_meter_scale_t *time_scale = lv_meter_add_scale(time_meter);
    time_scale->r_mod = 0;
    // time_scale->r_mod = -50;
    // time_scale->r_mod = 50;

What should I do? Help :raising_hand_man:

Screenshot and/or video


lv_obj_set_style_pad_all(meter, 0, LV_STATE_DEFAULT | LV_PART_MAIN);

Thank you very much for your answer! Your response means that I no longer need to manually draw the scale lines, which is a tedious and boring task. Thank you again!

you are welcom,I am very glad that my answer can help you.