Added gauge value format function
@@ -35,6 +35,8 @@ extern "C" {
* TYPEDEFS
**********************/
+typedef void (*value_format_type)(lv_obj_t * gauge, char buf[], int bufsize, lv_gauge_value_t value);
+
/*Data of gauge*/
typedef struct {
lv_linemeter_ext_t lmeter; /*Ext. of ancestor*/
@@ -47,6 +49,7 @@ typedef struct {
lv_style_list_t style_strong;
uint8_t needle_count; /*Number of needles*/
uint8_t label_count; /*Number of labels on the scale*/
+ value_format_type value_format_cb;
} lv_gauge_ext_t;
/*Styles*/
@@ -144,6 +147,13 @@ static inline void lv_gauge_set_angle_offset(lv_obj_t * gauge, uint16_t angle)
*/
void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
+/**
+ * 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
+ */
+void lv_gauge_set_formatter(lv_obj_t * gauge, value_format_type value_format_fn);
+
/*=====================
* Getter functions
*====================*/
