mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Merge branch 'dev-7.0' of https://github.com/littlevgl/lvgl into dev-7.0
This commit is contained in:
commit
29bf244e89
@ -24,3 +24,11 @@
|
||||
--preserve-date
|
||||
--formatted
|
||||
--exclude=lv_conf_internal.h
|
||||
--exclude=../src/lv_font/lv_font_roboto_12.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_12_subpx.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_16.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_22.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28_compressed.c
|
||||
--exclude=../src/lv_font/lv_font_unscii_8.c
|
||||
|
||||
|
@ -1292,7 +1292,8 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop)
|
||||
if(prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_INHERIT_MASK))
|
||||
/*Send style change signals*/
|
||||
refresh_children_style(obj);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
}
|
||||
|
@ -584,7 +584,8 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
|
||||
* For example: `lv_obj_style_get_trasition_path()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_prop_cb_t value)
|
||||
static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
|
||||
lv_style_prop_cb_t value)
|
||||
{
|
||||
lv_style_fptr_dptr_t fd;
|
||||
fd.fptr = value;
|
||||
@ -603,7 +604,8 @@ static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type
|
||||
* For example: `lv_obj_style_get_text_font()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
static inline void _lv_obj_set_style_local_data_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * value)
|
||||
static inline void _lv_obj_set_style_local_data_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
|
||||
const void * value)
|
||||
{
|
||||
lv_style_fptr_dptr_t fd;
|
||||
fd.fptr = NULL;
|
||||
@ -1089,7 +1091,8 @@ lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, l
|
||||
* For example: `lv_obj_style_get_trasition_path()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
|
||||
static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part,
|
||||
lv_style_property_t prop)
|
||||
{
|
||||
lv_style_fptr_dptr_t fd;
|
||||
fd = _lv_obj_get_style_ptr(obj, part, prop);
|
||||
|
@ -217,7 +217,8 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_6, transition_prop_6, lv_style_int
|
||||
#if LV_USE_ANIMATION
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_anim_path_cb_t, _func_ptr, func_ptr)
|
||||
#else
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path,lv_style_prop_cb_t, _func_ptr, func_ptr) /*For compatibility*/
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_style_prop_cb_t, _func_ptr,
|
||||
func_ptr) /*For compatibility*/
|
||||
#endif
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)
|
||||
|
@ -587,7 +587,8 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_prop_cb_t value)
|
||||
static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_style_property_t prop,
|
||||
lv_style_prop_cb_t value)
|
||||
{
|
||||
lv_style_fptr_dptr_t fd;
|
||||
fd.dptr = NULL;
|
||||
@ -603,7 +604,8 @@ static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_s
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
static inline void lv_style_list_set_local_data_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
|
||||
static inline void lv_style_list_set_local_data_ptr(lv_style_list_t * list, lv_style_property_t prop,
|
||||
const void * value)
|
||||
{
|
||||
lv_style_fptr_dptr_t fd;
|
||||
fd.fptr = NULL;
|
||||
|
@ -393,7 +393,8 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
disp_buf_tmp[x + 1] = color;
|
||||
disp_buf_tmp[x + 2] = color;
|
||||
disp_buf_tmp[x + 3] = color;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_tmp_x = (const lv_opa_t *)mask32;
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
|
||||
@ -431,7 +432,8 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
const lv_opa_t * mask_tmp_x = &mask_tmp[draw_area->x1];
|
||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
||||
if(*mask_tmp_x) {
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(
|
||||
*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_tmp[x].full) {
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp->driver.screen_transp) {
|
||||
|
@ -486,8 +486,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
|
||||
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
|
||||
|
||||
if(transform == false)
|
||||
{
|
||||
if(transform == false) {
|
||||
if(alpha_byte) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
|
@ -52,7 +52,8 @@ static const uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping w
|
||||
static const uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255};
|
||||
204, 221, 238, 255
|
||||
};
|
||||
static const uint8_t bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
@ -68,7 +69,8 @@ static const uint8_t bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
/*clang-format on*/
|
||||
|
||||
/**********************
|
||||
|
@ -381,12 +381,23 @@ static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len
|
||||
{
|
||||
uint8_t bit_mask;
|
||||
switch(len) {
|
||||
case 1: bit_mask = 0x1; break;
|
||||
case 2: bit_mask = 0x3; break;
|
||||
case 3: bit_mask = 0x7; break;
|
||||
case 4: bit_mask = 0xF; break;
|
||||
case 8: bit_mask = 0xFF; break;
|
||||
default: bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
|
||||
case 1:
|
||||
bit_mask = 0x1;
|
||||
break;
|
||||
case 2:
|
||||
bit_mask = 0x3;
|
||||
break;
|
||||
case 3:
|
||||
bit_mask = 0x7;
|
||||
break;
|
||||
case 4:
|
||||
bit_mask = 0xF;
|
||||
break;
|
||||
case 8:
|
||||
bit_mask = 0xFF;
|
||||
break;
|
||||
default:
|
||||
bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = bit_pos >> 3;
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "lv_utils.h"
|
||||
#include "lv_math.h"
|
||||
#include "lv_printf.h"
|
||||
#include "lv_txt.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -26,6 +28,7 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static char decimal_separator[2] = ".";
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -72,6 +75,31 @@ char * lv_utils_num_to_str(int32_t num, char * buf)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a fixed point number to string
|
||||
* @param num a number
|
||||
* @param decimals number of digits after decimal point
|
||||
* @param buf pointer to a `char` buffer
|
||||
* @param bufsize length of buffer
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str_fixed(int32_t num, int32_t decimals, char * buf, size_t bufsize)
|
||||
{
|
||||
lv_snprintf(buf, bufsize, "%0*d", decimals+1, num);
|
||||
if(decimals > 0)
|
||||
lv_txt_ins(buf, strlen(buf) - decimals, decimal_separator);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the decimal separator character used by lv_utils_num_to_str_fixed
|
||||
* @param separator the decimal separator char
|
||||
*/
|
||||
void lv_utils_set_decimal_separator(char separator)
|
||||
{
|
||||
decimal_separator[0] = separator;
|
||||
}
|
||||
|
||||
/** Searches base[0] to base[n - 1] for an item that matches *key.
|
||||
*
|
||||
* @note The function cmp must return negative if its first
|
||||
|
@ -35,6 +35,22 @@ extern "C" {
|
||||
*/
|
||||
char * lv_utils_num_to_str(int32_t num, char * buf);
|
||||
|
||||
/**
|
||||
* Convert a fixed point number to string
|
||||
* @param num a number
|
||||
* @param decimals number of digits after decimal point
|
||||
* @param buf pointer to a `char` buffer
|
||||
* @param bufsize length of buffer
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str_fixed(int32_t num, int32_t decimals, char * buf, size_t bufsize);
|
||||
|
||||
/**
|
||||
* Set the decimal separator character used by lv_utils_num_to_str_fixed
|
||||
* @param separator the decimal separator char
|
||||
*/
|
||||
void lv_utils_set_decimal_separator(char separator);
|
||||
|
||||
/** Searches base[0] to base[n - 1] for an item that matches *key.
|
||||
*
|
||||
* @note The function cmp must return negative if its first
|
||||
|
@ -760,7 +760,8 @@ static void tabview_init(void)
|
||||
lv_style_init(&tabview_btns_bg);
|
||||
lv_style_set_bg_opa(&tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&tabview_btns_bg, LV_STATE_DEFAULT, COLOR_BG);
|
||||
lv_style_set_border_color(&tabview_btns_bg, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0xe4eaf0) : lv_color_hex(0x3b3e42));
|
||||
lv_style_set_border_color(&tabview_btns_bg, LV_STATE_DEFAULT,
|
||||
IS_LIGHT ? lv_color_hex(0xe4eaf0) : lv_color_hex(0x3b3e42));
|
||||
lv_style_set_border_width(&tabview_btns_bg, LV_STATE_DEFAULT, LV_DPI / 30 > 0 ? LV_DPI / 30 : 1);
|
||||
lv_style_set_border_side(&tabview_btns_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_text_color(&tabview_btns_bg, LV_STATE_DEFAULT, COLOR_SCR_TEXT);
|
||||
|
@ -382,7 +382,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_coord_t right_bg = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
|
||||
lv_coord_t top_bg = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
|
||||
lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
|
||||
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg, lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
|
||||
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg,
|
||||
lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
|
||||
lv_coord_t x = arc->coords.x1 + r + left_bg;
|
||||
lv_coord_t y = arc->coords.y1 + r + top_bg;
|
||||
|
||||
|
@ -485,7 +485,8 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
|
||||
lv_coord_t anim_cur_value_end_x =
|
||||
(int32_t)((int32_t)anim_length * (ext->cur_value_anim.anim_end - ext->min_value)) / range;
|
||||
|
||||
anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) * ext->cur_value_anim.anim_state) /
|
||||
anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) *
|
||||
ext->cur_value_anim.anim_state) /
|
||||
LV_BAR_ANIM_STATE_END);
|
||||
}
|
||||
else
|
||||
|
@ -233,7 +233,8 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
/* Set the button's area.
|
||||
* If inner padding is zero then use the prev. button x2 as x1 to avoid rounding
|
||||
* errors*/
|
||||
if(btn_i != 0 && inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) || (act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
|
||||
if(btn_i != 0 && inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) ||
|
||||
(act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
|
||||
lv_area_set(&ext->button_areas[btn_i], ext->button_areas[btn_i - 1].x2, act_y, act_x + act_unit_w,
|
||||
act_y + btn_h);
|
||||
}
|
||||
|
@ -84,6 +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->format_cb = NULL;
|
||||
|
||||
ext->needle_img = 0;
|
||||
ext->needle_img_pivot.x = 0;
|
||||
@ -118,6 +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->format_cb = copy_ext->format_cb;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(new_gauge, LV_STYLE_PROP_ALL);
|
||||
@ -173,7 +175,7 @@ void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_co
|
||||
* @param needle_id the id of the needle
|
||||
* @param value the new value
|
||||
*/
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value)
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
|
||||
{
|
||||
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
|
||||
|
||||
@ -237,6 +239,20 @@ void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivo
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a function to format gauge values
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param format_cb pointer to function of lv_gauge_format_cb_t
|
||||
*/
|
||||
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->format_cb = format_cb;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@ -247,7 +263,7 @@ void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivo
|
||||
* @param needle the id of the needle
|
||||
* @return the value of the needle [min,max]
|
||||
*/
|
||||
int16_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle)
|
||||
int32_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle)
|
||||
{
|
||||
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
|
||||
|
||||
@ -454,8 +470,8 @@ static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
int16_t scale_angle = lv_linemeter_get_scale_angle(gauge);
|
||||
uint16_t label_num = ext->label_count;
|
||||
int16_t angle_ofs = 90 + (360 - scale_angle) / 2;
|
||||
int16_t min = lv_gauge_get_min_value(gauge);
|
||||
int16_t max = lv_gauge_get_max_value(gauge);
|
||||
int32_t min = lv_gauge_get_min_value(gauge);
|
||||
int32_t max = lv_gauge_get_max_value(gauge);
|
||||
|
||||
lv_draw_label_dsc_t label_dsc;
|
||||
lv_draw_label_dsc_init(&label_dsc);
|
||||
@ -472,9 +488,12 @@ static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
lv_coord_t x = (int32_t)((int32_t)lv_trigo_sin(angle + 90) * r) / LV_TRIGO_SIN_MAX;
|
||||
x += x_ofs;
|
||||
|
||||
int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
|
||||
int32_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
|
||||
scale_act += min;
|
||||
if(ext->format_cb == NULL)
|
||||
lv_utils_num_to_str(scale_act, scale_txt);
|
||||
else
|
||||
ext->format_cb(gauge, scale_txt, sizeof(scale_txt), scale_act);
|
||||
|
||||
lv_area_t label_cord;
|
||||
lv_point_t label_size;
|
||||
|
@ -35,11 +35,13 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char buf[], int bufsize, int32_t value);
|
||||
|
||||
/*Data of gauge*/
|
||||
typedef struct {
|
||||
lv_linemeter_ext_t lmeter; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
int16_t * values; /*Array of the set values (for needles) */
|
||||
int32_t * values; /*Array of the set values (for needles) */
|
||||
const lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/
|
||||
const void * needle_img;
|
||||
lv_point_t needle_img_pivot;
|
||||
@ -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*/
|
||||
lv_gauge_format_cb_t format_cb;
|
||||
} lv_gauge_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
@ -89,7 +92,7 @@ void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_co
|
||||
* @param needle_id the id of the needle
|
||||
* @param value the new value
|
||||
*/
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value);
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a gauge
|
||||
@ -97,7 +100,7 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value);
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
static inline void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max)
|
||||
static inline void lv_gauge_set_range(lv_obj_t * gauge, int32_t min, int32_t max)
|
||||
{
|
||||
lv_linemeter_set_range(gauge, min, max);
|
||||
}
|
||||
@ -107,7 +110,7 @@ static inline void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param value the critical value
|
||||
*/
|
||||
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int16_t value)
|
||||
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int32_t value)
|
||||
{
|
||||
lv_linemeter_set_value(gauge, value);
|
||||
}
|
||||
@ -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 format_cb pointer to function of lv_gauge_format_cb_t
|
||||
*/
|
||||
void lv_gauge_set_formatter_cb(lv_obj_t * gauge, lv_gauge_format_cb_t format_cb);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@ -154,7 +164,7 @@ void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivo
|
||||
* @param needle the id of the needle
|
||||
* @return the value of the needle [min,max]
|
||||
*/
|
||||
int16_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle);
|
||||
int32_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle);
|
||||
|
||||
/**
|
||||
* Get the count of needles on a gauge
|
||||
@ -168,7 +178,7 @@ uint8_t lv_gauge_get_needle_count(const lv_obj_t * gauge);
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return the minimum value of the gauge
|
||||
*/
|
||||
static inline int16_t lv_gauge_get_min_value(const lv_obj_t * lmeter)
|
||||
static inline int32_t lv_gauge_get_min_value(const lv_obj_t * lmeter)
|
||||
{
|
||||
return lv_linemeter_get_min_value(lmeter);
|
||||
}
|
||||
@ -178,7 +188,7 @@ static inline int16_t lv_gauge_get_min_value(const lv_obj_t * lmeter)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return the maximum value of the gauge
|
||||
*/
|
||||
static inline int16_t lv_gauge_get_max_value(const lv_obj_t * lmeter)
|
||||
static inline int32_t lv_gauge_get_max_value(const lv_obj_t * lmeter)
|
||||
{
|
||||
return lv_linemeter_get_max_value(lmeter);
|
||||
}
|
||||
@ -188,7 +198,7 @@ static inline int16_t lv_gauge_get_max_value(const lv_obj_t * lmeter)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return the critical value
|
||||
*/
|
||||
static inline int16_t lv_gauge_get_critical_value(const lv_obj_t * gauge)
|
||||
static inline int32_t lv_gauge_get_critical_value(const lv_obj_t * gauge)
|
||||
{
|
||||
return lv_linemeter_get_value(gauge);
|
||||
}
|
||||
|
@ -293,7 +293,8 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
|
||||
lv_obj_init_draw_img_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &img_dsc);
|
||||
lv_draw_img(&imgbtn->coords, clip_area, src, &img_dsc);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
#if LV_IMGBTN_TILED
|
||||
const void * src = ext->img_src_left[state];
|
||||
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
|
||||
|
@ -113,7 +113,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param value new value
|
||||
*/
|
||||
void lv_linemeter_set_value(lv_obj_t * lmeter, int16_t value)
|
||||
void lv_linemeter_set_value(lv_obj_t * lmeter, int32_t value)
|
||||
{
|
||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||
|
||||
@ -131,7 +131,7 @@ void lv_linemeter_set_value(lv_obj_t * lmeter, int16_t value)
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_linemeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max)
|
||||
void lv_linemeter_set_range(lv_obj_t * lmeter, int32_t min, int32_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||
|
||||
@ -194,7 +194,7 @@ void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle)
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_value(const lv_obj_t * lmeter)
|
||||
int32_t lv_linemeter_get_value(const lv_obj_t * lmeter)
|
||||
{
|
||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||
|
||||
@ -207,7 +207,7 @@ int16_t lv_linemeter_get_value(const lv_obj_t * lmeter)
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the minimum value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_min_value(const lv_obj_t * lmeter)
|
||||
int32_t lv_linemeter_get_min_value(const lv_obj_t * lmeter)
|
||||
{
|
||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||
|
||||
@ -220,7 +220,7 @@ int16_t lv_linemeter_get_min_value(const lv_obj_t * lmeter)
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the maximum value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_max_value(const lv_obj_t * lmeter)
|
||||
int32_t lv_linemeter_get_max_value(const lv_obj_t * lmeter)
|
||||
{
|
||||
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
|
||||
|
||||
|
@ -33,9 +33,9 @@ typedef struct {
|
||||
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
|
||||
uint16_t angle_ofs;
|
||||
uint16_t line_cnt; /*Count of lines */
|
||||
int16_t cur_value;
|
||||
int16_t min_value;
|
||||
int16_t max_value;
|
||||
int32_t cur_value;
|
||||
int32_t min_value;
|
||||
int32_t max_value;
|
||||
} lv_linemeter_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
@ -68,7 +68,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param value new value
|
||||
*/
|
||||
void lv_linemeter_set_value(lv_obj_t * lmeter, int16_t value);
|
||||
void lv_linemeter_set_value(lv_obj_t * lmeter, int32_t value);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a line meter
|
||||
@ -76,7 +76,7 @@ void lv_linemeter_set_value(lv_obj_t * lmeter, int16_t value);
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_linemeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max);
|
||||
void lv_linemeter_set_range(lv_obj_t * lmeter, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the scale settings of a line meter
|
||||
@ -102,21 +102,21 @@ void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle);
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_value(const lv_obj_t * lmeter);
|
||||
int32_t lv_linemeter_get_value(const lv_obj_t * lmeter);
|
||||
|
||||
/**
|
||||
* Get the minimum value of a line meter
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the minimum value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_min_value(const lv_obj_t * lmeter);
|
||||
int32_t lv_linemeter_get_min_value(const lv_obj_t * lmeter);
|
||||
|
||||
/**
|
||||
* Get the maximum value of a line meter
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @return the maximum value of the line meter
|
||||
*/
|
||||
int16_t lv_linemeter_get_max_value(const lv_obj_t * lmeter);
|
||||
int32_t lv_linemeter_get_max_value(const lv_obj_t * lmeter);
|
||||
|
||||
/**
|
||||
* Get the scale number of a line meter
|
||||
|
@ -986,7 +986,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
#if LV_USE_GROUP
|
||||
if(lv_obj_get_group(page)) {
|
||||
lv_group_focus_obj(page);
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
|
||||
|
@ -273,10 +273,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
|
||||
lv_coord_t dist_left, dist_right;
|
||||
if(hor) {
|
||||
if((base_dir != LV_BIDI_DIR_RTL && p.x > ext->right_knob_area.x2) || (base_dir == LV_BIDI_DIR_RTL && p.x < ext->right_knob_area.x1)) {
|
||||
if((base_dir != LV_BIDI_DIR_RTL && p.x > ext->right_knob_area.x2) || (base_dir == LV_BIDI_DIR_RTL &&
|
||||
p.x < ext->right_knob_area.x1)) {
|
||||
ext->value_to_set = &ext->bar.cur_value;
|
||||
}
|
||||
else if((base_dir != LV_BIDI_DIR_RTL && p.x < ext->left_knob_area.x1) || (base_dir == LV_BIDI_DIR_RTL && p.x > ext->left_knob_area.x2)) {
|
||||
else if((base_dir != LV_BIDI_DIR_RTL && p.x < ext->left_knob_area.x1) || (base_dir == LV_BIDI_DIR_RTL &&
|
||||
p.x > ext->left_knob_area.x2)) {
|
||||
ext->value_to_set = &ext->bar.start_value;
|
||||
}
|
||||
else {
|
||||
|
@ -219,7 +219,8 @@ static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_ar
|
||||
if(base_dir != LV_BIDI_DIR_RTL) {
|
||||
knob_area.x1 = ext->bar.indic_area.x2 - ((act_indic_w * knob_size) / max_indic_w);
|
||||
knob_area.x2 = knob_area.x1 + knob_size;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
knob_area.x2 = ext->bar.indic_area.x1 + ((act_indic_w * knob_size) / max_indic_w);
|
||||
knob_area.x1 = knob_area.x2 - knob_size;
|
||||
}
|
||||
|
@ -740,13 +740,14 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_
|
||||
label_dsc[cell_type].letter_space, label_dsc[cell_type].line_space,
|
||||
lv_area_get_width(&txt_area), txt_flags);
|
||||
|
||||
label_dsc[cell_type].flag = 0;
|
||||
/*Align the content to the middle if not cropped*/
|
||||
if(format.s.crop == 0) {
|
||||
txt_area.y1 = cell_area.y1 + h_row / 2 - txt_size.y / 2;
|
||||
txt_area.y2 = cell_area.y1 + h_row / 2 + txt_size.y / 2;
|
||||
label_dsc[cell_type].flag |= LV_TXT_FLAG_FIT;
|
||||
}
|
||||
|
||||
label_dsc[cell_type].flag = 0;
|
||||
switch(format.s.align) {
|
||||
default:
|
||||
case LV_LABEL_ALIGN_LEFT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user