BigW Consortium Gitlab

Commit 1dc04388 by Kiss-Vamosi Gabor

lv_gauge: updated, math_base: min max rename

parent f85741be
......@@ -322,10 +322,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
last_y = act_point.y;
last_x = act_point.x;
draw_area.x1 = min(act_area.x1, act_area.x2);
draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2);
draw_area.x1 = MATH_MIN(act_area.x1, act_area.x2);
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
}
if (hor == false && last_x != act_point.x) {
......@@ -338,10 +338,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
last_y = act_point.y;
last_x = act_point.x;
draw_area.x1 = min(act_area.x1, act_area.x2);
draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2);
draw_area.x1 = MATH_MIN(act_area.x1, act_area.x2);
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
}
......@@ -366,10 +366,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
act_area.y1 = last_y - width_half ;
act_area.y2 = act_point.y + width_half + width_1;
draw_area.x1 = min(act_area.x1, act_area.x2);
draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2);
draw_area.x1 = MATH_MIN(act_area.x1, act_area.x2);
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
}
if (hor == false) {
......@@ -380,10 +380,10 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
act_area.y1 = last_y;
act_area.y2 = act_point.y;
draw_area.x1 = min(act_area.x1, act_area.x2);
draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2);
draw_area.x1 = MATH_MIN(act_area.x1, act_area.x2);
draw_area.x2 = MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
}
}
......
......@@ -94,10 +94,10 @@ uint32_t area_get_size(const area_t * area_p)
bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p)
{
/* Get the smaller area from 'a1_p' and 'a2_p' */
res_p->x1 = max(a1_p->x1, a2_p->x1);
res_p->y1 = max(a1_p->y1, a2_p->y1);
res_p->x2 = min(a1_p->x2, a2_p->x2);
res_p->y2 = min(a1_p->y2, a2_p->y2);
res_p->x1 = MATH_MAX(a1_p->x1, a2_p->x1);
res_p->y1 = MATH_MAX(a1_p->y1, a2_p->y1);
res_p->x2 = MATH_MIN(a1_p->x2, a2_p->x2);
res_p->y2 = MATH_MIN(a1_p->y2, a2_p->y2);
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
bool union_ok = true;
......@@ -117,10 +117,10 @@ bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p)
*/
void area_join(area_t * a_res_p, const area_t * a1_p, const area_t * a2_p)
{
a_res_p->x1 = min(a1_p->x1, a2_p->x1);
a_res_p->y1 = min(a1_p->y1, a2_p->y1);
a_res_p->x2 = max(a1_p->x2, a2_p->x2);
a_res_p->y2 = max(a1_p->y2, a2_p->y2);
a_res_p->x1 = MATH_MIN(a1_p->x1, a2_p->x1);
a_res_p->y1 = MATH_MIN(a1_p->y1, a2_p->y1);
a_res_p->x2 = MATH_MAX(a1_p->x2, a2_p->x2);
a_res_p->y2 = MATH_MAX(a1_p->y2, a2_p->y2);
}
/**
......
......@@ -56,7 +56,7 @@ void txt_get_size(point_t * size_res, const char * text, const font_t * font,
act_line_length = txt_get_width(&text[line_start], new_line_start - line_start,
font, letter_space);
size_res->x = max(act_line_length, size_res->x);
size_res->x = MATH_MAX(act_line_length, size_res->x);
line_start = new_line_start;
}
......
......@@ -27,6 +27,7 @@
/*********************
* DEFINES
*********************/
#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/
/**********************
* TYPEDEFS
......@@ -37,11 +38,19 @@ typedef struct
{
lv_rects_t rects; /*Style of ancestor*/
/*New style element for this type */
lv_labels_t scale_labels;
lv_lines_t needle_lines;
cord_t label_pad;
uint16_t angle;
uint8_t label_num;
color_t mcolor_max; /*Top color at max.*/
color_t gcolor_max; /*Bootom color at max*/
/*Scale settings*/
uint16_t scale_angle; /*Angle of the scale in deg. (~220)*/
lv_labels_t scale_labels; /*Style of the labels*/
cord_t scale_pad; /*Padding of scale labels from the edge*/
uint8_t scale_label_num; /*Number of scale labels (~6)*/
/*Needle settings*/
lv_lines_t needle_lines; /*Style of neddles*/
color_t needle_color[LV_GAUGE_MAX_NEEDLE]; /*Color of needles*/
color_t needle_mid_color; /*Color of middle where the needles start*/
cord_t needle_mid_r; /*Radius of the needle middle area*/
opa_t needle_opa; /*Opacity of the needles*/
}lv_gauges_t;
/*Built-in styles of gauge*/
......@@ -57,7 +66,8 @@ typedef struct
/*New data for this type */
int16_t min;
int16_t max;
int16_t value;
int16_t * values;
uint8_t needle_num;
}lv_gauge_ext_t;
/**********************
......@@ -67,7 +77,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
lv_gauges_t * lv_gauges_get(lv_gauges_builtin_t style, lv_gauges_t * copy);
void lv_gauge_set_value(lv_obj_t * gauge, int16_t value);
void lv_gauge_set_value(lv_obj_t * gauge, int16_t value, uint8_t needle);
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num);
uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge);
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle);
/**********************
* MACROS
......
......@@ -311,6 +311,7 @@ static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t
}
else return false;
} else if(mode == LV_DESIGN_DRAW_MAIN) {
if(ext->h == 0 || ext->w == 0) return true;
area_t cords;
lv_obj_get_cords(img, &cords);
......
......@@ -145,8 +145,8 @@ void lv_line_set_points(lv_obj_t * line, const point_t * point_a, uint16_t point
cord_t xmax = LV_CORD_MIN;
cord_t ymax = LV_CORD_MIN;
for(i = 0; i < point_num; i++) {
xmax = max(point_a[i].x * us, xmax);
ymax = max(point_a[i].y * us, ymax);
xmax = MATH_MAX(point_a[i].x * us, xmax);
ymax = MATH_MAX(point_a[i].y * us, ymax);
}
lv_lines_t * lines = lv_obj_get_style(line);
......
......@@ -277,8 +277,8 @@ static bool lv_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void* param)
case LV_SIGNAL_DRAG_BEGIN:
if(style->sb_mode == LV_PAGE_SB_MODE_DRAG ) {
cord_t sbh_pad = max(style->sb_width, style->bg_rects.hpad);
cord_t sbv_pad = max(style->sb_width, style->bg_rects.vpad);
cord_t sbh_pad = MATH_MAX(style->sb_width, style->bg_rects.hpad);
cord_t sbv_pad = MATH_MAX(style->sb_width, style->bg_rects.vpad);
if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) {
page_ext->sbv_draw = 1;
}
......@@ -565,8 +565,8 @@ static void lv_page_sb_refresh(lv_obj_t * page)
cord_t vpad = style->bg_rects.vpad;
cord_t obj_w = lv_obj_get_width(page);
cord_t obj_h = lv_obj_get_height(page);
cord_t sbh_pad = max(style->sb_width, style->bg_rects.hpad);
cord_t sbv_pad = max(style->sb_width, style->bg_rects.vpad);
cord_t sbh_pad = MATH_MAX(style->sb_width, style->bg_rects.hpad);
cord_t sbv_pad = MATH_MAX(style->sb_width, style->bg_rects.vpad);
if(style->sb_mode == LV_PAGE_SB_MODE_OFF) return;
......
......@@ -563,7 +563,7 @@ static void lv_rect_layout_pretty(lv_obj_t * rect)
lv_obj_is_protected(child_rc, LV_PROTECT_POS) == false) {
if(w_row + lv_obj_get_width(child_rc) > w_obj) break; /*If the next object is already not fit then break*/
w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/
h_row = max(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/
h_row = MATH_MAX(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/
obj_num ++;
}
child_rc = ll_get_prev(&rect->child_ll, child_rc); /*Load the next object*/
......@@ -690,10 +690,10 @@ void lv_rect_refr_autofit(lv_obj_t * rect)
LL_READ(rect->child_ll, i) {
if(lv_obj_get_hidden(i) != false) continue;
new_cords.x1 = min(new_cords.x1, i->cords.x1);
new_cords.y1 = min(new_cords.y1, i->cords.y1);
new_cords.x2 = max(new_cords.x2, i->cords.x2);
new_cords.y2 = max(new_cords.y2, i->cords.y2);
new_cords.x1 = MATH_MIN(new_cords.x1, i->cords.x1);
new_cords.y1 = MATH_MIN(new_cords.y1, i->cords.y1);
new_cords.x2 = MATH_MAX(new_cords.x2, i->cords.x2);
new_cords.y2 = MATH_MAX(new_cords.y2, i->cords.y2);
}
/*If the value is not the init value then the page has >=1 child.*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment