Renamed lv_gauge_format_cb_t
This commit is contained in:
@@ -84,7 +84,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->values = NULL;
|
||||
ext->needle_colors = NULL;
|
||||
ext->label_count = LV_GAUGE_DEF_LABEL_COUNT;
|
||||
ext->value_format_cb = NULL;
|
||||
ext->format_cb = NULL;
|
||||
|
||||
ext->needle_img = 0;
|
||||
ext->needle_img_pivot.x = 0;
|
||||
@@ -119,7 +119,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->values[i] = copy_ext->values[i];
|
||||
}
|
||||
ext->label_count = copy_ext->label_count;
|
||||
ext->value_format_cb = copy_ext->value_format_cb;
|
||||
ext->format_cb = copy_ext->format_cb;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(new_gauge, LV_STYLE_PROP_ALL);
|
||||
@@ -242,15 +242,15 @@ void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivo
|
||||
/**
|
||||
* Assign a function to format gauge values
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param value_format_fn pointer to function of value_format_type
|
||||
* @param format_cb pointer to function of lv_gauge_format_cb_t
|
||||
*/
|
||||
void lv_gauge_set_formatter(lv_obj_t * gauge, value_format_type value_format_fn)
|
||||
void lv_gauge_set_formatter_cb(lv_obj_t * gauge, lv_gauge_format_cb_t format_cb)
|
||||
{
|
||||
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
|
||||
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
ext->value_format_cb = value_format_fn;
|
||||
ext->format_cb = format_cb;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -490,10 +490,10 @@ static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
|
||||
int32_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
|
||||
scale_act += min;
|
||||
if(ext->value_format_cb == NULL)
|
||||
if(ext->format_cb == NULL)
|
||||
lv_utils_num_to_str(scale_act, scale_txt);
|
||||
else
|
||||
ext->value_format_cb(gauge, scale_txt, sizeof(scale_txt), scale_act);
|
||||
ext->format_cb(gauge, scale_txt, sizeof(scale_txt), scale_act);
|
||||
|
||||
lv_area_t label_cord;
|
||||
lv_point_t label_size;
|
||||
|
||||
Reference in New Issue
Block a user