mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
merge dev
This commit is contained in:
commit
c9ad0bf310
40
.github/workflows/build_micropython.yml
vendored
Normal file
40
.github/workflows/build_micropython.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
name: Build Micropython with LVGL submodule
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install SDL
|
||||
run: |
|
||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: Clone lv_micropython
|
||||
run: git clone https://github.com/lvgl/lv_micropython.git .
|
||||
- name: Update submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Checkout lv_bindings
|
||||
working-directory: ./lib/lv_bindings/lvgl
|
||||
run: |
|
||||
git fetch
|
||||
git checkout $GITHUB_SHA
|
||||
- name: Build mpy-cross
|
||||
run: make -j $(nproc) -C mpy-cross
|
||||
- name: Build the unix port
|
||||
run: make -j $(nproc) -C ports/unix
|
||||
- name: Run advanced_demo
|
||||
run: >
|
||||
echo "import gc,utime;
|
||||
utime.sleep(5);
|
||||
gc.collect();
|
||||
utime.sleep(5)" |
|
||||
ports/unix/micropython -i lib/lv_bindings/examples/advanced_demo.py
|
||||
|
2
.github/workflows/ccpp.yml
vendored
2
.github/workflows/ccpp.yml
vendored
@ -14,4 +14,4 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: cd tests; python ./build.py
|
||||
run: sudo apt-get install libpng-dev; cd tests; python ./build.py
|
||||
|
27
CHANGELOG.md
27
CHANGELOG.md
@ -1,14 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## v7.4.0 (planned on 01.09.2020)
|
||||
## v7.6.0 (TBD)
|
||||
|
||||
### New features
|
||||
- Check wheter the any style property has changed on a state change to decide if any redraw is required
|
||||
|
||||
## v7.5.0 (planned at 15.09.2020)
|
||||
|
||||
### New features
|
||||
- Add `clean_dcache_cb` and `lv_disp_clean_dcache` to enable users to use their own cache management function
|
||||
- Add `gpu_wait_cb` to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed.
|
||||
|
||||
### Bugfixes
|
||||
- Fix unexpeted DEFOCUS on lv_page when clicking to bg after the scrollable
|
||||
- Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion.
|
||||
- Adjust button matrix button width to include padding when spanning multiple units.
|
||||
|
||||
## v7.4.0 (01.09.2020)
|
||||
|
||||
The main new features of v7.4 are run-time font loading, style caching and arc knob with value setting by click.
|
||||
|
||||
### New features
|
||||
- arc: add set value by click feature
|
||||
- arc: add `LV_ARC_PART_KNOB` similarly to slider
|
||||
- send gestures even is the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function.
|
||||
- Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file
|
||||
- Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function
|
||||
- Add style caching to reduce acces time of properties with default value
|
||||
- arc: add set value by click feature
|
||||
- arc: add `LV_ARC_PART_KNOB` similarly to slider
|
||||
- send gestures even is the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function.
|
||||
|
||||
### Bugfixes
|
||||
- Fix color bleeding on border drawing
|
||||
@ -17,6 +35,7 @@
|
||||
- Fix zooming and rotateing mosaic images
|
||||
- Fix deleting tabview with LEFT/RIGHT tab position
|
||||
- Fix btnmatrix to not send event when CLICK_TRIG = true and the cursor slid from a pressed button
|
||||
- Fix roller width if selected text is larger than the normal
|
||||
|
||||
## v7.3.1 (18.08.2020)
|
||||
|
||||
|
@ -12,28 +12,31 @@ Planned to September/October 2020
|
||||
- Support "elastic" scrolling when scrolled in
|
||||
- Support scroll chaining among any objects types (not only `lv_pages`s)
|
||||
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
|
||||
- Add snapping?
|
||||
- Add snapping
|
||||
- Add snap stop to scroll max 1 snap point
|
||||
- Already working
|
||||
- New layouts:
|
||||
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
|
||||
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
|
||||
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
|
||||
- [CSS Grid](https://css-tricks.com/snippets/css/a-guide-to-grid/)-like layout support
|
||||
- Work in progress
|
||||
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
||||
- Work in progress
|
||||
- Add new label alignment modes
|
||||
- See [#1656](https://github.com/lvgl/lvgl/issues/1656)
|
||||
- Remove the align parameter from `lv_canvas_draw_text`
|
||||
- RGB888 support [#1722](https://github.com/lvgl/lvgl/issues/1722)
|
||||
|
||||
## v8.1
|
||||
- Add radio button widget
|
||||
|
||||
## v9
|
||||
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
|
||||
|
||||
## Ideas
|
||||
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).7
|
||||
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
||||
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
||||
|
||||
## Ideas
|
||||
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
|
||||
- Optmize font decompression
|
||||
- Switch to RGBA colors in styles
|
||||
- Need coverage report for tests
|
||||
- Need static analize (via coverity.io or somehing else)
|
||||
- Support dot_begin and dot_middle long modes for labels
|
||||
- Add new label alignment modes. [#1656](https://github.com/lvgl/lvgl/issues/1656)
|
||||
|
@ -54,7 +54,9 @@ void lv_port_disp_init(void)
|
||||
* Create a buffer for drawing
|
||||
*----------------------------*/
|
||||
|
||||
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
|
||||
/* LVGL requires a buffer where it internally draws the widgets.
|
||||
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your dispay.
|
||||
* The buffer has to be greater than 1 display row
|
||||
*
|
||||
* There are three buffering configurations:
|
||||
* 1. Create ONE buffer with some rows:
|
||||
@ -73,21 +75,21 @@ void lv_port_disp_init(void)
|
||||
* */
|
||||
|
||||
/* Example for 1) */
|
||||
static lv_disp_buf_t disp_buf_1;
|
||||
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_1;
|
||||
static lv_color_t draw_buf_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_1, draw_buf_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
|
||||
/* Example for 2) */
|
||||
static lv_disp_buf_t disp_buf_2;
|
||||
static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
||||
lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_2;
|
||||
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_2, draw_buf_2_1, draw_buf_2_1, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||
|
||||
/* Example for 3) */
|
||||
static lv_disp_buf_t disp_buf_3;
|
||||
static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
||||
static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
||||
lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||
static lv_disp_buf_t draw_buf_dsc_3;
|
||||
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
||||
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
||||
lv_disp_buf_init(&draw_buf_dsc_3, draw_buf_3_1, draw_buf_3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||
|
||||
|
||||
/*-----------------------------------
|
||||
@ -107,7 +109,7 @@ void lv_port_disp_init(void)
|
||||
disp_drv.flush_cb = disp_flush;
|
||||
|
||||
/*Set a display buffer*/
|
||||
disp_drv.buffer = &disp_buf_2;
|
||||
disp_drv.buffer = &draw_buf_dsc_1;
|
||||
|
||||
#if LV_USE_GPU
|
||||
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "7.3.1",
|
||||
"version": "7.4.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,5 +1,5 @@
|
||||
name=lvgl
|
||||
version=7.3.1
|
||||
version=7.4.0
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v7.6.0-dev-dev
|
||||
* Configuration file for v7.6.0-dev
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -430,11 +430,11 @@ typedef void * lv_font_user_data_t;
|
||||
|
||||
/* No theme, you can apply your styles as you need
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_EMPTY 1
|
||||
#define LV_USE_THEME_EMPTY 1
|
||||
|
||||
/*Simple to the create your theme based on it
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_TEMPLATE 1
|
||||
#define LV_USE_THEME_TEMPLATE 1
|
||||
|
||||
/* A fast and impressive theme.
|
||||
* Flags:
|
||||
@ -443,14 +443,14 @@ typedef void * lv_font_user_data_t;
|
||||
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
|
||||
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
|
||||
* */
|
||||
#define LV_USE_THEME_MATERIAL 1
|
||||
#define LV_USE_THEME_MATERIAL 1
|
||||
|
||||
/* Mono-color theme for monochrome displays.
|
||||
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
|
||||
* texts and borders will be black and the background will be
|
||||
* white. Else the colors are inverted.
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_MONO 1
|
||||
#define LV_USE_THEME_MONO 1
|
||||
|
||||
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
|
||||
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
||||
@ -653,7 +653,7 @@ typedef void * lv_obj_user_data_t;
|
||||
* 1: Some extra precision
|
||||
* 2: Best precision
|
||||
*/
|
||||
# define LV_LINEMETER_PRECISE 0
|
||||
# define LV_LINEMETER_PRECISE 1
|
||||
#endif
|
||||
|
||||
/*Mask (dependencies: -)*/
|
||||
@ -687,9 +687,6 @@ typedef void * lv_obj_user_data_t;
|
||||
# define LV_ROLLER_INF_PAGES 7
|
||||
#endif
|
||||
|
||||
/*Rotary (dependencies: lv_arc, lv_btn)*/
|
||||
#define LV_USE_ROTARY 1
|
||||
|
||||
/*Slider (dependencies: lv_bar)*/
|
||||
#define LV_USE_SLIDER 1
|
||||
|
||||
|
8
lvgl.h
8
lvgl.h
@ -14,9 +14,9 @@ extern "C" {
|
||||
/***************************
|
||||
* CURRENT VERSION OF LVGL
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 4
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 6
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO "dev"
|
||||
|
||||
/*********************
|
||||
@ -82,6 +82,8 @@ extern "C" {
|
||||
|
||||
#include "src/lv_api_map.h"
|
||||
|
||||
//#define LV_BUILD_TEST 1
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
62
r.patch
Normal file
62
r.patch
Normal file
@ -0,0 +1,62 @@
|
||||
diff --git a/scripts/release.py b/scripts/release.py
|
||||
index c06bf529..3a7f27b8 100755
|
||||
--- a/scripts/release.py
|
||||
+++ b/scripts/release.py
|
||||
@@ -59,6 +59,9 @@ proj_list = [ "lv_sim_eclipse_sdl"]
|
||||
ver_major = -1
|
||||
ver_minor = -1
|
||||
ver_patch = -1
|
||||
+dev_ver_major = -1
|
||||
+dev_ver_minor = -1
|
||||
+dev_ver_patch = -1
|
||||
|
||||
ver_str = ""
|
||||
dev_ver_str = ""
|
||||
@@ -309,7 +312,7 @@ def publish_master():
|
||||
#Merge LVGL master to dev first to avoid "merge-to-dev.yml" running asynchronous
|
||||
os.chdir("./lvgl")
|
||||
cmd("git checkout dev")
|
||||
- cmd("git merge master -X theirs")
|
||||
+ cmd("git merge master -X ours") # Use ours to keep the version numbers
|
||||
cmd("git add .")
|
||||
cmd("git commit -am 'Merge master'", False)
|
||||
cmd("git push origin dev")
|
||||
@@ -473,6 +476,11 @@ if __name__ == '__main__':
|
||||
exit(1)
|
||||
|
||||
clone_repos()
|
||||
+ get_lvgl_version("dev")
|
||||
+ dev_ver_major = ver_major
|
||||
+ dev_ver_minor = ver_minor
|
||||
+ dev_ver_patch = ver_patch
|
||||
+
|
||||
get_lvgl_version("master")
|
||||
lvgl_prepare()
|
||||
lv_examples_prepare()
|
||||
@@ -483,16 +491,17 @@ if __name__ == '__main__':
|
||||
update_release_branches()
|
||||
publish_master()
|
||||
|
||||
+ projs_update()
|
||||
+
|
||||
if dev_prepare == 'bugfix':
|
||||
ver_patch = str(int(ver_patch) + 1)
|
||||
- ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
|
||||
+ ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev"
|
||||
|
||||
print("Prepare bugfix version " + ver_str)
|
||||
|
||||
lvgl_update_master_version()
|
||||
docs_update_latest_version()
|
||||
|
||||
- get_lvgl_version("dev")
|
||||
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
|
||||
merge_to_dev()
|
||||
|
||||
@@ -520,6 +529,5 @@ if __name__ == '__main__':
|
||||
docs_update_dev_version()
|
||||
publish_dev_and_master()
|
||||
|
||||
- projs_update()
|
||||
cleanup()
|
||||
|
@ -29,16 +29,19 @@ fout.write(
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(LV_CONF_PATH)
|
||||
#define __LV_TO_STR_AUX(x) #x
|
||||
#define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
|
||||
#include __LV_TO_STR(LV_CONF_PATH)
|
||||
#undef __LV_TO_STR_AUX
|
||||
#undef __LV_TO_STR
|
||||
#elif defined(LV_CONF_INCLUDE_SIMPLE)
|
||||
#include "lv_conf.h"
|
||||
#else
|
||||
#include "../../lv_conf.h"
|
||||
/*If lv_conf.h is not skipped include it*/
|
||||
#if !defined(LV_CONF_SKIP) && !defined(CONFIG_LV_CONF_SKIP)
|
||||
# if defined(LV_CONF_PATH) /*If there is a path defined for lv_conf.h use it*/
|
||||
# define __LV_TO_STR_AUX(x) #x
|
||||
# define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
|
||||
# include __LV_TO_STR(LV_CONF_PATH)
|
||||
# undef __LV_TO_STR_AUX
|
||||
# undef __LV_TO_STR
|
||||
# elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/
|
||||
# include "lv_conf.h"
|
||||
# else
|
||||
# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
'''
|
||||
@ -58,12 +61,28 @@ for i in fin.read().splitlines():
|
||||
|
||||
r = re.search(r'^ *# *define ([^\s]+).*$', i)
|
||||
|
||||
#ifndef LV_USE_BTN /*Only if not defined in lv_conf.h*/
|
||||
# ifdef CONFIG_LV_USE_BTN /*Use KConfig value if set*/
|
||||
# define LV_USE_BTN CONFIG_LV_USE_BTN
|
||||
# else
|
||||
# define LV_USE_BTN 1 /*Use default value*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if r:
|
||||
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
|
||||
|
||||
dr = re.sub('.*# *define', '', i, 1)
|
||||
d = "# define " + dr
|
||||
|
||||
fout.write(
|
||||
f'#ifndef {line}\n'
|
||||
f'{i}\n'
|
||||
'#endif\n'
|
||||
f'# ifdef CONFIG_{line}\n'
|
||||
f'# define {line} CONFIG_{line}\n'
|
||||
f'# else\n'
|
||||
f'{d}\n'
|
||||
f'# endif\n'
|
||||
f'#endif\n'
|
||||
)
|
||||
elif re.search('^ *typedef .*;.*$', i):
|
||||
continue #ignore typedefs to avoide redeclaration
|
||||
@ -73,7 +92,40 @@ for i in fin.read().splitlines():
|
||||
|
||||
fout.write(
|
||||
'''
|
||||
#endif /*LV_CONF_CHECKER_H*/
|
||||
|
||||
/*If running without lv_conf.h add typdesf with default value*/
|
||||
#if !defined(LV_CONF_SKIP) && !defined(CONFIG_LV_CONF_SKIP)
|
||||
|
||||
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
|
||||
typedef int16_t lv_coord_t;
|
||||
|
||||
# if LV_USE_ANIMATION
|
||||
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
|
||||
typedef void * lv_anim_user_data_t;
|
||||
# endif
|
||||
|
||||
# if LV_USE_GROUP
|
||||
typedef void * lv_group_user_data_t;
|
||||
# endif
|
||||
|
||||
# if LV_USE_FILESYSTEM
|
||||
typedef void * lv_fs_drv_user_data_t;
|
||||
# endif
|
||||
|
||||
typedef void * lv_img_decoder_user_data_t;
|
||||
|
||||
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
|
||||
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
|
||||
|
||||
typedef void * lv_font_user_data_t;
|
||||
|
||||
# if LV_USE_USER_DATA
|
||||
typedef void * lv_obj_user_data_t;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*LV_CONF_INTERNAL_H*/
|
||||
'''
|
||||
)
|
||||
|
||||
|
@ -54,6 +54,7 @@ import sys
|
||||
|
||||
upstream_org_url = "https://github.com/lvgl/"
|
||||
workdir = "./release_tmp"
|
||||
proj_list = [ "lv_sim_eclipse_sdl"]
|
||||
|
||||
ver_major = -1
|
||||
ver_minor = -1
|
||||
@ -81,11 +82,12 @@ def cmd(c, exit_on_err = True):
|
||||
def define_set(fn, name, value):
|
||||
print("In " + fn + " set " + name + " to " + value)
|
||||
|
||||
new_content = ""
|
||||
new_content = ""
|
||||
s = r'^ *# *define +' + str(name).rstrip()
|
||||
|
||||
f = open(fn, "r")
|
||||
|
||||
for i in f.read().splitlines():
|
||||
r = re.search(r'^ *# *define +' + name, i)
|
||||
r = re.search(s, i)
|
||||
if r:
|
||||
d = i.split("define")
|
||||
i = d[0] + "define " + name + " " + value
|
||||
@ -106,12 +108,16 @@ def clone_repos():
|
||||
#cmd("cp -a ../repos/. .")
|
||||
#return
|
||||
|
||||
cmd("git clone " + upstream("lvgl") + " lvgl; cd lvgl; git checkout master")
|
||||
cmd("git clone " + upstream("lvgl") + "; cd lvgl; git checkout master")
|
||||
cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master")
|
||||
cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master")
|
||||
cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master")
|
||||
cmd("git clone " + upstream("blog") + "; cd blog; git checkout master")
|
||||
|
||||
for p in proj_list:
|
||||
cmd("git clone " + upstream(p) + " --recurse-submodules ; cd " + p + "; git checkout master")
|
||||
|
||||
|
||||
def get_lvgl_version(br):
|
||||
print("Get LVGL's version")
|
||||
|
||||
@ -299,14 +305,25 @@ def update_release_branches():
|
||||
cmd("cd docs; " + merge_cmd)
|
||||
|
||||
def publish_master():
|
||||
|
||||
#Merge LVGL master to dev first to avoid "merge-to-dev.yml" running asynchronous
|
||||
os.chdir("./lvgl")
|
||||
cmd("git checkout dev")
|
||||
cmd("git merge master -X theirs")
|
||||
cmd("git add .")
|
||||
cmd("git commit -am 'Merge master'", False)
|
||||
cmd("git push origin dev")
|
||||
cmd("git checkout master")
|
||||
os.chdir("../")
|
||||
|
||||
pub_cmd = "git push origin master; git push origin " + ver_str
|
||||
cmd("cd lvgl; " + pub_cmd)
|
||||
cmd("cd lv_examples; " + pub_cmd)
|
||||
cmd("cd lv_drivers; " + pub_cmd)
|
||||
|
||||
pub_cmd = "git push origin latest; git push origin " + ver_str
|
||||
cmd("cd docs; " + pub_cmd)
|
||||
cmd("cd docs; git checkout master; ./update.py " + release_br)
|
||||
cmd("cd docs; " + pub_cmd)
|
||||
cmd("cd docs; git checkout master; python 2.7 ./update.py " + release_br)
|
||||
|
||||
pub_cmd = "git push origin master"
|
||||
cmd("cd blog; " + pub_cmd)
|
||||
@ -342,7 +359,7 @@ def lvgl_update_master_version():
|
||||
templ = fnmatch.filter(os.listdir('.'), '*templ*')
|
||||
if templ[0]:
|
||||
print("Updating version in " + templ[0])
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0])
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ ver_str +"/' " + templ[0])
|
||||
|
||||
|
||||
cmd("git commit -am 'Update version'")
|
||||
@ -367,15 +384,15 @@ def lvgl_update_dev_version():
|
||||
os.chdir("./lvgl")
|
||||
|
||||
cmd("git checkout dev")
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
|
||||
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver_major))
|
||||
define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver_minor))
|
||||
define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver_patch))
|
||||
define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"")
|
||||
|
||||
templ = fnmatch.filter(os.listdir('.'), '*templ*')
|
||||
if templ[0]:
|
||||
print("Updating version in " + templ[0])
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ dev_ver_str +"/' " + templ[0])
|
||||
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ dev_ver_str +"/' " + templ[0])
|
||||
|
||||
|
||||
cmd("git commit -am 'Update dev version'")
|
||||
@ -401,22 +418,60 @@ def publish_dev_and_master():
|
||||
pub_cmd = "git checkout master; git push origin master"
|
||||
cmd("cd lvgl; " + pub_cmd)
|
||||
|
||||
cmd("cd docs; git checkout master; ./update.py latest dev")
|
||||
cmd("cd docs; git checkout master; python 2.7 ./update.py latest dev")
|
||||
|
||||
def projs_update():
|
||||
global proj_list, release_br, ver_str
|
||||
for p in proj_list:
|
||||
os.chdir("./" + p)
|
||||
cmd('git checkout master')
|
||||
print(p + ": upadte lvgl");
|
||||
cmd("cd lvgl; git co " + release_br + "; git pull origin " + release_br)
|
||||
cmd("cp -f lvgl/lv_conf_template.h lv_conf.h")
|
||||
cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h
|
||||
d = {}
|
||||
with open("confdef.txt") as f:
|
||||
for line in f:
|
||||
(key, val) = line.rstrip().split('\t')
|
||||
d[key] = val
|
||||
|
||||
for k,v in d.items():
|
||||
define_set("lv_conf.h", str(k), str(v))
|
||||
|
||||
if os.path.exists("lv_examples"):
|
||||
print(p + ": upadte lv_examples");
|
||||
cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br)
|
||||
|
||||
if os.path.exists("lv_drivers"):
|
||||
print(p + ": upadte lv_drivers");
|
||||
cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br)
|
||||
|
||||
msg = 'Update to ' + ver_str
|
||||
cmd("git add .")
|
||||
cmd('git commit -am "' + msg + '"')
|
||||
cmd('git push origin master')
|
||||
cmd("git tag -a " + ver_str + " -m '" + msg + "' " )
|
||||
cmd('git push origin ' + ver_str)
|
||||
|
||||
os.chdir("../")
|
||||
|
||||
|
||||
def cleanup():
|
||||
os.chdir("../")
|
||||
cmd("rm -fr " + workdir)
|
||||
|
||||
if __name__ == '__main__':
|
||||
dev_prepare = 'minor'
|
||||
if(len(sys.argv) != 2):
|
||||
print("Argument error. Usage ./release.py bugfix | minor | major")
|
||||
exit(1)
|
||||
|
||||
dev_prepare = sys.argv[1]
|
||||
print("Missing argument. Usage ./release.py bugfix | minor | major")
|
||||
print("Use minor by deafult")
|
||||
else:
|
||||
dev_prepare = sys.argv[1]
|
||||
|
||||
if not (dev_prepare in prepare_type):
|
||||
print("Invalid argument. Usage ./release.py bugfix | minor | major")
|
||||
exit(1)
|
||||
|
||||
|
||||
clone_repos()
|
||||
get_lvgl_version("master")
|
||||
lvgl_prepare()
|
||||
@ -454,9 +509,9 @@ if __name__ == '__main__':
|
||||
ver_minor = "0"
|
||||
ver_patch = "0"
|
||||
|
||||
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
|
||||
dev_ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev"
|
||||
|
||||
print("Prepare minor version " + ver_str)
|
||||
print("Prepare minor version " + dev_ver_str)
|
||||
|
||||
merge_to_dev()
|
||||
merge_from_dev()
|
||||
@ -465,5 +520,6 @@ if __name__ == '__main__':
|
||||
docs_update_dev_version()
|
||||
publish_dev_and_master()
|
||||
|
||||
projs_update()
|
||||
cleanup()
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -352,6 +352,21 @@ void lv_disp_trig_activity(lv_disp_t * disp)
|
||||
disp->last_activity_time = lv_tick_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean any CPU cache that is related to the display.
|
||||
* @param disp pointer to an display (NULL to use the default display)
|
||||
*/
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("lv_disp_clean_dcache: no display registered");
|
||||
return;
|
||||
}
|
||||
|
||||
if(disp->driver.clean_dcache_cb)
|
||||
disp->driver.clean_dcache_cb(&disp->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
|
@ -133,6 +133,12 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
|
||||
*/
|
||||
void lv_disp_trig_activity(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Clean any CPU cache that is related to the display.
|
||||
* @param disp pointer to an display (NULL to use the default display)
|
||||
*/
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
|
@ -328,9 +328,9 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
|
||||
focused->signal_cb(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
|
||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
|
||||
lv_obj_invalidate(focused);
|
||||
lv_obj_invalidate(focused);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1111,9 +1111,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
}
|
||||
@ -1152,9 +1152,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
else {
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ typedef struct _lv_event_temp_data {
|
||||
struct _lv_event_temp_data * prev;
|
||||
} lv_event_temp_data_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
@ -418,13 +417,9 @@ void lv_obj_clean(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
lv_obj_t * child_next;
|
||||
while(child) {
|
||||
/* Read the next child before deleting the current
|
||||
* because the next couldn't be read from a deleted (invalid) node*/
|
||||
child_next = lv_obj_get_child(obj, child);
|
||||
lv_obj_del(child);
|
||||
child = child_next;
|
||||
child = lv_obj_get_child(obj, NULL); /*Get the new first child*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,6 +722,8 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f)
|
||||
obj->flags &= (~f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the state (fully overwrite) of an object.
|
||||
* If specified in the styles a transition animation will be started
|
||||
@ -745,10 +742,16 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
_lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
#else
|
||||
lv_state_t prev_state = obj->state;
|
||||
|
||||
_lv_style_state_cmp_t cmp_res = _lv_obj_style_state_compare(obj, prev_state, new_state);
|
||||
|
||||
obj->state = new_state;
|
||||
|
||||
/*If there is no difference in styles there is nothing else to do*/
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return;
|
||||
|
||||
uint8_t part;
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) {
|
||||
lv_style_list_t * style_list = _lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
if(style_list->ignore_trans) continue;
|
||||
@ -773,8 +776,12 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
|
||||
}
|
||||
}
|
||||
_lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF) _lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_VISUAL_DIFF) lv_obj_invalidate(obj);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -946,6 +953,7 @@ lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t
|
||||
|
||||
if(obj) {
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) {
|
||||
|
||||
lv_res_t res = lv_event_send(obj->parent, event, data);
|
||||
if(res != LV_RES_OK) {
|
||||
return LV_RES_INV;
|
||||
@ -1587,17 +1595,13 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
|
||||
/*Recursively delete the children*/
|
||||
lv_obj_t * i;
|
||||
lv_obj_t * i_next;
|
||||
i = _lv_ll_get_head(&(obj->child_ll));
|
||||
while(i != NULL) {
|
||||
/*Get the next object before delete this*/
|
||||
i_next = _lv_ll_get_next(&(obj->child_ll), i);
|
||||
|
||||
/*Call the recursive del to the child too*/
|
||||
/*Call the recursive delete to the child too*/
|
||||
obj_del_core(i);
|
||||
|
||||
/*Set i to the next node*/
|
||||
i = i_next;
|
||||
/*Set i to the new head node*/
|
||||
i = _lv_ll_get_head(&(obj->child_ll));
|
||||
}
|
||||
|
||||
lv_event_mark_deleted(obj);
|
||||
|
@ -42,6 +42,38 @@ typedef struct {
|
||||
} end_value;
|
||||
} lv_style_trans_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
lv_draw_rect_dsc_t rect;
|
||||
lv_draw_label_dsc_t label;
|
||||
lv_draw_line_dsc_t line;
|
||||
lv_draw_img_dsc_t img;
|
||||
lv_style_int_t pad_top;
|
||||
lv_style_int_t pad_bottom;
|
||||
lv_style_int_t pad_right;
|
||||
lv_style_int_t pad_left;
|
||||
lv_style_int_t pad_inner;
|
||||
lv_style_int_t margin_top;
|
||||
lv_style_int_t margin_bottom;
|
||||
lv_style_int_t margin_left;
|
||||
lv_style_int_t margin_right;
|
||||
lv_style_int_t size;
|
||||
lv_style_int_t transform_width;
|
||||
lv_style_int_t transform_height;
|
||||
lv_style_int_t transform_angle;
|
||||
lv_style_int_t transform_zoom;
|
||||
lv_style_int_t scale_width;
|
||||
lv_style_int_t scale_border_width;
|
||||
lv_style_int_t scale_end_border_width;
|
||||
lv_style_int_t scale_end_line_width;
|
||||
lv_color_t scale_grad_color;
|
||||
lv_color_t scale_end_color;
|
||||
lv_opa_t opa_scale;
|
||||
uint32_t clip_corder :1;
|
||||
uint32_t border_post :1;
|
||||
}style_snapshot_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
@ -52,6 +84,8 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv
|
||||
static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v);
|
||||
static void trans_anim_start_cb(lv_anim_t * a);
|
||||
static void trans_anim_ready_cb(lv_anim_t * a);
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot);
|
||||
static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2);
|
||||
#endif
|
||||
|
||||
#if LV_STYLE_CACHE_LEVEL >= 1
|
||||
@ -981,6 +1015,37 @@ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, u
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compare the style properties of an object in 2 different states
|
||||
* @param obj pointer to an object
|
||||
* @param state1 a state
|
||||
* @param state2 an other state
|
||||
* @return an element of `_lv_style_state_cmp_t`
|
||||
*/
|
||||
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
|
||||
{
|
||||
_lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
|
||||
uint8_t part;
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) {
|
||||
lv_style_list_t * style_list = _lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
|
||||
style_snapshot_t shot1;
|
||||
style_snapshot_t shot2;
|
||||
|
||||
obj->state = state1;
|
||||
style_snapshot(obj, part, &shot1);
|
||||
|
||||
obj->state = state2;
|
||||
style_snapshot(obj, part, &shot2);
|
||||
|
||||
_lv_style_state_cmp_t res_part = style_snapshot_compare(&shot1, &shot2);
|
||||
if(res_part == _LV_STYLE_STATE_CMP_DIFF) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(res_part == _LV_STYLE_STATE_CMP_VISUAL_DIFF) res = _LV_STYLE_STATE_CMP_VISUAL_DIFF;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@ -1159,6 +1224,81 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
lv_mem_free(tr);
|
||||
}
|
||||
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot)
|
||||
{
|
||||
_lv_obj_disable_style_caching(obj, true);
|
||||
_lv_memset_00(shot, sizeof(style_snapshot_t));
|
||||
lv_draw_rect_dsc_init(&shot->rect);
|
||||
lv_draw_label_dsc_init(&shot->label);
|
||||
lv_draw_img_dsc_init(&shot->img);
|
||||
lv_draw_line_dsc_init(&shot->line);
|
||||
|
||||
lv_obj_init_draw_rect_dsc(obj, part, &shot->rect);
|
||||
lv_obj_init_draw_label_dsc(obj, part, &shot->label);
|
||||
lv_obj_init_draw_img_dsc(obj, part, &shot->img);
|
||||
lv_obj_init_draw_line_dsc(obj, part, &shot->line);
|
||||
|
||||
|
||||
shot->pad_top = lv_obj_get_style_pad_top(obj, part);
|
||||
shot->pad_bottom = lv_obj_get_style_pad_bottom(obj, part);
|
||||
shot->pad_right = lv_obj_get_style_pad_right(obj, part);
|
||||
shot->pad_left = lv_obj_get_style_pad_left(obj, part);
|
||||
shot->pad_inner = lv_obj_get_style_pad_inner(obj, part);
|
||||
shot->margin_top = lv_obj_get_style_margin_top(obj, part);
|
||||
shot->margin_bottom = lv_obj_get_style_margin_bottom(obj, part);
|
||||
shot->margin_left = lv_obj_get_style_margin_left(obj, part);
|
||||
shot->margin_right = lv_obj_get_style_margin_right(obj, part);
|
||||
shot->size = lv_obj_get_style_size(obj, part);
|
||||
shot->transform_width = lv_obj_get_style_transform_width(obj, part);
|
||||
shot->transform_height = lv_obj_get_style_transform_height(obj, part);
|
||||
shot->transform_angle = lv_obj_get_style_transform_angle(obj, part);
|
||||
shot->transform_zoom = lv_obj_get_style_transform_zoom(obj, part);
|
||||
shot->scale_width = lv_obj_get_style_scale_width(obj, part);
|
||||
shot->scale_border_width = lv_obj_get_style_scale_border_width(obj, part);
|
||||
shot->scale_end_border_width = lv_obj_get_style_scale_end_border_width(obj, part);
|
||||
shot->scale_end_line_width = lv_obj_get_style_scale_end_line_width(obj, part);
|
||||
shot->scale_grad_color = lv_obj_get_style_scale_grad_color(obj, part);
|
||||
shot->scale_end_color = lv_obj_get_style_scale_end_color(obj, part);
|
||||
shot->opa_scale = lv_obj_get_style_opa_scale(obj, part);
|
||||
shot->clip_corder = lv_obj_get_style_clip_corner(obj, part);
|
||||
shot->border_post = lv_obj_get_style_border_post(obj, part);
|
||||
|
||||
_lv_obj_disable_style_caching(obj, false);
|
||||
}
|
||||
|
||||
static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2)
|
||||
{
|
||||
if(memcmp(shot1, shot2, sizeof(style_snapshot_t)) == 0) return _LV_STYLE_STATE_CMP_SAME;
|
||||
|
||||
|
||||
if(shot1->pad_top != shot2->pad_top) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->pad_bottom != shot2->pad_bottom) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->pad_left != shot2->pad_right) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->pad_right != shot2->pad_right) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->pad_top != shot2->pad_top) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->pad_inner != shot2->pad_inner) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->margin_top != shot2->margin_top) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->margin_bottom != shot2->margin_bottom) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->margin_left != shot2->margin_right) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->margin_right != shot2->margin_right) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->margin_top != shot2->margin_top) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->transform_width != shot2->transform_width) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->transform_height != shot2->transform_height) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->transform_angle != shot2->transform_angle) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->transform_zoom != shot2->transform_zoom) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.outline_width != shot2->rect.outline_width) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.outline_pad != shot2->rect.outline_pad) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.value_font != shot2->rect.value_font) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.value_align != shot2->rect.value_align) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.value_font != shot2->rect.value_font) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.shadow_spread != shot2->rect.shadow_spread) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.shadow_width != shot2->rect.shadow_width) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.shadow_ofs_x != shot2->rect.shadow_ofs_x) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
if(shot1->rect.shadow_ofs_y != shot2->rect.shadow_ofs_y) return _LV_STYLE_STATE_CMP_DIFF;
|
||||
|
||||
/*If not returned earlier its just a visual difference, a simple redraw is enough*/
|
||||
return _LV_STYLE_STATE_CMP_VISUAL_DIFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_STYLE_CACHE_LEVEL >= 1
|
||||
@ -1218,7 +1358,9 @@ static bool style_prop_is_cacheable(lv_style_property_t prop)
|
||||
*/
|
||||
static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop)
|
||||
{
|
||||
printf("update cache\n");
|
||||
static uint32_t cnt = 0;
|
||||
cnt++;
|
||||
printf("update cache: %d\n", cnt);
|
||||
|
||||
if(style_prop_is_cacheable(prop) == false) return;
|
||||
|
||||
|
@ -26,7 +26,12 @@ extern "C" {
|
||||
**********************/
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
struct _lv_obj_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
_LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
|
||||
_LV_STYLE_STATE_CMP_VISUAL_DIFF, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF, /*There are larger differences, the objects need to ne notfied*/
|
||||
} _lv_style_state_cmp_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -292,6 +297,16 @@ void _lv_obj_remove_style_trans(lv_obj_t * obj);
|
||||
*/
|
||||
void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state, uint32_t time, uint32_t delay, lv_anim_path_t * path);
|
||||
|
||||
/**
|
||||
* Compare the style properties of an object in 2 different states
|
||||
* @param obj pointer to an object
|
||||
* @param state1 a state
|
||||
* @param state2 an other state
|
||||
* @return an element of `_lv_style_state_cmp_t`
|
||||
*/
|
||||
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -571,11 +571,16 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && (obj->flags & LV_OBJ_FLAG_HIDDEN) == 0) {
|
||||
lv_design_res_t design_res = obj->design_cb ? obj->design_cb(obj, area_p,
|
||||
LV_DESIGN_COVER_CHK) : LV_DESIGN_RES_NOT_COVER;
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) == false) {
|
||||
lv_design_res_t design_res = obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK);
|
||||
if(design_res == LV_DESIGN_RES_MASKED) return NULL;
|
||||
|
||||
#if LV_USE_OPA_SCALE
|
||||
if(design_res == LV_DESIGN_RES_COVER && lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN) != LV_OPA_COVER) {
|
||||
design_res = LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
#endif
|
||||
|
||||
lv_obj_t * i;
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
found_p = lv_refr_get_top_obj(area_p, i);
|
||||
@ -741,6 +746,8 @@ static void lv_refr_vdb_flush(void)
|
||||
|
||||
/*Flush the rendered content to the display*/
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||
|
||||
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
|
||||
|
||||
if(vdb->buf1 && vdb->buf2) {
|
||||
|
@ -138,7 +138,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
|
||||
|
||||
if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
@ -212,6 +213,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
|
||||
if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
|
@ -7,6 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_gpu_stm32_dma2d.h"
|
||||
#include "../lv_core/lv_disp.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
@ -216,11 +217,10 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
||||
|
||||
static void invalidate_cache(void)
|
||||
{
|
||||
#if __DCACHE_PRESENT
|
||||
if(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) {
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver.clean_dcache_cb) disp->driver.clean_dcache_cb(&disp->driver);
|
||||
else
|
||||
SCB_CleanInvalidateDCache();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dma2d_wait(void)
|
||||
|
@ -111,7 +111,14 @@ typedef struct _disp_drv_t {
|
||||
* User can execute very simple tasks here or yield the task */
|
||||
void (*wait_cb)(struct _disp_drv_t * disp_drv);
|
||||
|
||||
/** OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned */
|
||||
void (*clean_dcache_cb)(struct _disp_drv_t * disp_drv);
|
||||
|
||||
/** OPTIONAL: called to wait while the gpu is working */
|
||||
void (*gpu_wait_cb)(struct _disp_drv_t * disp_drv);
|
||||
|
||||
#if LV_USE_GPU
|
||||
|
||||
/** OPTIONAL: Blend two memories using opacity (GPU only)*/
|
||||
void (*gpu_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length,
|
||||
lv_opa_t opa);
|
||||
|
@ -436,6 +436,8 @@ void _lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||
{
|
||||
size_t old_len = strlen(txt_buf);
|
||||
size_t ins_len = strlen(ins_txt);
|
||||
if(ins_len == 0) return;
|
||||
|
||||
size_t new_len = ins_len + old_len;
|
||||
pos = _lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/
|
||||
|
||||
|
@ -109,9 +109,6 @@ typedef enum {
|
||||
#if LV_USE_ROLLER
|
||||
LV_THEME_ROLLER,
|
||||
#endif
|
||||
#if LV_USE_ROTARY
|
||||
LV_THEME_ROTARY,
|
||||
#endif
|
||||
#if LV_USE_SLIDER
|
||||
LV_THEME_SLIDER,
|
||||
#endif
|
||||
|
@ -34,6 +34,7 @@ static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
|
||||
static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_arc_part_t part);
|
||||
static void get_center(lv_obj_t * arc, lv_point_t * center, lv_coord_t * arc_r);
|
||||
static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area);
|
||||
static void value_update(lv_obj_t * arc);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -87,6 +88,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->min_value = 0;
|
||||
ext->max_value = 100;
|
||||
ext->dragging = false;
|
||||
ext->adjustable = false;
|
||||
ext->chg_rate = 540;
|
||||
ext->last_tick = lv_tick_get();
|
||||
ext->last_angle = ext->arc_angle_end;
|
||||
@ -119,6 +121,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->min_value = copy_ext->min_value;
|
||||
ext->max_value = copy_ext->max_value;
|
||||
ext->dragging = copy_ext->dragging;
|
||||
ext->adjustable = copy_ext->adjustable;
|
||||
ext->chg_rate = copy_ext->chg_rate;
|
||||
ext->last_tick = copy_ext->last_tick;
|
||||
ext->last_angle = copy_ext->last_angle;
|
||||
@ -397,35 +400,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
if(ext->cur_value == new_value) return;
|
||||
ext->cur_value = new_value;
|
||||
|
||||
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
||||
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
|
||||
int16_t angle;
|
||||
switch(ext->type) {
|
||||
case LV_ARC_TYPE_SYMMETRIC:
|
||||
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
||||
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||
|
||||
if(ext->cur_value < range_midpoint) {
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
lv_arc_set_end_angle(arc, bg_midpoint);
|
||||
}
|
||||
else {
|
||||
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
||||
lv_arc_set_start_angle(arc, bg_midpoint);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
}
|
||||
break;
|
||||
case LV_ARC_TYPE_REVERSE:
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
break;
|
||||
default: /** LV_ARC_TYPE_NORMAL*/
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
}
|
||||
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
|
||||
value_update(arc);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -451,7 +426,7 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max)
|
||||
ext->cur_value = max;
|
||||
}
|
||||
|
||||
lv_arc_set_value(arc, ext->cur_value);
|
||||
value_update(arc); /* value has changed relative to the new range */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -468,6 +443,24 @@ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t rate)
|
||||
ext->chg_rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the arc is adjustable.
|
||||
* @param arc pointer to a arc object
|
||||
* @param adjustable whether the arc has a knob that can be dragged
|
||||
*/
|
||||
void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
if(ext->adjustable == adjustable)
|
||||
return;
|
||||
|
||||
ext->adjustable = adjustable;
|
||||
if(!adjustable)
|
||||
ext->dragging = false;
|
||||
lv_obj_invalidate(arc);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@ -595,6 +588,19 @@ lv_arc_type_t lv_arc_get_type(const lv_obj_t * arc)
|
||||
return ext->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the arc is adjustable.
|
||||
* @param arc pointer to a arc object
|
||||
* @return whether the arc has a knob that can be dragged
|
||||
*/
|
||||
bool lv_arc_get_adjustable(lv_obj_t * arc)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
return ext->adjustable;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
@ -665,14 +671,16 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
&arc_dsc);
|
||||
}
|
||||
|
||||
lv_area_t knob_area;
|
||||
get_knob_area(arc, ¢er, arc_r, &knob_area);
|
||||
if(ext->adjustable) {
|
||||
lv_area_t knob_area;
|
||||
get_knob_area(arc, ¢er, arc_r, &knob_area);
|
||||
|
||||
lv_draw_rect_dsc_t knob_rect_dsc;
|
||||
lv_draw_rect_dsc_init(&knob_rect_dsc);
|
||||
lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc);
|
||||
lv_draw_rect_dsc_t knob_rect_dsc;
|
||||
lv_draw_rect_dsc_init(&knob_rect_dsc);
|
||||
lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc);
|
||||
|
||||
lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc);
|
||||
lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc);
|
||||
}
|
||||
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
@ -708,6 +716,9 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
if(sign == LV_SIGNAL_PRESSING) {
|
||||
/* Only adjustable arcs can be dragged */
|
||||
if(!ext->adjustable) return res;
|
||||
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
if(indev == NULL) return res;
|
||||
|
||||
@ -803,6 +814,8 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
if(!ext->adjustable) return res;
|
||||
|
||||
char c = *((char *)param);
|
||||
|
||||
int16_t old_value = ext->cur_value;
|
||||
@ -1034,4 +1047,43 @@ static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t
|
||||
knob_area->y2 = center->y + knob_y + bottom_knob + indic_width_half;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally to update arc angles after a value change
|
||||
* @param arc pointer to a arc object
|
||||
*/
|
||||
static void value_update(lv_obj_t * arc)
|
||||
{
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
|
||||
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
||||
if (ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
|
||||
int16_t angle;
|
||||
switch(ext->type) {
|
||||
case LV_ARC_TYPE_SYMMETRIC:
|
||||
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
||||
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||
|
||||
if (ext->cur_value < range_midpoint) {
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
lv_arc_set_end_angle(arc, bg_midpoint);
|
||||
} else {
|
||||
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
||||
lv_arc_set_start_angle(arc, bg_midpoint);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
}
|
||||
break;
|
||||
case LV_ARC_TYPE_REVERSE:
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
break;
|
||||
default: /** LV_ARC_TYPE_NORMAL*/
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
lv_arc_set_start_angle(arc, ext->bg_angle_start);
|
||||
}
|
||||
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -48,8 +48,9 @@ typedef struct {
|
||||
int16_t cur_value; /*Current value of the arc*/
|
||||
int16_t min_value; /*Minimum value of the arc*/
|
||||
int16_t max_value; /*Maximum value of the arc*/
|
||||
uint16_t dragging : 1;
|
||||
uint16_t type : 2;
|
||||
uint16_t dragging :1;
|
||||
uint16_t type :2;
|
||||
uint16_t adjustable :1;
|
||||
uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/
|
||||
uint32_t last_tick; /*Last dragging event timestamp of the arc*/
|
||||
int16_t last_angle; /*Last dragging angle of the arc*/
|
||||
@ -167,6 +168,13 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max);
|
||||
*/
|
||||
void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold);
|
||||
|
||||
/**
|
||||
* Set whether the arc is adjustable.
|
||||
* @param arc pointer to a arc object
|
||||
* @param adjustable whether the arc has a knob that can be dragged
|
||||
*/
|
||||
void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@ -234,6 +242,13 @@ int16_t lv_arc_get_max_value(const lv_obj_t * arc);
|
||||
*/
|
||||
bool lv_arc_is_dragged(const lv_obj_t * arc);
|
||||
|
||||
/**
|
||||
* Get whether the arc is adjustable.
|
||||
* @param arc pointer to a arc object
|
||||
* @return whether the arc has a knob that can be dragged
|
||||
*/
|
||||
bool lv_arc_get_adjustable(lv_obj_t * arc);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
@ -208,7 +208,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
/*Only deal with the non empty lines*/
|
||||
if(btn_cnt != 0) {
|
||||
/*Calculate the width of all units*/
|
||||
lv_coord_t all_unit_w = max_w - ((btn_cnt - 1) * inner);
|
||||
lv_coord_t all_unit_w = max_w - ((unit_cnt - 1) * inner);
|
||||
|
||||
/*Set the button size and positions and set the texts*/
|
||||
uint16_t i;
|
||||
@ -216,19 +216,20 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
|
||||
unit_act_cnt = 0;
|
||||
for(i = 0; i < btn_cnt; i++) {
|
||||
uint8_t btn_unit_w = get_button_width(ext->ctrl_bits[btn_i]);
|
||||
/* one_unit_w = all_unit_w / unit_cnt
|
||||
* act_unit_w = one_unit_w * button_width
|
||||
* do this two operations but the multiply first to divide a greater number */
|
||||
lv_coord_t act_unit_w = (all_unit_w * get_button_width(ext->ctrl_bits[btn_i])) / unit_cnt;
|
||||
lv_coord_t act_unit_w = (all_unit_w * btn_unit_w) / unit_cnt + inner * (btn_unit_w - 1);
|
||||
act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/
|
||||
|
||||
/*Always recalculate act_x because of rounding errors */
|
||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner;
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner;
|
||||
act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1;
|
||||
}
|
||||
else {
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner +
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner +
|
||||
left;
|
||||
}
|
||||
/* Set the button's area.
|
||||
@ -243,7 +244,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
||||
lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h);
|
||||
}
|
||||
|
||||
unit_act_cnt += get_button_width(ext->ctrl_bits[btn_i]);
|
||||
unit_act_cnt += btn_unit_w;
|
||||
|
||||
i_tot++;
|
||||
btn_i++;
|
||||
|
@ -619,7 +619,6 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
|
||||
lv_draw_img_dsc_t img_dsc;
|
||||
lv_draw_img_dsc_init(&img_dsc);
|
||||
lv_obj_init_draw_img_dsc(gauge, LV_GAUGE_PART_MAIN, &img_dsc);
|
||||
img_dsc.recolor_opa = LV_OPA_COVER;
|
||||
img_dsc.pivot.x = ext->needle_img_pivot.x;
|
||||
img_dsc.pivot.y = ext->needle_img_pivot.y;
|
||||
|
||||
|
@ -580,6 +580,9 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
/*Non true color format might have "holes"*/
|
||||
if(ext->cf != LV_IMG_CF_TRUE_COLOR && ext->cf != LV_IMG_CF_RAW) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
/*With not LV_OPA_COVER images acn't cover an area */
|
||||
if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
|
||||
angle_final += ext->angle;
|
||||
|
||||
@ -602,7 +605,10 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
if(_lv_area_is_in(clip_area, &a, 0) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER;
|
||||
#if LV_USE_BLEND_MODES
|
||||
if(lv_obj_get_style_bg_blend_mode(img, LV_IMG_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
|
||||
if(lv_obj_get_style_image_blend_mode(img, LV_IMG_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER;
|
||||
#endif
|
||||
|
||||
return LV_DESIGN_RES_COVER;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
|
||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||
};
|
||||
|
||||
static const char * const default_kb_map_spec[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n",
|
||||
static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n",
|
||||
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||
|
@ -76,6 +76,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->line_cnt = 18;
|
||||
ext->scale_angle = 240;
|
||||
ext->angle_ofs = 0;
|
||||
ext->mirrored = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
|
||||
|
@ -118,6 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
ext->scrl = lv_cont_create(page, NULL);
|
||||
lv_obj_set_focus_parent(ext->scrl, true);
|
||||
lv_obj_set_drag(ext->scrl, true);
|
||||
lv_obj_set_drag_throw(ext->scrl, true);
|
||||
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
||||
@ -131,6 +132,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_signal_cb(page, lv_page_signal);
|
||||
lv_obj_set_design_cb(page, lv_page_design);
|
||||
|
||||
|
||||
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
|
||||
|
||||
lv_theme_apply(page, LV_THEME_PAGE);
|
||||
@ -1044,32 +1046,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS) {
|
||||
#if LV_USE_GROUP
|
||||
if(lv_obj_get_group(page)) {
|
||||
lv_group_focus_obj(page);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
res = lv_event_send(page, LV_EVENT_FOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
bool in_group = false;
|
||||
#if LV_USE_GROUP
|
||||
in_group = lv_obj_get_group(page) ? true : false;
|
||||
#endif
|
||||
if(in_group == false) {
|
||||
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
page_ext->scrl = NULL;
|
||||
|
||||
|
@ -585,10 +585,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
|
||||
/* Include the ancient signal function */
|
||||
if(sign != LV_SIGNAL_CONTROL) { /*Don't let the page to scroll on keys*/
|
||||
#if LV_USE_GROUP
|
||||
res = ancestor_signal(roller, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
@ -966,6 +964,18 @@ static void refr_width(lv_obj_t * roller)
|
||||
lv_style_int_t left = lv_obj_get_style_pad_left(roller, LV_ROLLER_PART_BG);
|
||||
lv_style_int_t right = lv_obj_get_style_pad_right(roller, LV_ROLLER_PART_BG);
|
||||
|
||||
const lv_font_t * base_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
|
||||
const lv_font_t * sel_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_SELECTED);
|
||||
|
||||
/*The selected text might be larger to get its size*/
|
||||
if(base_font != sel_font) {
|
||||
lv_coord_t letter_sp = lv_obj_get_style_text_letter_space(roller, LV_ROLLER_PART_SELECTED);
|
||||
lv_coord_t line_sp = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_SELECTED);
|
||||
lv_point_t p;
|
||||
_lv_txt_get_size(&p, lv_label_get_text(label), sel_font, letter_sp, line_sp, LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
if(label_w < p.x)label_w = p.x;
|
||||
}
|
||||
|
||||
lv_obj_set_width(roller, label_w + left + right);
|
||||
}
|
||||
|
||||
|
@ -390,10 +390,8 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
|
||||
/* Include the ancient signal function */
|
||||
if(sign != LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
res = ancestor_signal(spinbox, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
#endif
|
||||
}
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
|
@ -1468,6 +1468,8 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
|
||||
lv_textarea_set_cursor_pos(ta, 0);
|
||||
else if(c == LV_KEY_END)
|
||||
lv_textarea_set_cursor_pos(ta, LV_TEXTAREA_CURSOR_LAST);
|
||||
else if(c == LV_KEY_ENTER && lv_textarea_get_one_line(ta))
|
||||
lv_event_send(ta, LV_EVENT_APPLY, NULL);
|
||||
else {
|
||||
lv_textarea_add_char(ta, c);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ CSRCS += lv_test_core/lv_test_core.c
|
||||
CSRCS += lv_test_core/lv_test_obj.c
|
||||
CSRCS += lv_test_core/lv_test_style.c
|
||||
CSRCS += lv_test_core/lv_test_font_loader.c
|
||||
CSRCS += lv_test_widgets/lv_test_label.c
|
||||
CSRCS += lv_test_fonts/font_1.c
|
||||
CSRCS += lv_test_fonts/font_2.c
|
||||
CSRCS += lv_test_fonts/font_3.c
|
||||
|
@ -120,7 +120,6 @@ minimal_monochrome = {
|
||||
"LV_USE_PAGE":0,
|
||||
"LV_USE_SPINNER":0,
|
||||
"LV_USE_ROLLER":0,
|
||||
"LV_USE_ROTARY":0,
|
||||
"LV_USE_SLIDER":0,
|
||||
"LV_USE_SPINBOX":0,
|
||||
"LV_USE_SWITCH":0,
|
||||
@ -197,7 +196,6 @@ all_obj_minimal_features = {
|
||||
"LV_USE_PAGE":1,
|
||||
"LV_USE_SPINNER":0, #Disabled beacsue needs anim
|
||||
"LV_USE_ROLLER":1,
|
||||
"LV_USE_ROTARY":1,
|
||||
"LV_USE_SLIDER":1,
|
||||
"LV_USE_SPINBOX":1,
|
||||
"LV_USE_SWITCH":1,
|
||||
@ -276,7 +274,6 @@ all_obj_all_features = {
|
||||
"LV_USE_PAGE":1,
|
||||
"LV_USE_SPINNER":1,
|
||||
"LV_USE_ROLLER":1,
|
||||
"LV_USE_ROTARY":1,
|
||||
"LV_USE_SLIDER":1,
|
||||
"LV_USE_SPINBOX":1,
|
||||
"LV_USE_SWITCH":1,
|
||||
@ -294,8 +291,8 @@ advanced_features = {
|
||||
"LV_MEM_CUSTOM":1,
|
||||
"LV_HOR_RES_MAX":800,
|
||||
"LV_VER_RES_MAX":480,
|
||||
"LV_COLOR_DEPTH":16,
|
||||
"LV_COLOR_16_SWAP":1,
|
||||
"LV_COLOR_DEPTH":32,
|
||||
"LV_COLOR_16_SWAP":0,
|
||||
"LV_COLOR_SCREEN_TRANSP":1,
|
||||
"LV_USE_GROUP":1,
|
||||
"LV_USE_ANIMATION":1,
|
||||
@ -305,9 +302,6 @@ advanced_features = {
|
||||
"LV_USE_IMG_TRANSFORM":1,
|
||||
"LV_USE_API_EXTENSION_V6":1,
|
||||
"LV_USE_USER_DATA":1,
|
||||
"LV_USE_USER_DATA_FREE":1,
|
||||
"LV_USER_DATA_FREE_INCLUDE":"\\\"<stdio.h>\\\"",
|
||||
"LV_USER_DATA_FREE": "\\\"free\\\"",
|
||||
"LV_IMG_CACHE_DEF_SIZE":32,
|
||||
"LV_USE_LOG":1,
|
||||
"LV_USE_THEME_MATERIAL":1,
|
||||
@ -368,7 +362,6 @@ advanced_features = {
|
||||
"LV_USE_PAGE":1,
|
||||
"LV_USE_SPINNER":1,
|
||||
"LV_USE_ROLLER":1,
|
||||
"LV_USE_ROTARY":1,
|
||||
"LV_USE_SLIDER":1,
|
||||
"LV_USE_SPINBOX":1,
|
||||
"LV_USE_SWITCH":1,
|
||||
@ -382,7 +375,8 @@ advanced_features = {
|
||||
|
||||
build("Minimal monochrome", minimal_monochrome)
|
||||
build("All objects, minimal features", all_obj_minimal_features)
|
||||
build("All objects, all features", all_obj_all_features)
|
||||
build("All objects, all common features", all_obj_all_features)
|
||||
build("All objects, with advanced features", advanced_features)
|
||||
|
||||
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/"
|
||||
//#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/"
|
||||
#define REF_IMGS_PATH "lv_test_ref_imgs/"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -177,6 +178,16 @@ void lv_test_assert_color_eq(lv_color_t c_ref, lv_color_t c_act, const char * s)
|
||||
|
||||
void lv_test_assert_img_eq(const char * fn_ref, const char * s)
|
||||
{
|
||||
#if LV_COLOR_DEPTH != 32
|
||||
lv_test_print(" SKIP: Can't compare '%s' because LV_COLOR_DEPTH != 32", fn_ref);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if LV_HOR_RES_MAX != 800 || LV_VER_RES_MAX != 480
|
||||
lv_test_print(" SKIP: Can't compare '%s' because the resolution needs to be 800x480 (LV_HOR_RES_MAX, LV_VER_RES_MAX)", fn_ref);
|
||||
return;
|
||||
#endif
|
||||
|
||||
char fn_ref_full[512];
|
||||
sprintf(fn_ref_full, "%s%s", REF_IMGS_PATH, fn_ref);
|
||||
|
||||
@ -185,16 +196,23 @@ void lv_test_assert_img_eq(const char * fn_ref, const char * s)
|
||||
uint8_t * screen_buf;
|
||||
|
||||
lv_disp_t * disp = lv_disp_get_default();
|
||||
lv_obj_invalidate(lv_disp_get_scr_act(disp));
|
||||
lv_refr_now(disp);
|
||||
screen_buf = disp->driver.buffer->buf1;
|
||||
|
||||
extern lv_color_t test_fb[];
|
||||
|
||||
screen_buf = (uint8_t *)test_fb;
|
||||
|
||||
uint8_t * ptr_act = NULL;
|
||||
const png_byte* ptr_ref = NULL;
|
||||
|
||||
bool err = false;
|
||||
int x, y, i_buf = 0;
|
||||
for (y=0; y<p.height; y++) {
|
||||
png_byte* row = p.row_pointers[y];
|
||||
for (x=0; x<p.width; x++) {
|
||||
const png_byte* ptr_ref = &(row[x*3]);
|
||||
uint8_t * ptr_act = &(screen_buf[i_buf*4]);
|
||||
ptr_ref = &(row[x*3]);
|
||||
ptr_act = &(screen_buf[i_buf*4]);
|
||||
uint8_t tmp = ptr_act[0];
|
||||
ptr_act[0] = ptr_act[2];
|
||||
ptr_act[2] = tmp;
|
||||
@ -211,7 +229,11 @@ void lv_test_assert_img_eq(const char * fn_ref, const char * s)
|
||||
png_release(&p);
|
||||
|
||||
if(err) {
|
||||
lv_test_error(" FAIL: %s. (Expected: %s)", s, fn_ref);
|
||||
uint32_t ref_px = 0;
|
||||
uint32_t act_px = 0;
|
||||
memcpy(&ref_px, ptr_ref, 3);
|
||||
memcpy(&act_px, ptr_act, 3);
|
||||
lv_test_error(" FAIL: %s. (Expected: %s, diff. at (%d;%d), %08x instead of %08x)", s, fn_ref, x, y, act_px, ref_px);
|
||||
} else {
|
||||
lv_test_print(" PASS: %s. (Expected: %s)", s, fn_ref);
|
||||
}
|
||||
@ -334,7 +356,7 @@ static void png_release(png_img_t * p)
|
||||
free(p->row_pointers[y]);
|
||||
free(p->row_pointers);
|
||||
}
|
||||
//
|
||||
|
||||
//static void process_file(png_img_t * p)
|
||||
//{
|
||||
// if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB)
|
||||
|
@ -7,12 +7,12 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lv_test_assert.h"
|
||||
#include "lvgl/lvgl.h"
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "../src/lv_font/lv_font.h"
|
||||
#include "../src/lv_font/lv_font_loader.h"
|
||||
#include "../lv_test_assert.h"
|
||||
#include "lvgl/src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "lvgl/src/lv_font/lv_font.h"
|
||||
#include "lvgl/src/lv_font/lv_font_loader.h"
|
||||
|
||||
#include "lv_test_font_loader.h"
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0
|
||||
static int compare_fonts(lv_font_t * f1, lv_font_t * f2);
|
||||
#endif
|
||||
|
||||
@ -50,7 +50,7 @@ extern lv_font_t font_3;
|
||||
|
||||
void lv_test_font_loader(void)
|
||||
{
|
||||
#if LV_USE_FILESYSTEM
|
||||
#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0
|
||||
lv_font_t * font_1_bin = lv_font_load("f:font_1.fnt");
|
||||
lv_font_t * font_2_bin = lv_font_load("f:font_2.fnt");
|
||||
lv_font_t * font_3_bin = lv_font_load("f:font_3.fnt");
|
||||
@ -62,10 +62,12 @@ void lv_test_font_loader(void)
|
||||
lv_font_free(font_1_bin);
|
||||
lv_font_free(font_2_bin);
|
||||
lv_font_free(font_3_bin);
|
||||
#else
|
||||
lv_test_print("SKIP: font load test because it requires LV_USE_FILESYSTEM 1 and LV_FONT_FMT_TXT_LARGE 0");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0
|
||||
static int compare_fonts(lv_font_t * f1, lv_font_t * f2)
|
||||
{
|
||||
lv_test_assert_true(f1 != NULL && f2 != NULL, "font not null");
|
||||
|
@ -3,12 +3,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "lv_test_core/lv_test_core.h"
|
||||
#include "lv_test_widgets/lv_test_label.h"
|
||||
|
||||
#if LV_BUILD_TEST
|
||||
|
||||
static void hal_init(void);
|
||||
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
|
||||
|
||||
lv_color_t test_fb[LV_HOR_RES_MAX * LV_VER_RES_MAX];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Call lv_init...\n");
|
||||
@ -17,6 +20,7 @@ int main(void)
|
||||
hal_init();
|
||||
|
||||
lv_test_core();
|
||||
lv_test_label();
|
||||
|
||||
printf("Exit with success!\n");
|
||||
return 0;
|
||||
@ -85,7 +89,7 @@ static void hal_init(void)
|
||||
static lv_disp_buf_t disp_buf;
|
||||
lv_color_t * disp_buf1 = (lv_color_t *)malloc(LV_HOR_RES * LV_VER_RES * sizeof(lv_color_t));
|
||||
|
||||
lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES* LV_VER_RES);
|
||||
lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES * LV_VER_RES);
|
||||
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
@ -109,11 +113,15 @@ static void hal_init(void)
|
||||
lv_fs_drv_register(&drv); /*Finally register the drive*/
|
||||
#endif
|
||||
}
|
||||
#include <stdio.h>
|
||||
|
||||
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
LV_UNUSED(area);
|
||||
LV_UNUSED(color_p);
|
||||
|
||||
memcpy(test_fb, color_p, lv_area_get_size(area) * sizeof(lv_color_t));
|
||||
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
|
||||
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @file lv_test_cont.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lvgl.h"
|
||||
#include "../lv_test_assert.h"
|
||||
|
||||
#if LV_BUILD_TEST
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void create_copy(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_test_cont(void)
|
||||
{
|
||||
lv_test_print("");
|
||||
lv_test_print("===================");
|
||||
lv_test_print("Start lv_cont tests");
|
||||
lv_test_print("===================");
|
||||
|
||||
create_copy();
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void create_copy(void)
|
||||
{
|
||||
lv_test_print("");
|
||||
lv_test_print("Create and copy a container");
|
||||
lv_test_print("---------------------------");
|
||||
|
||||
lv_test_print("Create a container");
|
||||
lv_test_assert_int_eq(0, lv_obj_count_children(lv_scr_act()), "Screen's children count before creation");
|
||||
|
||||
lv_obj_t * obj = lv_cont_create(lv_scr_act(), NULL);
|
||||
lv_test_assert_int_eq(1, lv_obj_count_children(lv_scr_act()), "Screen's children count after creation");
|
||||
|
||||
lv_test_print("Test the default values");
|
||||
lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_left(obj), "Default left fit");
|
||||
lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_right(obj), "Default right fit");
|
||||
lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_top(obj), "Default top fit");
|
||||
lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_bottom(obj), "Default bottom fit");
|
||||
lv_test_assert_int_eq(LV_LAYOUT_OFF, lv_cont_get_layout(obj), "Default layout");
|
||||
|
||||
lv_test_print("Delete the container");
|
||||
lv_obj_del(obj);
|
||||
obj = NULL;
|
||||
lv_test_assert_int_eq(0, lv_obj_count_children(lv_scr_act()), "Screen's children count after delete");
|
||||
|
||||
}
|
||||
#endif
|
BIN
tests/lv_test_ref_imgs/lv_test_img32_label_1.png
Normal file
BIN
tests/lv_test_ref_imgs/lv_test_img32_label_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
70
tests/lv_test_widgets/lv_test_label.c
Normal file
70
tests/lv_test_widgets/lv_test_label.c
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file lv_test_label.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lvgl.h"
|
||||
#include "../lv_test_assert.h"
|
||||
#include "lv_test_label.h"
|
||||
|
||||
#if LV_BUILD_TEST
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void create_copy(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_test_label(void)
|
||||
{
|
||||
lv_test_print("");
|
||||
lv_test_print("===================");
|
||||
lv_test_print("Start lv_label tests");
|
||||
lv_test_print("===================");
|
||||
|
||||
#if LV_USE_LABEL
|
||||
create_copy();
|
||||
#else
|
||||
lv_test_print("Skip label test: LV_USE_LABEL == 0");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void create_copy(void)
|
||||
{
|
||||
lv_test_print("");
|
||||
lv_test_print("Create a label");
|
||||
lv_test_print("---------------------------");
|
||||
|
||||
lv_label_create(lv_scr_act(), NULL);
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
lv_test_assert_img_eq("lv_test_img32_label_1.png", "Create a label and leave the default settings");
|
||||
#endif
|
||||
}
|
||||
#endif
|
@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file lv_test_obj.h
|
||||
* @file lv_test_label.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_TEST_CONT_H
|
||||
#define LV_TEST_CONT_H
|
||||
#ifndef LV_TEST_LABEL_H
|
||||
#define LV_TEST_LABEL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -25,7 +25,7 @@ extern "C" {
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_test_cont(void);
|
||||
void lv_test_label(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
Loading…
x
Reference in New Issue
Block a user