mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Merge 57079452b0da9b9072fa88da8354e020cc6b6e6b into dev
This commit is contained in:
commit
ab6f93db24
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "7.1.0",
|
||||
"version": "7.2.0",
|
||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
||||
"repository": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for LVGL v7.1.0
|
||||
* Configuration file for LVGL v7.2.0
|
||||
*/
|
||||
|
||||
/*
|
||||
|
2
lvgl.h
2
lvgl.h
@ -79,7 +79,7 @@ extern "C" {
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 3
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO "dev"
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
@ -23,9 +23,9 @@
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
static void scr_load_anim_start(lv_anim_t * a);
|
||||
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scr_anim_ready(lv_anim_t * a);
|
||||
static void scr_load_anim_start(lv_anim_t * a);
|
||||
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scr_anim_ready(lv_anim_t * a);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -166,7 +166,7 @@ void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color)
|
||||
* @param disp pointer to a display
|
||||
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||
*/
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
@ -248,60 +248,60 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_anim_set_delay(&a_old, delay);
|
||||
|
||||
switch(anim_type) {
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_LEFT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_TOP:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d));
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0);
|
||||
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y);
|
||||
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d));
|
||||
break;
|
||||
|
||||
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
|
||||
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
break;
|
||||
case LV_SCR_LOAD_ANIM_FADE_ON:
|
||||
lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim);
|
||||
lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
break;
|
||||
}
|
||||
|
||||
lv_anim_start(&a_new);
|
||||
|
@ -35,7 +35,7 @@ typedef enum {
|
||||
LV_SCR_LOAD_ANIM_MOVE_TOP,
|
||||
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
|
||||
LV_SCR_LOAD_ANIM_FADE_ON,
|
||||
}lv_scr_load_anim_t;
|
||||
} lv_scr_load_anim_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -98,7 +98,7 @@ void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color);
|
||||
* @param disp pointer to a display
|
||||
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||
*/
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
|
||||
/**
|
||||
* Opacity of the background
|
||||
|
@ -85,8 +85,10 @@ static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coor
|
||||
static void report_style_mod_core(void * style_p, lv_obj_t * obj);
|
||||
static void refresh_children_style(lv_obj_t * obj);
|
||||
static void base_dir_refr_children(lv_obj_t * obj);
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state);
|
||||
@ -3863,7 +3865,8 @@ static void base_dir_refr_children(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
lv_point_t new_pos;
|
||||
_lv_area_align(&base->coords, &obj->coords, align, &new_pos);
|
||||
@ -3882,7 +3885,8 @@ static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t ali
|
||||
else if(y_set) lv_obj_set_y(obj, new_pos.y);
|
||||
}
|
||||
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
|
||||
lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
lv_coord_t new_x = lv_obj_get_x(obj);
|
||||
lv_coord_t new_y = lv_obj_get_y(obj);
|
||||
|
@ -517,10 +517,12 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
lv_area_t a;
|
||||
lv_area_set(&a, 0, 0, header.w - 1, header.h - 1);
|
||||
lv_draw_img(&a, &start_mask, disp_refr->bg_img, &dsc);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Can't draw the background image")
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_draw_rect_dsc_t dsc;
|
||||
lv_draw_rect_dsc_init(&dsc);
|
||||
dsc.bg_color = disp_refr->bg_color;
|
||||
@ -542,8 +544,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
|
||||
|
||||
if(top_act_scr == NULL) {
|
||||
top_act_scr = disp_refr->act_scr;
|
||||
}
|
||||
top_act_scr = disp_refr->act_scr;
|
||||
}
|
||||
/*Do the refreshing from the top object*/
|
||||
lv_refr_obj_and_children(top_act_scr, &start_mask);
|
||||
|
||||
|
@ -115,7 +115,8 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
||||
}
|
||||
|
||||
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp, prefilter);
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp,
|
||||
prefilter);
|
||||
return decompr_buf;
|
||||
}
|
||||
|
||||
@ -349,7 +350,7 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
uint8_t * line_buf2 = NULL;
|
||||
|
||||
if(prefilter) {
|
||||
line_buf2= _lv_mem_buf_get(w);
|
||||
line_buf2 = _lv_mem_buf_get(w);
|
||||
}
|
||||
|
||||
decompress_line(line_buf1, w);
|
||||
@ -371,7 +372,8 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
bits_write(out, wrp, line_buf1[x], bpp);
|
||||
wrp += wr_size;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
decompress_line(line_buf1, w);
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
|
@ -150,7 +150,7 @@ typedef struct {
|
||||
typedef enum {
|
||||
LV_FONT_FMT_TXT_PLAIN = 0,
|
||||
LV_FONT_FMT_TXT_COMPRESSED = 1,
|
||||
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER= 1,
|
||||
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 1,
|
||||
} lv_font_fmt_txt_bitmap_format_t;
|
||||
|
||||
|
||||
|
@ -151,7 +151,8 @@ typedef struct _disp_t {
|
||||
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top */
|
||||
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys */
|
||||
|
||||
uint8_t del_prev :1; /**< 1: Automatically delete the previous screen when the screen load animation is ready */
|
||||
uint8_t del_prev :
|
||||
1; /**< 1: Automatically delete the previous screen when the screen load animation is ready */
|
||||
|
||||
lv_color_t bg_color; /**< Default display color when screens are transparent*/
|
||||
const void * bg_img; /**< An image source to display as wallpaper*/
|
||||
|
@ -191,7 +191,7 @@ static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
}
|
||||
|
||||
/*apply_xcb is deprecated, use apply_cb instead*/
|
||||
if (th->apply_xcb) {
|
||||
if(th->apply_xcb) {
|
||||
th->apply_xcb(obj, name);
|
||||
}
|
||||
else if(th->apply_cb) {
|
||||
|
@ -81,7 +81,7 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_30));
|
||||
LV_OPA_30));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
||||
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
@ -345,8 +345,8 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
/* This trick is required only to avoid the garbage collection of
|
||||
|
@ -1070,11 +1070,11 @@ static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
|
||||
uint32_t a = month < 3 ? 1 : 0;
|
||||
uint32_t b = year - a;
|
||||
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
|
||||
#else
|
||||
#else
|
||||
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return day_of_week;
|
||||
}
|
||||
|
@ -311,44 +311,44 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
|
||||
if(point_cnt < 1) point_cnt = 1;
|
||||
|
||||
_LV_LL_READ_BACK(ext->series_ll, ser) {
|
||||
if( !ser->ext_buf_assigned ) {
|
||||
if(ser->start_point != 0) {
|
||||
lv_coord_t * new_points = lv_mem_alloc(sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(new_points);
|
||||
if(new_points == NULL) return;
|
||||
if(!ser->ext_buf_assigned) {
|
||||
if(ser->start_point != 0) {
|
||||
lv_coord_t * new_points = lv_mem_alloc(sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(new_points);
|
||||
if(new_points == NULL) return;
|
||||
|
||||
if(point_cnt >= point_cnt_old) {
|
||||
for(i = 0; i < point_cnt_old; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
for(i = point_cnt_old; i < point_cnt; i++) {
|
||||
new_points[i] = def; /*Fill up the rest with default value*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
}
|
||||
if(point_cnt >= point_cnt_old) {
|
||||
for(i = 0; i < point_cnt_old; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
for(i = point_cnt_old; i < point_cnt; i++) {
|
||||
new_points[i] = def; /*Fill up the rest with default value*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < point_cnt; i++) {
|
||||
new_points[i] =
|
||||
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
}
|
||||
|
||||
/*Switch over pointer from old to new*/
|
||||
lv_mem_free(ser->points);
|
||||
ser->points = new_points;
|
||||
}
|
||||
else {
|
||||
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(ser->points);
|
||||
if(ser->points == NULL) return;
|
||||
/*Initialize the new points*/
|
||||
if(point_cnt > point_cnt_old) {
|
||||
for(i = point_cnt_old - 1; i < point_cnt; i++) {
|
||||
ser->points[i] = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Switch over pointer from old to new*/
|
||||
lv_mem_free(ser->points);
|
||||
ser->points = new_points;
|
||||
}
|
||||
else {
|
||||
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
|
||||
LV_ASSERT_MEM(ser->points);
|
||||
if(ser->points == NULL) return;
|
||||
/*Initialize the new points*/
|
||||
if(point_cnt > point_cnt_old) {
|
||||
for(i = point_cnt_old - 1; i < point_cnt; i++) {
|
||||
ser->points[i] = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ser->start_point = 0;
|
||||
}
|
||||
|
||||
@ -552,8 +552,8 @@ void lv_chart_set_secondary_y_tick_texts(lv_obj_t * chart, const char * list_of_
|
||||
/**
|
||||
* Set the index of the x-axis start point in the data array
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
*/
|
||||
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
@ -563,7 +563,7 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext == NULL) return;
|
||||
if( id >= ext->point_cnt ) return;
|
||||
if(id >= ext->point_cnt) return;
|
||||
ser->start_point = id;
|
||||
}
|
||||
|
||||
@ -571,9 +571,9 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
* Set an external array of data points to use for the chart
|
||||
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param point_cnt number of external points in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param point_cnt number of external points in the array
|
||||
*/
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt)
|
||||
{
|
||||
@ -582,7 +582,7 @@ void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_
|
||||
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if( !ser->ext_buf_assigned && ser->points ) lv_mem_free(ser->points);
|
||||
if(!ser->ext_buf_assigned && ser->points) lv_mem_free(ser->points);
|
||||
ser->ext_buf_assigned = true;
|
||||
ser->points = array;
|
||||
ext->point_cnt = point_cnt;
|
||||
@ -591,9 +591,9 @@ void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_
|
||||
/**
|
||||
* Set an individual point y value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
*/
|
||||
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id)
|
||||
{
|
||||
@ -603,7 +603,7 @@ void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t
|
||||
if(chart == NULL || ser == NULL) return;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext == NULL) return;
|
||||
if( id >= ext->point_cnt ) return;
|
||||
if(id >= ext->point_cnt) return;
|
||||
ser->points[id] = value;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char
|
||||
return;
|
||||
}
|
||||
|
||||
if( ser->y_axis == axis) return;
|
||||
if(ser->y_axis == axis) return;
|
||||
|
||||
ser->y_axis = axis;
|
||||
lv_chart_refresh(chart);
|
||||
@ -661,8 +661,8 @@ uint16_t lv_chart_get_point_count(const lv_obj_t * chart)
|
||||
|
||||
/**
|
||||
* Get the current index of the x-axis start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
*/
|
||||
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser)
|
||||
{
|
||||
@ -674,9 +674,9 @@ uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser)
|
||||
/**
|
||||
* Get an individual point y value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
*/
|
||||
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
@ -684,7 +684,7 @@ lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint
|
||||
LV_ASSERT_NULL(ser);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if( id >= ext->point_cnt ) id = 0;
|
||||
if(id >= ext->point_cnt) id = 0;
|
||||
return(ser->points[id]);
|
||||
|
||||
}
|
||||
@ -783,15 +783,15 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_chart_series_t * ser;
|
||||
while( ext->series_ll.head != NULL ) {
|
||||
ser =_lv_ll_get_head(&ext->series_ll);
|
||||
while(ext->series_ll.head != NULL) {
|
||||
ser = _lv_ll_get_head(&ext->series_ll);
|
||||
|
||||
if(!ser->ext_buf_assigned) lv_mem_free(ser->points);
|
||||
if(!ser->ext_buf_assigned) lv_mem_free(ser->points);
|
||||
|
||||
_lv_ll_remove(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
}
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
_lv_ll_remove(&ext->series_ll, ser);
|
||||
lv_mem_free(ser);
|
||||
}
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES);
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES_BG);
|
||||
|
@ -276,8 +276,8 @@ void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
|
||||
/**
|
||||
* Set the index of the x-axis start point in the data array
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the data array
|
||||
*/
|
||||
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
@ -285,17 +285,17 @@ void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint1
|
||||
* Set an external array of data points to use for the chart
|
||||
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param array external array of points for chart
|
||||
*/
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt );
|
||||
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt);
|
||||
|
||||
/**
|
||||
* Set an individual point value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param value value to assign to array point
|
||||
* @param id the index of the x point in the array
|
||||
*/
|
||||
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id);
|
||||
|
||||
@ -327,17 +327,17 @@ uint16_t lv_chart_get_point_count(const lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* get the current index of the x-axis start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @return the index of the current x start point in the data array
|
||||
*/
|
||||
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser);
|
||||
|
||||
/**
|
||||
* Get an individual point value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
* @param ser pointer to a data series on 'chart'
|
||||
* @param id the index of the x point in the array
|
||||
* @return value of array point at index id
|
||||
*/
|
||||
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
|
@ -113,7 +113,7 @@ static inline void lv_checkbox_set_disabled(lv_obj_t * cb)
|
||||
*/
|
||||
static inline void lv_checkbox_set_state(lv_obj_t * cb, lv_btn_state_t state)
|
||||
{
|
||||
lv_btn_set_state(cb, state);
|
||||
lv_btn_set_state(cb, state);
|
||||
}
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@ -153,7 +153,7 @@ static inline bool lv_checkbox_is_inactive(const lv_obj_t * cb)
|
||||
*/
|
||||
static inline lv_btn_state_t lv_checkbox_get_state(const lv_obj_t * cb)
|
||||
{
|
||||
return lv_btn_get_state(cb);
|
||||
return lv_btn_get_state(cb);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -474,12 +474,15 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli
|
||||
|
||||
/*Get the size of the "selected text"*/
|
||||
lv_point_t res_p;
|
||||
_lv_txt_get_size(&res_p, lv_label_get_text(label), label_dsc.font, label_dsc.letter_space, label_dsc.line_space, lv_obj_get_width(roller), LV_TXT_FLAG_EXPAND);
|
||||
_lv_txt_get_size(&res_p, lv_label_get_text(label), label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
|
||||
lv_obj_get_width(roller), LV_TXT_FLAG_EXPAND);
|
||||
|
||||
/*Move the selected label proportionally with the background label*/
|
||||
lv_coord_t roller_h = lv_obj_get_height(roller);
|
||||
int32_t label_y_prop = label->coords.y1 - (roller_h / 2 + roller->coords.y1); /*label offset from the middle line of the roller*/
|
||||
label_y_prop = (label_y_prop << 14) / lv_obj_get_height(label); /*Proportional position from the middle line (upscaled)*/
|
||||
int32_t label_y_prop = label->coords.y1 - (roller_h / 2 +
|
||||
roller->coords.y1); /*label offset from the middle line of the roller*/
|
||||
label_y_prop = (label_y_prop << 14) / lv_obj_get_height(
|
||||
label); /*Proportional position from the middle line (upscaled)*/
|
||||
|
||||
/*Apply a correction with different line heights*/
|
||||
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user