diff --git a/lv_objx/lv_gauge.c b/lv_objx/lv_gauge.c index 66ee2c78e7..a3ef56ddfe 100644 --- a/lv_objx/lv_gauge.c +++ b/lv_objx/lv_gauge.c @@ -186,11 +186,14 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value) * Set the scale settings of a gauge * @param gauge pointer to a gauge object * @param angle angle of the scale (0..360) - * @param line_cnt count of scale lines - * @param label_cnt count of scale labels + * @param line_cnt count of scale lines. + * The get a given "subdivision" lines between label, `line_cnt` = (sub_div + 1) * (label_cnt - 1) + 1 + * @param label_cnt count of scale labels. */ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint8_t label_cnt) { + /*TODO v6.0: change `line_cnt` to `subdiv_cnt`*/ + lv_lmeter_set_scale(gauge, angle, line_cnt); lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge); diff --git a/lv_objx/lv_gauge.h b/lv_objx/lv_gauge.h index 4542c4c919..beef9dc554 100644 --- a/lv_objx/lv_gauge.h +++ b/lv_objx/lv_gauge.h @@ -107,8 +107,9 @@ static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int16_t value) * Set the scale settings of a gauge * @param gauge pointer to a gauge object * @param angle angle of the scale (0..360) - * @param line_cnt count of scale lines - * @param label_cnt count of scale labels + * @param line_cnt count of scale lines. + * The get a given "subdivision" lines between label, `line_cnt` = (sub_div + 1) * (label_cnt - 1) + 1 + * @param label_cnt count of scale labels. */ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint8_t label_cnt); diff --git a/lv_objx/lv_lmeter.c b/lv_objx/lv_lmeter.c index 455d4e6b2c..915165dafc 100644 --- a/lv_objx/lv_lmeter.c +++ b/lv_objx/lv_lmeter.c @@ -276,7 +276,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_desig style_tmp.line.color = style->body.main_color; - /*Calculate every coordinate in x32 size to make rounding later*/ + /*Calculate every coordinate in a bigger size to make rounding later*/ r_out = r_out << LV_LMETER_LINE_UPSCALE; r_in = r_in << LV_LMETER_LINE_UPSCALE; @@ -363,12 +363,10 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par static lv_coord_t lv_lmeter_coord_round(int32_t x) { #if LV_LMETER_LINE_UPSCALE > 0 - bool was_negative; + bool was_negative = false; if(x < 0) { was_negative = true; x = -x; - } else { - was_negative = false; } x = (x >> LV_LMETER_LINE_UPSCALE) + ((x & LV_LMETER_LINE_UPSCALE_MASK) >> (LV_LMETER_LINE_UPSCALE - 1));