Merge branch 'master' into dev-6.1

This commit is contained in:
Themba Dube
2019-08-05 13:55:16 -04:00
29 changed files with 9064 additions and 7784 deletions

View File

@@ -868,8 +868,10 @@ static void indev_proc_release(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return;
}
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(proc)) return;
if(proc->types.pointer.drag_in_prog == 0) {
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(proc)) return;
}
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(proc)) return;

View File

@@ -1596,8 +1596,8 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj)
LV_LL_READ(obj->child_ll, i)
{
cnt++; // Count the child
cnt += lv_obj_count_children_recursive(i); // recursively count children's children
cnt++; /*Count the child*/
cnt += lv_obj_count_children_recursive(i); /*recursively count children's children*/
}
return cnt;

View File

@@ -74,13 +74,13 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, cons
deg_test = deg_test_inv;
if(deg_test(270, start_angle, end_angle))
hor_line(center_x - r_out + 1, center_y, mask, thickness - 1, color, opa); // Left Middle
hor_line(center_x - r_out + 1, center_y, mask, thickness - 1, color, opa); /*Left Middle*/
if(deg_test(90, start_angle, end_angle))
hor_line(center_x + r_in, center_y, mask, thickness - 1, color, opa); // Right Middle
hor_line(center_x + r_in, center_y, mask, thickness - 1, color, opa); /*Right Middle*/
if(deg_test(180, start_angle, end_angle))
ver_line(center_x, center_y - r_out + 1, mask, thickness - 1, color, opa); // Top Middle
ver_line(center_x, center_y - r_out + 1, mask, thickness - 1, color, opa); /*Top Middle*/
if(deg_test(0, start_angle, end_angle))
ver_line(center_x, center_y + r_in, mask, thickness - 1, color, opa); // Bottom middle
ver_line(center_x, center_y + r_in, mask, thickness - 1, color, opa); /*Bottom middle*/
uint32_t r_out_sqr = r_out * r_out;
uint32_t r_in_sqr = r_in * r_in;
@@ -177,61 +177,59 @@ static uint16_t fast_atan2(int x, int y)
unsigned char negflag;
unsigned char tempdegree;
unsigned char comp;
unsigned int degree; // this will hold the result
// signed int x; // these hold the XY vector at the start
// signed int y; // (and they will be destroyed)
unsigned int degree; /*this will hold the result*/
unsigned int ux;
unsigned int uy;
// Save the sign flags then remove signs and get XY as unsigned ints
/*Save the sign flags then remove signs and get XY as unsigned ints*/
negflag = 0;
if(x < 0) {
negflag += 0x01; // x flag bit
x = (0 - x); // is now +
negflag += 0x01; /*x flag bit*/
x = (0 - x); /*is now +*/
}
ux = x; // copy to unsigned var before multiply
ux = x; /*copy to unsigned var before multiply*/
if(y < 0) {
negflag += 0x02; // y flag bit
y = (0 - y); // is now +
negflag += 0x02; /*y flag bit*/
y = (0 - y); /*is now +*/
}
uy = y; // copy to unsigned var before multiply
uy = y; /*copy to unsigned var before multiply*/
// 1. Calc the scaled "degrees"
/*1. Calc the scaled "degrees"*/
if(ux > uy) {
degree = (uy * 45) / ux; // degree result will be 0-45 range
negflag += 0x10; // octant flag bit
degree = (uy * 45) / ux; /*degree result will be 0-45 range*/
negflag += 0x10; /*octant flag bit*/
} else {
degree = (ux * 45) / uy; // degree result will be 0-45 range
degree = (ux * 45) / uy; /*degree result will be 0-45 range*/
}
// 2. Compensate for the 4 degree error curve
/*2. Compensate for the 4 degree error curve*/
comp = 0;
tempdegree = degree; // use an unsigned char for speed!
if(tempdegree > 22) { // if top half of range
tempdegree = degree; /*use an unsigned char for speed!*/
if(tempdegree > 22) { /*if top half of range*/
if(tempdegree <= 44) comp++;
if(tempdegree <= 41) comp++;
if(tempdegree <= 37) comp++;
if(tempdegree <= 32) comp++; // max is 4 degrees compensated
} else { // else is lower half of range
if(tempdegree <= 32) comp++; /*max is 4 degrees compensated*/
} else { /*else is lower half of range*/
if(tempdegree >= 2) comp++;
if(tempdegree >= 6) comp++;
if(tempdegree >= 10) comp++;
if(tempdegree >= 15) comp++; // max is 4 degrees compensated
if(tempdegree >= 15) comp++; /*max is 4 degrees compensated*/
}
degree += comp; // degree is now accurate to +/- 1 degree!
degree += comp; /*degree is now accurate to +/- 1 degree!*/
// Invert degree if it was X>Y octant, makes 0-45 into 90-45
if(negflag & 0x10) degree = (90 - degree);
/*Invert degree if it was X>Y octant, makes 0-45 into 90-45*/
if(negflag & 0x10) degree = (90 - degree);
// 3. Degree is now 0-90 range for this quadrant,
// need to invert it for whichever quadrant it was in
if(negflag & 0x02) { // if -Y
if(negflag & 0x01) // if -Y -X
/*3. Degree is now 0-90 range for this quadrant,*/
/*need to invert it for whichever quadrant it was in*/
if(negflag & 0x02) { /*if -Y*/
if(negflag & 0x01) /*if -Y -X*/
degree = (180 + degree);
else // else is -Y +X
else /*else is -Y +X*/
degree = (180 - degree);
} else { // else is +Y
if(negflag & 0x01) // if +Y -X
} else { /*else is +Y*/
if(negflag & 0x01) /*if +Y -X*/
degree = (360 - degree);
}
return degree;

View File

@@ -110,21 +110,30 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8, 16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
p_color.full = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
buf_u8 += 4 * 4;
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
/* Get the current pixel.
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
* so the possible real width are 4, 8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
p_color.full = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_4BIT) {
buf_u8 += 4 * 16;
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
* so the possible real width are 2, 4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
p_color.full = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
buf_u8 += 4 * 256;
@@ -174,7 +183,10 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
uint8_t px_opa = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
return px_opa ? LV_OPA_TRANSP : LV_OPA_COVER;
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
@@ -183,7 +195,10 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
/* Get the current pixel.
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 4 ,8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
uint8_t px_opa = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
return opa_table[px_opa];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
@@ -193,7 +208,10 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
uint8_t px_opa = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
return opa_table[px_opa];
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {
@@ -228,7 +246,11 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x1) << (7 - bit));
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_2BIT) {
@@ -236,7 +258,10 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
/* Get the current pixel.
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
* so the possible real width are 4, 8 ,12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0x3) << (6 - bit));
@@ -245,7 +270,10 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((c.full & 0xF) << (4 - bit));
} else if(dsc->header.cf == LV_IMG_CF_INDEXED_8BIT) {
@@ -274,14 +302,22 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
opa = opa >> 7; /*opa -> [0,1]*/
uint8_t bit = x & 0x7;
x = x >> 3;
uint32_t px = (dsc->header.w >> 3) * y + x;
/* Get the current pixel.
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 8 ,16, 24 ...*/
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x1) << (7 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT) {
opa = opa >> 6; /*opa -> [0,3]*/
uint8_t bit = (x & 0x3) * 2;
x = x >> 2;
uint32_t px = (dsc->header.w >> 2) * y + x;
/* Get the current pixel.
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 4 ,8, 12 ...*/
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0x3) << (6 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT) {
@@ -289,7 +325,10 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
uint8_t bit = (x & 0x1) * 4;
x = x >> 1;
uint32_t px = (dsc->header.w >> 1) * y + x;
/* Get the current pixel.
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
* so the possible real width are 2 ,4, 6 ...*/
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
buf_u8[px] = buf_u8[px] | ((opa & 0xF) << (4 - bit));
} else if(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT) {

View File

@@ -91,7 +91,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
int32_t last_line_start = -1;
/*Check the hint to use the cached info*/
if(hint && y_ofs == 0) {
if(hint && y_ofs == 0 && coords->y1 < 0) {
/*If the label changed too much recalculate the hint.*/
if(LV_MATH_ABS(hint->coord_y - coords->y1) > LV_LABEL_HINT_UPDATE_TH - 2 * line_height) {
hint->line_start = -1;

View File

@@ -263,7 +263,8 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
/* The pattern stores the points of the line ending. It has the good direction and length.
* The worth case is the 45° line where pattern can have 1.41 x `width` points*/
lv_point_t * pattern = lv_draw_get_buf(width * 2 * sizeof(lv_point_t));
lv_coord_t pattern_size = width * 2;
lv_point_t * pattern = lv_draw_get_buf(pattern_size * sizeof(lv_point_t));
lv_coord_t i = 0;
/*Create a perpendicular pattern (a small line)*/
@@ -274,7 +275,7 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
uint32_t width_sqr = width * width;
/* Run for a lot of times. Meanwhile the real width will be determined as well */
for(i = 0; i < (lv_coord_t)sizeof(pattern); i++) {
for(i = 0; i < (lv_coord_t)pattern_size - 1; i++) {
pattern[i].x = pattern_line.p_act.x;
pattern[i].y = pattern_line.p_act.y;

View File

@@ -113,7 +113,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
/*Check the chacge first*/
/*Check the cache first*/
if(letter == fdsc->last_letter) return fdsc->last_glyph_id;
uint16_t i;

View File

@@ -102,7 +102,7 @@ typedef struct {
glyph_id = glyph_id_start + glyph_id_ofs_list[search(unicode_list, rcp)]
*/
uint16_t * unicode_list;
const uint16_t * unicode_list;
/** if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's `uint8_t *`
* if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's `uint16_t *`

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -311,7 +311,7 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
* GLYPH DESCRIPTION
*--------------------*/
static lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
static lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_h = 0, .box_w = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 128, .box_h = 0, .box_w = 0, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 0, .adv_w = 128, .box_h = 7, .box_w = 1, .ofs_x = 3, .ofs_y = -1},

View File

@@ -67,10 +67,10 @@ void lv_circ_next(lv_point_t * c, lv_coord_t * tmp)
c->y++;
if(*tmp <= 0) {
(*tmp) += 2 * c->y + 1; // Change in decision criterion for y -> y+1
(*tmp) += 2 * c->y + 1; /*Change in decision criterion for y -> y+1*/
} else {
c->x--;
(*tmp) += 2 * (c->y - c->x) + 1; // Change for y -> y+1, x -> x-1
(*tmp) += 2 * (c->y - c->x) + 1; /*Change for y -> y+1, x -> x-1*/
}
}

View File

@@ -38,10 +38,10 @@ typedef union
{
struct
{
MEM_UNIT used : 1; // 1: if the entry is used
MEM_UNIT d_size : 31; // Size off the data (1 means 4 bytes)
MEM_UNIT used : 1; /* 1: if the entry is used*/
MEM_UNIT d_size : 31; /* Size off the data (1 means 4 bytes)*/
} s;
MEM_UNIT header; // The header (used + d_size)
MEM_UNIT header; /* The header (used + d_size)*/
} lv_mem_header_t;
typedef struct
@@ -130,16 +130,16 @@ void * lv_mem_alloc(uint32_t size)
/*Use the built-in allocators*/
lv_mem_ent_t * e = NULL;
// Search for a appropriate entry
/* Search for a appropriate entry*/
do {
// Get the next entry
/* Get the next entry*/
e = ent_get_next(e);
/*If there is next entry then try to allocate there*/
if(e != NULL) {
alloc = ent_alloc(e, size);
}
// End if there is not next entry OR the alloc. is successful
/* End if there is not next entry OR the alloc. is successful*/
} while(e != NULL && alloc == NULL);
#else

View File

@@ -317,11 +317,12 @@ lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar)
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->pressed_date;
return ext->pressed_date.year != 0 ? &ext->pressed_date : NULL;
}
/**

View File

@@ -172,6 +172,7 @@ lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar);

View File

@@ -207,7 +207,6 @@ lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas)
*/
const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_t type)
{
// lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas);
const lv_style_t * style = NULL;
switch(type) {
@@ -483,6 +482,15 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@@ -634,6 +642,15 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@@ -677,6 +694,15 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
@@ -721,6 +747,15 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;
/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

View File

@@ -416,7 +416,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask)
for(i = 0; i < ext->needle_count; i++) {
/*Calculate the end point of a needle*/
int16_t needle_angle =
(ext->values[i] - min) * angle * (1 << LV_GAUGE_INTERPOLATE_SHIFT) / (max - min); //+ angle_ofs;
(ext->values[i] - min) * angle * (1 << LV_GAUGE_INTERPOLATE_SHIFT) / (max - min);
int16_t needle_angle_low = (needle_angle >> LV_GAUGE_INTERPOLATE_SHIFT) + angle_ofs;
int16_t needle_angle_high = needle_angle_low + 1;

View File

@@ -63,7 +63,7 @@ static const lv_btnm_ctrl_t kb_ctrl_spec_map[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, LV_KB_CTRL_BTN_FLAGS | 2, 6, 2, 2};
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
static const char * kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
"4", "5", "6", LV_SYMBOL_OK, "\n",
@@ -73,8 +73,8 @@ static const char * kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
static const lv_btnm_ctrl_t kb_ctrl_num_map[] = {
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 1, LV_KB_CTRL_BTN_FLAGS | 1};
1, 1, 1, 2,
1, 1, 1, 1, 1};
/* clang-format on */
/**********************
@@ -323,7 +323,7 @@ const lv_style_t * lv_kb_get_style(const lv_obj_t * kb, lv_kb_style_t type)
*/
void lv_kb_def_event_cb(lv_obj_t * kb, lv_event_t event)
{
if(event != LV_EVENT_VALUE_CHANGED && event != LV_EVENT_LONG_PRESSED_REPEAT) return;
if(event != LV_EVENT_VALUE_CHANGED) return;
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
uint16_t btn_id = lv_btnm_get_active_btn(kb);

View File

@@ -97,9 +97,11 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
ext->offset.x = 0;
ext->offset.y = 0;
#if LV_LABEL_LONG_TXT_HINT
ext->hint.line_start = -1;
ext->hint.coord_y = 0;
ext->hint.y = 0;
#endif
#if LV_LABEL_TEXT_SEL
ext->txt_sel_start = LV_LABEL_TEXT_SEL_OFF;
@@ -860,13 +862,18 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
flag &= ~LV_TXT_FLAG_CENTER;
}
}
#if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t * hint = &ext->hint;
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT)
hint = NULL;
#else
/*Just for compatibility*/
lv_draw_label_hint_t * hint = NULL;
#endif
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset,
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
lv_point_t size;
@@ -960,8 +967,9 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->text == NULL) return;
#if LV_LABEL_LONG_TXT_HINT
ext->hint.line_start = -1; /*The hint is invalid if the text changes*/
#endif
lv_coord_t max_w = lv_obj_get_width(label);
const lv_style_t * style = lv_obj_get_style(label);

View File

@@ -72,8 +72,10 @@ typedef struct
} dot;
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
lv_point_t offset; /*Text draw position offset*/
#if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t hint; /*Used to buffer info about large text*/
#endif
#if LV_USE_ANIMATION
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
#endif

View File

@@ -1045,10 +1045,6 @@ static void tabview_realign(lv_obj_t * tabview)
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
// lv_obj_set_height(ext->btns, 3 * LV_DPI / 4);
// lv_obj_set_width(ext->indic, LV_DPI);
break;
case LV_TABVIEW_BTNS_POS_BOTTOM:
lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);

View File

@@ -226,10 +226,10 @@ static void bar_init(void)
bar_bg.body.grad_color = bar_bg.body.main_color;
bar_bg.body.radius = 3;
bar_bg.body.border.width = 0;
bar_bg.body.padding.left = LV_DPI / 12;
bar_bg.body.padding.right = LV_DPI / 12;
bar_bg.body.padding.top = LV_DPI / 12;
bar_bg.body.padding.bottom = LV_DPI / 12;
bar_bg.body.padding.left = LV_DPI / 16;
bar_bg.body.padding.right = LV_DPI / 16;
bar_bg.body.padding.top = LV_DPI / 16;
bar_bg.body.padding.bottom = LV_DPI / 16;
lv_style_copy(&bar_indic, &bar_bg);
bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 85, 70);
@@ -807,18 +807,20 @@ static void style_mod(lv_group_t * group, lv_style_t * style)
{
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
uint16_t hue2 = (_hue + 60) % 360;
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = lv_color_hsv_to_rgb(_hue, 90, 70);
style->body.border.color = lv_color_hsv_to_rgb(hue2, 90, 70);
/*If not empty or has border then emphasis the border*/
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 30;
style->body.main_color = lv_color_mix(style->body.main_color, lv_color_hsv_to_rgb(_hue, 90, 70), LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, lv_color_hsv_to_rgb(_hue, 90, 70), LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, lv_color_hsv_to_rgb(_hue, 90, 70), LV_OPA_60);
style->body.main_color = lv_color_mix(style->body.main_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_60);
style->text.color = lv_color_mix(style->text.color, lv_color_hsv_to_rgb(_hue, 90, 70), LV_OPA_70);
style->text.color = lv_color_mix(style->text.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;
@@ -830,18 +832,21 @@ static void style_mod_edit(lv_group_t * group, lv_style_t * style)
{
(void)group; /*Unused*/
#if LV_COLOR_DEPTH != 1
uint16_t hue2 = (_hue + 300) % 360;
/*Make the style to be a little bit orange*/
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_GREEN;
/*If not empty or has border then emphasis the border*/
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 30;
style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
style->body.main_color = lv_color_mix(style->body.main_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
style->body.grad_color = lv_color_mix(style->body.grad_color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
style->body.shadow.color = lv_color_mix(style->body.shadow.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_60);
style->text.color = lv_color_mix(style->text.color, lv_color_hsv_to_rgb(hue2, 90, 70), LV_OPA_70);
#else
style->body.border.opa = LV_OPA_COVER;
style->body.border.color = LV_COLOR_BLACK;

View File

@@ -584,8 +584,8 @@ static void list_init(void)
list_btn_rel.body.padding.right = LV_DPI / 8;
lv_style_copy(&list_btn_pr, theme.style.btn.pr);
list_btn_pr.body.main_color = theme.style.btn.pr->body.grad_color;
list_btn_pr.body.grad_color = theme.style.btn.pr->body.main_color;
list_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 5);
list_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 5);
list_btn_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5);
list_btn_pr.body.border.width = 0;
list_btn_pr.body.padding.top = LV_DPI / 6;
@@ -597,12 +597,14 @@ static void list_init(void)
lv_style_copy(&list_btn_tgl_rel, &list_btn_rel);
list_btn_tgl_rel.body.opa = LV_OPA_COVER;
list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 8);
list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 8);
list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70);
list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70);
list_btn_tgl_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 40);
list_btn_tgl_rel.body.radius = list_bg.body.radius;
lv_style_copy(&list_btn_tgl_pr, &list_btn_tgl_rel);
list_btn_tgl_pr.body.main_color = theme.style.btn.tgl_pr->body.main_color;
list_btn_tgl_pr.body.grad_color = theme.style.btn.tgl_pr->body.grad_color;
list_btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 60);
list_btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 60);
theme.style.list.sb = &sb;
theme.style.list.bg = &list_bg;

View File

@@ -85,7 +85,7 @@ static void basic_init(void)
sb.body.grad_color = sb.body.main_color;
sb.body.border.width = 0;
sb.body.radius = LV_RADIUS_CIRCLE;
sb.body.padding.inner = LV_DPI / 10;
sb.body.padding.inner = LV_DPI / 15;
theme.style.scr = &scr;
theme.style.bg = &bg;