From 72948cda487a4b2270f431a1fe7a6d80bc353b70 Mon Sep 17 00:00:00 2001 From: Kiss-Vamosi Gabor Date: Thu, 29 Dec 2016 23:48:01 +0100 Subject: [PATCH] icons moved, app sysmon added, app fsel added --- lv_app/lv_app.c | 68 ++-- lv_app/lv_app.h | 10 +- lv_app/lv_app_util/lv_app_fsel.c | 377 ++++++++++++++++++ lv_app/lv_app_util/lv_app_fsel.h | 36 ++ lv_app/lv_app_util/lv_app_kb.c | 4 +- lv_app/lv_app_util/lv_app_kb.h | 8 +- lv_app/lv_app_util/lv_app_notice.c | 44 +- lv_app/lv_icon/x2/img_battery_empty.c | 34 -- lv_app/lv_icon/x2/img_battery_full.c | 34 -- lv_app/lv_icon/x2/img_battery_half.c | 34 -- lv_app/lv_icon/x2/img_image.c | 43 -- lv_app/lv_icon/x2/img_music.c | 48 --- lv_app/lv_icon/x2/img_video.c | 37 -- lv_appx/lv_app_example.c | 8 +- lv_appx/lv_app_example.h | 1 + lv_appx/lv_app_sysmon.c | 351 ++++++++++++++++ lv_appx/lv_app_sysmon.h | 39 ++ lv_draw/lv_draw_vbasic.c | 1 - {lv_app/lv_icon => lv_icon}/x2/img_add.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_bubble.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_calendar.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_clock.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_close.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_down.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_driver.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_eject.c | 0 lv_icon/x2/img_file.c | 50 +++ {lv_app/lv_icon => lv_icon}/x2/img_folder.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_left.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_ok.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_play.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_right.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_settings.c | 0 .../lv_icon => lv_icon}/x2/img_shut_down.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_star.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_up.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_user.c | 0 {lv_app/lv_icon => lv_icon}/x2/img_volume.c | 0 lv_misc/anim.c | 4 +- lv_misc/font.h | 3 + lv_misc/fonts/dejavu_40.c | 30 +- lv_obj/lv_obj.c | 7 +- lv_objx/lv_btn.c | 26 +- lv_objx/lv_chart.c | 52 ++- lv_objx/lv_chart.h | 3 +- lv_objx/lv_list.c | 11 + lv_objx/lv_list.h | 1 + lv_objx/lv_pb.c | 36 +- lv_objx/lv_pb.h | 1 + 49 files changed, 1056 insertions(+), 345 deletions(-) create mode 100644 lv_app/lv_app_util/lv_app_fsel.c create mode 100644 lv_app/lv_app_util/lv_app_fsel.h delete mode 100644 lv_app/lv_icon/x2/img_battery_empty.c delete mode 100644 lv_app/lv_icon/x2/img_battery_full.c delete mode 100644 lv_app/lv_icon/x2/img_battery_half.c delete mode 100644 lv_app/lv_icon/x2/img_image.c delete mode 100644 lv_app/lv_icon/x2/img_music.c delete mode 100644 lv_app/lv_icon/x2/img_video.c create mode 100644 lv_appx/lv_app_sysmon.c create mode 100644 lv_appx/lv_app_sysmon.h rename {lv_app/lv_icon => lv_icon}/x2/img_add.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_bubble.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_calendar.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_clock.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_close.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_down.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_driver.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_eject.c (100%) create mode 100644 lv_icon/x2/img_file.c rename {lv_app/lv_icon => lv_icon}/x2/img_folder.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_left.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_ok.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_play.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_right.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_settings.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_shut_down.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_star.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_up.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_user.c (100%) rename {lv_app/lv_icon => lv_icon}/x2/img_volume.c (100%) diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index c0461ccba..a3ef697a4 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -11,8 +11,13 @@ #if LV_APP_ENABLE != 0 #include "lv_app_util/lv_app_kb.h" #include "lv_app_util/lv_app_notice.h" +#include "lv_app_util/lv_app_fsel.h" + #include "lvgl/lv_misc/anim.h" +#include "../lv_appx/lv_app_example.h" +#include "../lv_appx/lv_app_sysmon.h" + /********************* * DEFINES *********************/ @@ -67,9 +72,6 @@ static lv_app_style_t app_style; /*Styles for application related things*/ /*Declare icons*/ LV_IMG_DECLARE(img_add); -LV_IMG_DECLARE(img_battery_empty); -LV_IMG_DECLARE(img_battery_full); -LV_IMG_DECLARE(img_battery_half); LV_IMG_DECLARE(img_bubble); LV_IMG_DECLARE(img_calendar); LV_IMG_DECLARE(img_clock); @@ -77,10 +79,9 @@ LV_IMG_DECLARE(img_close); LV_IMG_DECLARE(img_down); LV_IMG_DECLARE(img_driver); LV_IMG_DECLARE(img_eject); +LV_IMG_DECLARE(img_file); LV_IMG_DECLARE(img_folder); -LV_IMG_DECLARE(img_image); LV_IMG_DECLARE(img_left); -LV_IMG_DECLARE(img_music); LV_IMG_DECLARE(img_ok); LV_IMG_DECLARE(img_play); LV_IMG_DECLARE(img_right); @@ -89,7 +90,6 @@ LV_IMG_DECLARE(img_shut_down); LV_IMG_DECLARE(img_star); LV_IMG_DECLARE(img_up); LV_IMG_DECLARE(img_user); -LV_IMG_DECLARE(img_video); LV_IMG_DECLARE(img_volume); /********************** @@ -120,6 +120,7 @@ void lv_app_init(void) /*Init. the utilities*/ lv_app_kb_init(); lv_app_notice_init(); + lv_app_fsel_init(); /*Initialize all application descriptors*/ /*ADD NEW APPLICATION INITS HERE!!!*/ @@ -128,15 +129,21 @@ void lv_app_init(void) dsc = ll_ins_head(&app_dsc_ll); *dsc = lv_app_example_init(); #endif + +#if USE_LV_APP_SYSMON != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_sysmon_init(); +#endif } /** * Run an application according to 'app_dsc' * @param app_dsc pointer to an application descriptor * @param cstr a Create STRing which can give initial parameters to the application (NULL or "" if unused) + * @param conf pointer to an application specific configuration structure or NULL if unused * @return pointer to the opened application or NULL if any error occurred */ -lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr) +lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr, void * conf) { /*Add a new application and initialize it*/ lv_app_inst_t * app; @@ -147,7 +154,7 @@ lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr) lv_app_rename(app, app_dsc->name); /*Set a default name*/ /*Call the application specific run function*/ - app_dsc->app_run(app, cstr); + app_dsc->app_run(app, cstr, conf); return app; } @@ -249,6 +256,7 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app) app->win = lv_win_create(lv_scr_act(), NULL); lv_obj_set_free_p(app->win, app); lv_obj_set_style(app->win, &app_style.win_style); + lv_win_set_title(app->win, app->dsc->name); lv_obj_t * win_content = lv_page_get_scrable(lv_win_get_content(app->win)); lv_rect_set_fit(win_content, false, true); lv_obj_set_width(win_content, LV_HOR_RES - 2 * app_style.win_style.content.bg_rects.hpad); @@ -426,6 +434,8 @@ lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc) if(next->dsc == dsc || dsc == NULL) return next; + prev = next; + }; return NULL; @@ -450,7 +460,7 @@ void lv_app_refr_style(void) * Get a pointer to the application style structure. If modified then 'lv_app_refr_style' should be called * @return pointer to the application style structure */ -lv_app_style_t * lv_app_get_style(void) +lv_app_style_t * lv_app_style_get(void) { return &app_style; } @@ -555,7 +565,7 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d lv_obj_del(app_list); app_list = NULL; - lv_app_inst_t * app = lv_app_run(dsc, ""); + lv_app_inst_t * app = lv_app_run(dsc, "", NULL); lv_app_sc_open(app); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_EFFECT_OPA_ANIM != 0 && LV_APP_ANIM_SC != 0 @@ -710,7 +720,7 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t lv_app_kb_close(false); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_EFFECT_OPA != 0 && LV_APP_ANIM_WIN != 0 - lv_obj_anim(app->win, LV_ANIM_FADE | ANIM_OUT, LV_APP_ANIM_WIN, 0, lv_app_win_close_anim_cb); + lv_obj_anim(app->win, LV_ANIM_FLOAT_LEFT | ANIM_OUT, LV_APP_ANIM_WIN, 0, lv_app_win_close_anim_cb); lv_app_sc_close(app); /*The animation will close the window*/ return LV_ACTION_RES_OK; @@ -793,12 +803,6 @@ static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app) a.fp = (anim_fp_t) lv_obj_set_y; anim_create(&a); -#if LV_APP_EFFECT_OPA_ANIM != 0 - a.start = OPA_TRANSP; - a.end = OPA_COVER; - a.fp = (anim_fp_t) lv_obj_set_opar; - anim_create(&a); -#endif /*LV_APP_EFFECT_OPA != 0*/ #endif /*LV_APP_EFFECT_ANIM != 0 && LV_APP_ANIM_WIN != 0*/ return LV_ACTION_RES_OK; @@ -850,18 +854,9 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app) a.end = cords.y1; a.start = 0; a.fp = (anim_fp_t) lv_obj_set_y; -#if LV_APP_EFFECT_OPA_ANIM == 0 a.end_cb = (void (*)(void *))lv_app_win_close_anim_cb; -#endif anim_create(&a); -#if LV_APP_EFFECT_OPA_ANIM != 0 - a.end = OPA_TRANSP; - a.start = OPA_COVER; - a.fp = (anim_fp_t) lv_obj_set_opar; - a.end_cb = (void (*)(void *))lv_app_win_close_anim_cb; - anim_create(&a); -#endif return LV_ACTION_RES_OK; #else /*LV_APP_ANIM_WIN == 0 || LV_APP_ANIM_LEVEL == 0*/ lv_app_win_close(app); @@ -998,12 +993,16 @@ static void lv_app_init_style(void) app_style.sc_rec_style.rects.bopa = 30; app_style.sc_rec_style.rects.bwidth = 3 * LV_DOWNSCALE; - lv_labels_get(LV_LABELS_DEF,&app_style.sc_title_style); app_style.sc_title_style.font = LV_APP_FONT_SMALL; - app_style.sc_title_style.objs.color = COLOR_MAKE(0x20, 0x30, 0x40); + app_style.sc_title_style.objs.color = COLOR_MAKE(0x10, 0x20, 0x30); app_style.sc_title_style.mid = 1; + lv_labels_get(LV_LABELS_DEF,&app_style.sc_txt_style); + app_style.sc_txt_style.font = LV_APP_FONT_MEDIUM; + app_style.sc_txt_style.objs.color = COLOR_MAKE(0x20, 0x30, 0x40); + app_style.sc_txt_style.mid = 0; + /*Window styles*/ lv_wins_get(LV_WINS_DEF,&app_style.win_style); memcpy(&app_style.win_style.header, &app_style.menu_style, sizeof(lv_rects_t)); @@ -1020,6 +1019,12 @@ static void lv_app_init_style(void) 2 * app_style.win_style.header.vpad; app_style.win_style.content.bg_rects.hpad = 5 * LV_DOWNSCALE; app_style.win_style.content.scrable_rects.objs.transp = 1; + + lv_labels_get(LV_LABELS_DEF,&app_style.win_txt_style); + app_style.win_txt_style.font = LV_APP_FONT_MEDIUM; + app_style.win_txt_style.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); + app_style.win_txt_style.mid = 0; + app_style.win_txt_style.letter_space = 1 * LV_DOWNSCALE; } /** @@ -1028,9 +1033,6 @@ static void lv_app_init_style(void) static void lv_app_init_icons(void) { lv_img_create_file("icon_add", img_add); - lv_img_create_file("icon_battery_empty", img_battery_empty); - lv_img_create_file("icon_battery_full", img_battery_full); - lv_img_create_file("icon_battery_half", img_battery_half); lv_img_create_file("icon_bubble", img_bubble); lv_img_create_file("icon_calendar", img_calendar); lv_img_create_file("icon_clock", img_clock); @@ -1038,10 +1040,9 @@ static void lv_app_init_icons(void) lv_img_create_file("icon_down", img_down); lv_img_create_file("icon_driver", img_driver); lv_img_create_file("icon_eject", img_eject); + lv_img_create_file("icon_file", img_file); lv_img_create_file("icon_folder", img_folder); - lv_img_create_file("icon_image", img_image); lv_img_create_file("icon_left", img_left); - lv_img_create_file("icon_music", img_music); lv_img_create_file("icon_ok", img_ok); lv_img_create_file("icon_play", img_play); lv_img_create_file("icon_right", img_right); @@ -1050,7 +1051,6 @@ static void lv_app_init_icons(void) lv_img_create_file("icon_star", img_star); lv_img_create_file("icon_up", img_up); lv_img_create_file("icon_user", img_user); - lv_img_create_file("icon_video", img_video); lv_img_create_file("icon_volume", img_volume); } #endif /*LV_APP_ENABLE != 0*/ diff --git a/lv_app/lv_app.h b/lv_app/lv_app.h index 00ba12a4e..9eb6a29d3 100644 --- a/lv_app/lv_app.h +++ b/lv_app/lv_app.h @@ -31,7 +31,6 @@ typedef enum { LV_APP_COM_TYPE_STR, /*String data to process*/ LV_APP_COM_TYPE_BIN, /*Binary data as 'int32_t' array*/ - LV_APP_COM_TYPE_SYS, /*System level event*/ LV_APP_COM_TYPE_LOG, /*String about an event to log*/ LV_APP_COM_TYPE_NOTICE, /*String to display to the user as a notification*/ LV_APP_COM_TYPE_TRIG, /*A trigger to do some specific action (data is ignored)*/ @@ -55,7 +54,7 @@ typedef struct __LV_APP_DSC_T { const char * name; lv_app_mode_t mode; - void (*app_run)(lv_app_inst_t *, const char *); + void (*app_run)(lv_app_inst_t *, const char *, void *); void (*app_close) (lv_app_inst_t *); void (*com_rec) (lv_app_inst_t *, lv_app_inst_t *, lv_app_com_type_t, const void *, uint32_t); void (*sc_open) (lv_app_inst_t *, lv_obj_t *); @@ -74,11 +73,14 @@ typedef struct { lv_imgs_t menu_btn_img_style; lv_lists_t app_list_style; lv_pages_t sc_page_style; + lv_labels_t win_txt_style; lv_wins_t win_style; lv_btns_t sc_style; lv_btns_t sc_send_style; lv_btns_t sc_rec_style; lv_labels_t sc_title_style; + lv_labels_t sc_txt_style; + opa_t menu_opa; opa_t menu_btn_opa; @@ -95,7 +97,7 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ void lv_app_init(void); -lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr); +lv_app_inst_t * lv_app_run(const lv_app_dsc_t * app_dsc, const char * cstr, void * conf); void lv_app_close(lv_app_inst_t * app); uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t len); lv_obj_t * lv_app_sc_open(lv_app_inst_t * app); @@ -106,7 +108,7 @@ lv_obj_t * lv_app_win_get_from_obj(lv_obj_t * obj); const lv_app_dsc_t * lv_app_dsc_get(const char * name); void lv_app_con_set(lv_app_inst_t * sender, lv_app_inst_t * receiver); -lv_app_style_t * lv_app_get_style(void); +lv_app_style_t * lv_app_style_get(void); void lv_app_rename(lv_app_inst_t * app, const char * name); void lv_app_refr_style(void); diff --git a/lv_app/lv_app_util/lv_app_fsel.c b/lv_app/lv_app_util/lv_app_fsel.c new file mode 100644 index 000000000..18f29c348 --- /dev/null +++ b/lv_app/lv_app_util/lv_app_fsel.c @@ -0,0 +1,377 @@ +/** + * @file lv_app_fsel.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_fsel.h" +#if LV_APP_ENABLE != 0 + +#include +#include "lv_app_notice.h" + +/********************* + * DEFINES + *********************/ +#define LV_APP_FSEL_FN_MAX_LEN 128 +#define LV_APP_FSEL_PATH_MAX_LEN 256 +#define LV_APP_FSEL_MAX_FILE 8 + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void fsel_refr(void); +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi); +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi); +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi); +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi); +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi); +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi); +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi); +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi); +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi); + +/********************** + * STATIC VARIABLES + **********************/ +static const char * fsel_filter; +static char fsel_path[LV_APP_FSEL_PATH_MAX_LEN]; +static uint16_t fsel_file_cnt; +static lv_obj_t * fsel_win; +static lv_obj_t * fsel_list; +static lv_lists_t fsel_lists; +static void * fsel_param; +static void (*fsel_ok_action)(void *, const char *); + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the File selector utility + */ +void lv_app_fsel_init(void) +{ + lv_app_style_t * app_style = lv_app_style_get(); + + lv_lists_get(LV_LISTS_DEF, &fsel_lists); + + memcpy(&fsel_lists.liste_labels, &app_style->menu_btn_label_style, sizeof(lv_labels_t)); + fsel_lists.bg_pages.bg_rects.empty = 1; + fsel_lists.bg_pages.bg_rects.bwidth = 0; + + fsel_lists.liste_imgs.objs.color = COLOR_WHITE; + fsel_lists.liste_imgs.recolor_opa = OPA_70; +} + +/** + * Open the File selector + * @param path start path + * @param filter show only files with a specific extension, e.g. "wav". + * "/" means filter to folders. + * @param param a free parameter which will be added to 'ok_action' + * @param ok_action an action to call when a file or folder is chosen + */ +void lv_app_fsel_open(const char * path, const char * filter, void * param, void (*ok_action)(void *, const char *)) +{ + /*Save the paramteres*/ + strcpy(fsel_path, path); + fsel_filter = filter; + fsel_file_cnt = 0; + fsel_param = param; + fsel_ok_action = ok_action; + + /*Create a window for the File selector*/ + lv_app_style_t * app_style = lv_app_style_get(); + fsel_win = lv_win_create(lv_scr_act(), NULL); + lv_obj_set_size(fsel_win, LV_HOR_RES, LV_VER_RES); + lv_obj_set_style(fsel_win, &app_style->win_style); + + lv_win_add_ctrl_btn(fsel_win, "U:/icon_close", fsel_close_action); + + fsel_refr(); /*Refresh the list*/ + + /*Show instruction when first open with folder filter*/ + static bool first_folder_call = false; + if(first_folder_call == false && fsel_filter[0] == '/') { + lv_app_notice_add("Press a folder long\nto choose it!"); + first_folder_call = true; + } +} + +/** + * Close the File selector + */ +void lv_app_fsel_close(void) +{ + if(fsel_win != NULL) { + lv_obj_del(fsel_win); + } + + fsel_win = NULL; + fsel_list = NULL; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Refresh the file list according to the current path and filter + */ +static void fsel_refr(void) +{ + /*Delete the previous list*/ + if(fsel_list != NULL) { + lv_obj_del(fsel_list); + } + + lv_win_set_title(fsel_win, fsel_path); + + /*Create a new list*/ + lv_wins_t * wins = lv_obj_get_style(fsel_win); + fsel_list = lv_list_create(fsel_win, NULL); + lv_obj_set_size(fsel_list, LV_HOR_RES - 2 * (wins->content.bg_rects.hpad + wins->content.scrable_rects.hpad), LV_VER_RES - + wins->content.bg_rects.vpad - 2 * wins->content.scrable_rects.vpad); + lv_obj_align(fsel_list, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style(fsel_list, &fsel_lists); + + fs_res_t res = FS_RES_OK; + + /*At empty path show the drivers */ + if(fsel_path[0] == '\0') { + char drv[16]; + char buf[2]; + lv_obj_t * liste; + fs_get_letters(drv); + uint8_t i; + for(i = 0; drv[i] != '\0'; i++) { + buf[0] = drv[i]; + buf[1] = '\0'; + liste = lv_list_add(fsel_list, "U:/icon_driver", buf, fsel_drv_action); + /*Add long press action to choose the driver as a folder*/ + if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_drv_lpr_action); + } + fsel_file_cnt = 0; + + } + /*List the files/folders with fs iterface*/ + else { + lv_list_add(fsel_list, "U:/icon_up", "Up", fsel_up_action); + + fs_readdir_t rd; + res = fs_readdir_init(&rd, fsel_path); + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read the path\nin File selector"); + return; + } + + /*At not first page add prev. page button */ + if(fsel_file_cnt != 0) { + lv_list_add(fsel_list, "U:/icon_left", "Previous page", fsel_prev_action); + } + + char fn[LV_APP_FSEL_FN_MAX_LEN]; + + /*Read the files from the previous pages*/ + uint16_t file_cnt = 0; + while(file_cnt <= fsel_file_cnt) { + res = fs_readdir(&rd, fn); + if(res != FS_RES_OK || fn[0] == '\0'){ + lv_app_notice_add("Can not read the path\nin File selector"); + return; + } + file_cnt ++; + } + + /*Add list elements from the files and folders*/ + while(res == FS_RES_OK && fn[0] != '\0') { + if(fn[0] == '/') { /*Add a folder*/ + lv_obj_t * liste; + liste = lv_list_add(fsel_list, "U:/icon_folder", fn, fsel_folder_action); + /*Add long press action to choose a folder*/ + if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_folder_lpr_action); + + fsel_file_cnt ++; + file_cnt ++; + }else if(strcmp(fs_get_ext(fn), fsel_filter) == 0 && + fsel_filter[0] != '/') { /*Add a file if it is not filtered*/ + lv_list_add(fsel_list, "U:/icon_file", fn, fsel_file_action); + fsel_file_cnt ++; + file_cnt ++; + } + + /*Get the next element*/ + res = fs_readdir(&rd, fn); + + /*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/ + if(fsel_file_cnt != 0 && fsel_file_cnt % LV_APP_FSEL_MAX_FILE == 0) { + lv_list_add(fsel_list, "U:/icon_right", "Next page", fsel_next_action); + break; + } + } + + /*Close the read directory*/ + fs_readdir_close(&rd); + } + + if(res != FS_RES_OK) { + lv_app_notice_add("Can not read the path\nin File selector"); + } + return; +} + +/** + * Called when the File selector window close button is released + * @param close pointer to the close button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the window is deleted in the function + */ +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi) +{ + lv_app_fsel_close(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Up list element is released to step one level + * @param up pointer to the Up button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi) +{ + fs_up(fsel_path); + + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Next list element is released to go to the next page + * @param next pointer to the Next button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi) +{ + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Prev list element is released to previous page + * @param prev pointer to the Prev button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) +{ + if(fsel_file_cnt <= 2 * LV_APP_FSEL_MAX_FILE) fsel_file_cnt = 0; + else if(fsel_file_cnt % LV_APP_FSEL_MAX_FILE == 0) { + fsel_file_cnt -= 2 * LV_APP_FSEL_MAX_FILE; + } else { + fsel_file_cnt = ((fsel_file_cnt / LV_APP_FSEL_MAX_FILE) - 1) * LV_APP_FSEL_MAX_FILE; + } + + fsel_refr(); + return LV_ACTION_RES_INV; +} + + +/** + * Called when the Driver list element is released to step into a driver + * @param drv pointer to the Driver button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv)); + + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when the Driver list element is long pressed to choose it + * @param drv pointer to the Driver button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +/** + * Called when a folder list element is released to enter into it + * @param folder pointer to a folder button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder)); + + fsel_refr(); + return LV_ACTION_RES_INV; +} + +/** + * Called when a folder list element is long pressed to choose it + * @param folder pointer to a folder button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +/** + * Called when a file list element is long pressed to choose it + * @param file pointer to a file button + * @param dispi pointer to the caller display input + * @return LV_ACTION_RES_INV because the list is deleted in the function + */ +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi) +{ + sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(file)); + + if(fsel_ok_action != NULL) { + fsel_ok_action(fsel_param, fsel_path); + } + + lv_app_fsel_close(); + + return LV_ACTION_RES_INV; +} + +#endif /*LV_APP_ENABLE != 0*/ diff --git a/lv_app/lv_app_util/lv_app_fsel.h b/lv_app/lv_app_util/lv_app_fsel.h new file mode 100644 index 000000000..01af59d27 --- /dev/null +++ b/lv_app/lv_app_util/lv_app_fsel.h @@ -0,0 +1,36 @@ +/** + * @file lv_app_fsel.h + * + */ + +#ifndef LV_APP_FSEL_H +#define LV_APP_FSEL_H + +/********************* + * INCLUDES + *********************/ +#include "../lv_app.h" +#if LV_APP_ENABLE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +void lv_app_fsel_init(void); +void lv_app_fsel_open(const char * path, const char * filter, void * param, void (*ok_action)(void *, const char *)); +void lv_app_fsel_close(); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0*/ + +#endif /*LV_APP_FSEL_H*/ diff --git a/lv_app/lv_app_util/lv_app_kb.c b/lv_app/lv_app_util/lv_app_kb.c index e3fe17ce7..f74915016 100644 --- a/lv_app/lv_app_util/lv_app_kb.c +++ b/lv_app/lv_app_util/lv_app_kb.c @@ -1,5 +1,5 @@ /** - * @file lv_app_sup.c + * @file lv_app_kb.c * */ @@ -125,7 +125,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t lv_obj_set_y(kb_win, 0); /*If the text area is higher then the new size of the window redus its size too*/ - lv_app_style_t * app_style = lv_app_get_style(); + lv_app_style_t * app_style = lv_app_style_get(); cord_t win_cont_h = lv_obj_get_height(lv_win_get_content(kb_win)) - 2 * app_style->win_style.content.scrable_rects.vpad; kb_ta_ori_size = lv_obj_get_height(kb_ta); if(lv_obj_get_height(kb_ta) > win_cont_h) { diff --git a/lv_app/lv_app_util/lv_app_kb.h b/lv_app/lv_app_util/lv_app_kb.h index 3c5b4b646..a05972f0f 100644 --- a/lv_app/lv_app_util/lv_app_kb.h +++ b/lv_app/lv_app_util/lv_app_kb.h @@ -1,10 +1,10 @@ /** - * @file lv_app_sup.h + * @file lv_app_kb.h * */ -#ifndef LV_APP_SUP_H -#define LV_APP_SUP_H +#ifndef LV_APP_KB_H +#define LV_APP_KB_H /********************* * INCLUDES @@ -38,4 +38,4 @@ void lv_app_kb_close(bool ok); **********************/ #endif /*LV_APP_ENABLE != 0*/ -#endif /*LV_APP_SUP_H*/ +#endif /*LV_APP_KB_H*/ diff --git a/lv_app/lv_app_util/lv_app_notice.c b/lv_app/lv_app_util/lv_app_notice.c index d9d04ca21..35bd01c40 100644 --- a/lv_app/lv_app_util/lv_app_notice.c +++ b/lv_app/lv_app_util/lv_app_notice.c @@ -25,13 +25,14 @@ /********************** * STATIC PROTOTYPES **********************/ +static lv_action_res_t notice_rel_action(lv_obj_t * n, lv_dispi_t * dispi); /********************** * STATIC VARIABLES **********************/ static lv_obj_t * notice_h; -static lv_rects_t notice_rects; +static lv_btns_t notice_btns; static lv_labels_t notice_labels; /********************** @@ -41,16 +42,24 @@ static lv_labels_t notice_labels; /********************** * GLOBAL FUNCTIONS **********************/ +/** + * Initialize the Notifications + */ void lv_app_notice_init(void) { - lv_app_style_t * app_style = lv_app_get_style(); + lv_app_style_t * app_style = lv_app_style_get(); - memcpy(¬ice_rects, &app_style->menu_style, sizeof(lv_rects_t)); - notice_rects.round = 5 * LV_DOWNSCALE; - notice_rects.bcolor = COLOR_WHITE; - notice_rects.bwidth = 1 * LV_DOWNSCALE; - notice_rects.bopa = 90; - notice_rects.light = 5 * LV_DOWNSCALE; + memcpy(¬ice_btns, &app_style->menu_style, sizeof(lv_rects_t)); + notice_btns.rects.round = 5 * LV_DOWNSCALE; + notice_btns.bcolor[LV_BTN_STATE_REL] = COLOR_WHITE; + notice_btns.mcolor[LV_BTN_STATE_REL] = COLOR_BLACK; + notice_btns.gcolor[LV_BTN_STATE_REL] = COLOR_BLACK; + notice_btns.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE; + notice_btns.mcolor[LV_BTN_STATE_PR] = COLOR_GRAY; + notice_btns.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY; + notice_btns.rects.bwidth = 1 * LV_DOWNSCALE; + notice_btns.rects.bopa = 90; + notice_btns.rects.light = 5 * LV_DOWNSCALE; memcpy(¬ice_labels, &app_style->menu_btn_label_style, sizeof(lv_labels_t)); notice_labels.mid = 0; @@ -64,15 +73,20 @@ void lv_app_notice_init(void) lv_rect_set_layout(notice_h, LV_RECT_LAYOUT_COL_R); } +/** + * Add a notification with a given text + * @param txt the text of the notification + */ void lv_app_notice_add(const char * txt) { - lv_app_style_t * app_style = lv_app_get_style(); + lv_app_style_t * app_style = lv_app_style_get(); lv_obj_t * n; - n = lv_rect_create(notice_h, NULL); + n = lv_btn_create(notice_h, NULL); lv_rect_set_fit(n, true, true); - lv_obj_set_style(n, ¬ice_rects); + lv_obj_set_style(n, ¬ice_btns); lv_obj_set_opa(n, app_style->menu_opa); + lv_btn_set_rel_action(n, notice_rel_action); lv_obj_t * l; l = lv_label_create(n, NULL); @@ -132,4 +146,12 @@ void lv_app_notice_add(const char * txt) /********************** * STATIC FUNCTIONS **********************/ + +static lv_action_res_t notice_rel_action(lv_obj_t * n, lv_dispi_t * dispi) +{ + lv_obj_del(n); + + return LV_ACTION_RES_INV; +} + #endif diff --git a/lv_app/lv_icon/x2/img_battery_empty.c b/lv_app/lv_icon/x2/img_battery_empty.c deleted file mode 100644 index 849d07539..000000000 --- a/lv_app/lv_icon/x2/img_battery_empty.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_EMPTY != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_empty [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31727, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 2016, 2016, 2016, -27469, 14823, 21130, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 21130, 12710, 25356, 2016, 2016, -16904, 8452, 27469, 35953, 38066, 38066, 35953, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35921, 35953, 38034, 27501, 6371, 14823, 2016, 2016, -10597, 6339, 35921, 48599, 42260, 42260, 46486, 48631, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48599, 48631, 52825, 38034, 6339, 8452, 2016, 2016, -10597, 10565, 46518, 57051, 35921, 35921, 52857, 63390, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 61309, 63390, 65535, 48631, 12678, 2145, 21162, 2016, -10597, 10597, 52857, 59164, 27469, 25388, 54970, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 6371, 25356, -10597, 12678, 52857, 54938, 14823, 14791, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 0, 14823, -10597, 12678, 52857, 52857, 10565, 8484, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10565, -10597, 12678, 52857, 52857, 10597, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10597, -10597, 12678, 52857, 52857, 12678, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 12678, -10597, 12678, 52857, 52857, 12678, 10565, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 12678, -10597, 12678, 52857, 52857, 10597, 10565, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 14823, 0, 0, 10597, -10597, 12678, 52857, 52825, 8484, 8452, 48599, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 8484, -10597, 12678, 52857, 57051, 19049, 19017, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 32, 19017, -10597, 10597, 52857, 63422, 42260, 40179, 61277, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 14791, 2145, 21130, 2016, -10597, 8452, 42292, 54938, 44405, 44373, 52857, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 59164, 61277, 44405, 8484, 6339, 2016, 2016, -10597, 32, 21162, 29614, 27501, 27501, 29614, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 33808, 23243, 32, 8452, 2016, 2016, -21130, 8484, 19017, 23275, 25356, 25356, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 25356, 19017, 6371, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_battery_full.c b/lv_app/lv_icon/x2/img_battery_full.c deleted file mode 100644 index d404b3e1c..000000000 --- a/lv_app/lv_icon/x2/img_battery_full.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_FULL != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_full [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31727, 31695, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 29614, 31695, 2016, 2016, 2016, -27469, 14823, 21130, 23275, 23275, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 23275, 21130, 12710, 25356, 2016, 2016, -16904, 8452, 27469, 35953, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 38066, 27501, 6371, 14791, 2016, 2016, -10597, 6339, 35921, 48599, 42292, 40179, 40147, 40147, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40147, 40147, 42292, 50712, 38034, 6339, 8452, 2016, 2016, -10597, 10565, 46518, 57051, 38034, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 27501, 27469, 35953, 59164, 50712, 12678, 2145, 21162, 2016, -10597, 10597, 52857, 59196, 29614, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 16904, 14823, 12710, 27501, 59196, 54970, 14823, 0, 6371, 25356, -10597, 12678, 52857, 57051, 19049, 2145, 2145, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 4226, 2113, 0, 16936, 54970, 54970, 16904, 0, 0, 14823, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 52857, 54970, 16904, 0, 0, 10565, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 54938, 54970, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 52857, 54970, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 52857, 54970, 16904, 0, 0, 8484, -10597, 12678, 52857, 57083, 23275, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 4258, 21130, 57083, 54970, 16904, 0, 32, 19017, -10597, 10597, 52857, 63422, 44373, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 33840, 31727, 42292, 65503, 57051, 14791, 2145, 21130, 2016, -10597, 8452, 42292, 54970, 46486, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40179, 40147, 44405, 57051, 44405, 8484, 6339, 2016, 2016, -10597, 32, 21162, 29614, 27501, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 27469, 25388, 27501, 31727, 23243, 32, 8452, 2016, 2016, -21130, 8484, 19017, 23275, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 25356, 19017, 6371, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_battery_half.c b/lv_app/lv_icon/x2/img_battery_half.c deleted file mode 100644 index 585ba7596..000000000 --- a/lv_app/lv_icon/x2/img_battery_half.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_BATTERY_HALF != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_battery_half [] = { /*Width = 32, Height = 18*/ -32, /*Width*/ -18, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 31695, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 2016, 2016, 2016, -25388, 14791, 19049, 23243, 23243, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 19049, 12678, 23275, 2016, 2016, -16904, 8452, 27469, 38034, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 40147, 38066, 38034, 35953, 35953, 35953, 35953, 38034, 38066, 29582, 6371, 14791, 2016, 2016, -10597, 6339, 35953, 48631, 44373, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 44373, 48599, 50712, 50712, 50712, 50712, 50744, 52857, 38066, 6371, 8452, 2016, 2016, -10597, 10565, 48599, 57083, 38034, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 27501, 38034, 54970, 63422, 63390, 63390, 63390, 63422, 65535, 48631, 12678, 2145, 21130, 2016, -10597, 12678, 52857, 59196, 29582, 14791, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14791, 16904, 23275, 38034, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 6339, 23275, -10597, 12678, 52857, 57051, 19049, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 4226, 2113, 0, 8452, 27501, 46486, 61309, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 14791, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 38034, 54970, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10565, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 21130, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 16904, 35921, 59196, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 35921, 54938, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, -10597, 12678, 52857, 54938, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 16936, 48631, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 10597, -10597, 12678, 52857, 54938, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 31727, 57051, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 8484, -10597, 12678, 52857, 57083, 23275, 8452, 8452, 8484, 8484, 8484, 8484, 8452, 6371, 14791, 31695, 46518, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 14823, 0, 32, 19017, -10597, 12678, 52857, 65503, 46486, 35953, 35953, 35953, 35953, 35953, 35953, 35921, 33840, 40179, 52857, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 14791, 4226, 21162, 2016, -10597, 8452, 42260, 54970, 46486, 42260, 42260, 42260, 42260, 42260, 42260, 42260, 40179, 44405, 52857, 57083, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57051, 57083, 61277, 44405, 8484, 6371, 2016, 2016, -10597, 32, 21130, 29582, 27469, 25388, 25388, 25388, 25388, 25388, 25388, 25388, 25356, 25388, 27501, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29614, 31695, 21162, 0, 8452, 2016, 2016, -21162, 8484, 16936, 23243, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23275, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23243, 23275, 19017, 8452, 19017, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_image.c b/lv_app/lv_icon/x2/img_image.c deleted file mode 100644 index d83125e52..000000000 --- a/lv_app/lv_icon/x2/img_image.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_IMAGE != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_image [] = { /*Width = 32, Height = 27*/ -32, /*Width*/ -27, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 19017, 14823, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 14791, 16936, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 8484, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 6371, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 23243, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 16936, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 25388, 10565, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 25356, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 29582, 19017, 16904, 10565, 2145, 0, 0, 0, 0, 0, 32, 2145, 4258, 6339, 6339, 6339, 4226, 2113, 0, 0, 0, 0, 0, 32, 10565, 14823, 16936, 27469, 2016, 2016, -2016, 21162, 8484, 2145, 2145, 2113, 0, 0, 0, 0, 0, 0, 6339, 12710, 23243, 27501, 27501, 25356, 16936, 8484, 0, 0, 0, 0, 0, 0, 2113, 2145, 2145, 6371, 16904, 33808, -25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 10597, 23243, 31727, 42260, 46518, 46518, 44373, 35953, 25388, 14791, 6339, 32, 0, 0, 0, 0, 0, 0, 0, 32, 19049, -19017, 32, 0, 0, 0, 0, 0, 0, 0, 4226, 23243, 38066, 52825, 59196, 63390, 63422, 63422, 63390, 61277, 54938, 44405, 29582, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 14791, -14823, 0, 0, 0, 0, 0, 0, 0, 32, 14791, 40147, 57083, 65535, 65535, 65503, 63390, 61309, 63422, 65535, 65535, 63390, 46518, 19049, 4258, 32, 0, 0, 0, 0, 0, 0, 10597, -14823, 0, 0, 0, 0, 0, 0, 2145, 12710, 31695, 54938, 65535, 65535, 63422, 50712, 42292, 42260, 48599, 61309, 65535, 65535, 57083, 40147, 21162, 4258, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 6339, 25388, 44405, 63390, 65535, 61277, 48631, 31727, 23275, 23243, 29582, 44373, 57051, 65535, 65535, 54938, 35921, 8452, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 8484, 38034, 57051, 65535, 61309, 42292, 25388, 10597, 4226, 4226, 8452, 16936, 33840, 59164, 65535, 65535, 46518, 12678, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 44405, 65503, 65535, 57083, 29614, 10565, 0, 0, 0, 0, 32, 19049, 54938, 65535, 65535, 52857, 14791, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 48599, 65535, 65535, 54970, 23243, 4226, 0, 0, 0, 0, 0, 12710, 52825, 65535, 65535, 54938, 16936, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10597, 46518, 65535, 65535, 57051, 25388, 6371, 0, 0, 0, 0, 0, 16904, 52857, 65535, 65535, 52857, 16936, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 10565, 44373, 63390, 65535, 59196, 38034, 16936, 32, 0, 0, 0, 8452, 27501, 57051, 65535, 65535, 50744, 14791, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 8452, 33840, 52857, 65535, 65503, 50744, 33840, 16904, 6371, 6371, 12710, 27469, 42292, 61309, 65535, 63390, 44373, 10597, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 4258, 21130, 40147, 61309, 65535, 65503, 57051, 44405, 38066, 38034, 42260, 52857, 61309, 65535, 65503, 48631, 29614, 6371, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 2113, 8484, 25388, 50712, 65503, 65535, 65535, 63390, 59164, 57083, 61277, 65535, 65535, 65535, 54938, 33808, 16904, 4226, 0, 0, 0, 0, 0, 0, 12678, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29614, 48631, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54970, 38034, 14791, 2113, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 14791, 29582, 46518, 57051, 59164, 59196, 61277, 59196, 57083, 50712, 35953, 21130, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 8452, 14791, 23243, 31727, 35953, 38034, 33808, 25388, 16936, 10565, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 12678, 16936, 16936, 12710, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16936, -2016, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29582, -2016, 33808, 14823, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 6339, 6339, 6339, 6339, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 14791, 27501, 2016, -2016, 2016, 2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 31727, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_music.c b/lv_app/lv_icon/x2/img_music.c deleted file mode 100644 index dfd7ec2c4..000000000 --- a/lv_app/lv_icon/x2/img_music.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_MUSIC != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_music [] = { /*Width = 33, Height = 32*/ -33, /*Width*/ -32, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 16904, 14791, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 12710, 12710, 27469, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 14823, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 32, 6339, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6339, 2113, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 6339, 25356, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 27469, 8452, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 10565, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 10565, 0, 0, 12678, 2016, -2016, 2016, 2016, 2016, 29614, 21162, 19017, 19017, 21162, 16936, 4258, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 21162, 19017, 19017, 21162, 16936, 4258, 0, 0, 12678, 2016, -2016, 2016, 23243, 8484, 6339, 4258, 4226, 4226, 4258, 4226, 32, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 8484, 6339, 4258, 4226, 4226, 4258, 4226, 32, 0, 0, 12678, 2016, -2016, 31695, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 31695, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -31695, 12710, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 31695, 12710, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, -21162, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 21162, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, -19049, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 19049, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, -27469, 8452, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016, 2016, 2016, 27469, 8452, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, -2016, 23243, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 23243, 2016, 2016, -2016, 2016, 16904, 4258, 2145, 2113, 32, 32, 2113, 2145, 6339, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 4258, 2145, 2113, 32, 32, 2113, 2145, 6339, 19017, 2016, 2016, 2016, -2016, 2016, 2016, 31695, 19017, 10565, 6371, 6371, 10565, 19017, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 19017, 10565, 6371, 6371, 10565, 19017, 33808, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 27501, 25356, 25356, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 25356, 25356, 27501, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_app/lv_icon/x2/img_video.c b/lv_app/lv_icon/x2/img_video.c deleted file mode 100644 index 96c34d31e..000000000 --- a/lv_app/lv_icon/x2/img_video.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "img_conf.h" -#include "lv_conf.h" - -#if USE_IMG_VIDEO != 0 || LV_APP_USE_INTERNAL_ICONS == 2 - -#include -#include "misc/others/color.h" - -const color_int_t img_video [] = { /*Width = 32, Height = 21*/ -32, /*Width*/ -21, /*Heigth*/ -16, /*Color depth = 16*/ -1, /*Flags: Transp = 1*/ -2016, 2016, 2016, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 29582, 19017, 14823, 12710, 12710, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 14791, 12710, 12710, 14791, 16936, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 21162, 8484, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 6371, 16904, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -19017, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 21162, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 31727, 4258, 10565, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 23275, 6339, 0, 10597, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 31727, 6371, 0, 0, 10597, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 23275, 8452, 32, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 2016, 2016, 8452, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 16936, 16936, 2145, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 21130, 21130, 6371, 0, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 2016, 2016, 19049, 4258, 0, 0, 0, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 19049, 6339, 0, 0, 10597, -14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 19049, 2145, 0, 10565, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 16936, 2113, 12678, -16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 16904, -23243, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 29614, -2016, 14823, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10565, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 33808, 14823, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 6371, 14791, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -2016, 2016, 2016, 2016, 2016, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, -}; - -#endif diff --git a/lv_appx/lv_app_example.c b/lv_appx/lv_app_example.c index 5e0224842..280ea0bb5 100644 --- a/lv_appx/lv_app_example.c +++ b/lv_appx/lv_app_example.c @@ -10,7 +10,6 @@ #if LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0 #include "../lv_app/lv_app_util/lv_app_kb.h" -#include "misc/os/ptask.h" #include /********************* @@ -42,7 +41,7 @@ typedef struct /********************** * STATIC PROTOTYPES **********************/ -static void my_app_run(lv_app_inst_t * app, const char * cstr); +static void my_app_run(lv_app_inst_t * app, const char * cstr, void * conf); static void my_app_close(lv_app_inst_t * app); static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t len); static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); @@ -93,9 +92,10 @@ const lv_app_dsc_t * lv_app_example_init(void) * Run an application according to 'app_dsc' * @param app_dsc pointer to an application descriptor * @param cstr a Create STRing which can give initial parameters to the application (NULL or "" if unused) + * @param conf pointer to a lv_app_example_conf_t structure with configuration data or NULL if unused * @return pointer to the opened application or NULL if any error occurred */ -static void my_app_run(lv_app_inst_t * app, const char * cstr) +static void my_app_run(lv_app_inst_t * app, const char * cstr, void * conf) { /*Initialize the application*/ if(cstr != NULL && cstr[0] != '\0') { @@ -218,7 +218,7 @@ static void kb_ok_action(lv_obj_t * ta) { lv_app_inst_t * app = lv_obj_get_free_p(ta); const char * txt = lv_ta_get_txt(ta); - lv_app_com_send(app, LV_APP_COM_TYPE_NOTICE, txt, strlen(txt) + 1); + lv_app_com_send(app, LV_APP_COM_TYPE_STR, txt, strlen(txt) + 1); } #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ diff --git a/lv_appx/lv_app_example.h b/lv_appx/lv_app_example.h index 65bb6c40e..038d917a3 100644 --- a/lv_appx/lv_app_example.h +++ b/lv_appx/lv_app_example.h @@ -28,6 +28,7 @@ typedef struct /********************** * GLOBAL PROTOTYPES **********************/ +const lv_app_dsc_t * lv_app_example_init(void); /********************** * MACROS diff --git a/lv_appx/lv_app_sysmon.c b/lv_appx/lv_app_sysmon.c new file mode 100644 index 000000000..d41b22c7c --- /dev/null +++ b/lv_appx/lv_app_sysmon.c @@ -0,0 +1,351 @@ +/** + * @file lv_app_sysmon.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "lv_app_sysmon.h" +#if LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0 + +#include +#include "misc/os/ptask.h" +#include "lvgl/lv_objx/lv_chart.h" +#include "lvgl/lv_app/lv_app_util/lv_app_notice.h" + +/********************* + * DEFINES + *********************/ +#define LV_APP_SYSMON_REFR_TIME 500 /*[ms]*/ +#define LV_APP_SYSMON_PNUM 64 +#define LV_APP_SYS_MON_PADDING (20 * LV_DOWNSCALE) +#define LV_APP_SYS_MEM_WARN (4 * 1024) +#define LV_APP_SYS_FRAG_WARN (70) /*[%]*/ + +/********************** + * TYPEDEFS + **********************/ + +/*Application specific data for an instance of this application*/ +typedef struct +{ + +}my_app_data_t; + +/*Application specific data a window of this application*/ +typedef struct +{ + lv_obj_t * chart; + cord_t * cpu_dl; + cord_t * mem_dl; + lv_obj_t * label; +}my_win_data_t; + +/*Application specific data for a shortcut of this application*/ +typedef struct +{ + lv_obj_t * pb_cpu; + lv_obj_t * pb_mem; +}my_sc_data_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static void my_app_run(lv_app_inst_t * app, const char * cstr, void * conf); +static void my_app_close(lv_app_inst_t * app); +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t len); +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc); +static void my_sc_close(lv_app_inst_t * app); +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); +static void my_win_close(lv_app_inst_t * app); + +static void sysmon_task(void); +static void lv_app_sysmon_refr(void); + +/********************** + * STATIC VARIABLES + **********************/ +static lv_app_dsc_t my_app_dsc = +{ + .name = "Sys. monitor", + .mode = LV_APP_MODE_NONE, + .app_run = my_app_run, + .app_close = my_app_close, + .com_rec = my_com_rec, + .win_open = my_win_open, + .win_close = my_win_close, + .sc_open = my_sc_open, + .sc_close = my_sc_close, + .app_data_size = sizeof(my_app_data_t), + .sc_data_size = sizeof(my_sc_data_t), + .win_data_size = sizeof(my_win_data_t), +}; + +static uint8_t mem_pct[LV_APP_SYSMON_PNUM]; +static uint8_t cpu_pct[LV_APP_SYSMON_PNUM]; +static lv_pbs_t cpu_pbs; +static lv_pbs_t mem_pbs; +static dm_mon_t mem_mon; + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +const lv_app_dsc_t * lv_app_sysmon_init(void) +{ + ptask_create(sysmon_task, LV_APP_SYSMON_REFR_TIME, PTASK_PRIO_LOW); + + memset(mem_pct, 0, sizeof(mem_pct)); + memset(cpu_pct, 0, sizeof(cpu_pct)); + + lv_pbs_get(LV_PBS_DEF, &cpu_pbs); + cpu_pbs.bg.gcolor = COLOR_MAKE(0xFF, 0xE0, 0xE0); + cpu_pbs.bg.objs.color = COLOR_MAKE(0xFF, 0xD0, 0xD0); + cpu_pbs.bg.bcolor = COLOR_MAKE(0xFF, 0x20, 0x20); + cpu_pbs.bg.bwidth = 1 * LV_DOWNSCALE; + + cpu_pbs.bar.gcolor = COLOR_MARRON; + cpu_pbs.bar.objs.color = COLOR_RED; + cpu_pbs.bar.bwidth = 0; + + cpu_pbs.label.objs.color = COLOR_MAKE(0x40, 0x00, 0x00); + cpu_pbs.label.font = LV_APP_FONT_MEDIUM; + cpu_pbs.label.line_space = 0; + cpu_pbs.label.mid = 1; + + memcpy(&mem_pbs, &cpu_pbs, sizeof(mem_pbs)); + mem_pbs.bg.gcolor = COLOR_MAKE(0xD0, 0xFF, 0xD0); + mem_pbs.bg.objs.color = COLOR_MAKE(0xE0, 0xFF, 0xE0); + mem_pbs.bg.bcolor = COLOR_MAKE(0x20, 0xFF, 0x20); + + mem_pbs.bar.gcolor = COLOR_GREEN; + mem_pbs.bar.objs.color = COLOR_LIME; + + mem_pbs.label.objs.color = COLOR_MAKE(0x00, 0x40, 0x00); + + return &my_app_dsc; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Run an application according to 'app_dsc' + * @param app_dsc pointer to an application descriptor + * @param cstr a Create STRing which can give initial parameters to the application (NULL or "" if unused) + * @param conf pointer to a lv_app_sysmon_conf_t structure with configuration data or NULL if unused + * @return pointer to the opened application or NULL if any error occurred + */ +static void my_app_run(lv_app_inst_t * app, const char * cstr, void * conf) +{ + +} + +/** + * Close a running application. + * Close the Window and the Shortcut too if opened. + * Free all the allocated memory by this application. + * @param app pointer to an application + */ +static void my_app_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_app_data'*/ +} + +/** + * Read the data have been sent to this application + * @param app_send pointer to an application which sent the message + * @param app_rec pointer to an application which is receiving the message + * @param type type of data from 'lv_app_com_type_t' enum + * @param data pointer to the sent data + * @param len length of 'data' in bytes + */ +static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, + lv_app_com_type_t type , const void * data, uint32_t len) +{ + if(type == LV_APP_COM_TYPE_STR) { /*data: string*/ + + } + else if(type == LV_APP_COM_TYPE_BIN) { /*data: array of 'int32_t' */ + + } + else if(type == LV_APP_COM_TYPE_TRIG) { /*data: ignored' */ + + } +} + +/** + * Open a shortcut for an application + * @param app pointer to an application + * @param sc pointer to an object where the application + * can create content of the shortcut + */ +static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) +{ + my_sc_data_t * sc_data = app->sc_data; + + cord_t w = lv_obj_get_width(sc) / 5; + + sc_data->pb_cpu = lv_pb_create(sc, NULL); + lv_obj_set_size(sc_data->pb_cpu, w, 5 * lv_obj_get_height(sc) / 8); + lv_obj_align(sc_data->pb_cpu, NULL, LV_ALIGN_IN_BOTTOM_LEFT, w, - lv_obj_get_height(sc) / 8); + lv_obj_set_style(sc_data->pb_cpu, &cpu_pbs); + lv_obj_set_click(sc_data->pb_cpu, false); + lv_pb_set_min_max_value(sc_data->pb_cpu, 0, 100); + lv_pb_set_format_str(sc_data->pb_cpu, "C\nP\nU"); + + sc_data->pb_mem = lv_pb_create(sc, sc_data->pb_cpu); + lv_obj_align(sc_data->pb_mem, sc_data->pb_cpu, LV_ALIGN_OUT_RIGHT_MID, w, 0); + lv_obj_set_style(sc_data->pb_mem, &mem_pbs); + lv_pb_set_format_str(sc_data->pb_mem, "M\ne\nm"); + + lv_app_sysmon_refr(); + +} + +/** + * Close the shortcut of an application + * @param app pointer to an application + */ +static void my_sc_close(lv_app_inst_t * app) +{ + /*No dynamically allocated data in 'my_sc_data'*/ +} + + +/** + * Open the application in a window + * @param app pointer to an application + * @param win pointer to a window object where + * the application can create content + */ +static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) +{ + my_win_data_t * win_data = app->win_data; + + win_data->chart = lv_chart_create(win, NULL); + lv_obj_set_size(win_data->chart, LV_HOR_RES / 2, LV_VER_RES / 2); + lv_chart_set_pnum(win_data->chart, LV_APP_SYSMON_PNUM); + lv_chart_set_range(win_data->chart, 0, 100); + lv_chart_set_type(win_data->chart, LV_CHART_LINE); + + win_data->cpu_dl = lv_chart_add_dataline(win_data->chart); + win_data->mem_dl = lv_chart_add_dataline(win_data->chart); + + uint16_t i; + for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) { + win_data->cpu_dl[i] = cpu_pct[i]; + win_data->mem_dl[i] = mem_pct[i]; + } + + lv_app_style_t * app_style = lv_app_style_get(); + win_data->label = lv_label_create(win, NULL); + lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_MID, LV_APP_SYS_MON_PADDING, 0); + lv_obj_set_style(win_data->label, &app_style->win_txt_style); + + lv_app_sysmon_refr(); +} + +/** + * Close the window of an application + * @param app pointer to an application + */ +static void my_win_close(lv_app_inst_t * app) +{ + +} + +/*-------------------- + * OTHER FUNCTIONS + ---------------------*/ +static void sysmon_task(void) +{ + + /*Shift out the oldest data*/ + uint16_t i; + for(i = 1; i < LV_APP_SYSMON_PNUM; i++) { + mem_pct[i - 1] = mem_pct[i]; + cpu_pct[i - 1] = cpu_pct[i]; + } + + uint8_t cpu_busy = 0; +#if USE_IDLE != 0 + cpu_busy = 100 - idle_get(); +#endif + + dm_monitor(&mem_mon); + uint8_t mem_free_pct = (uint32_t) ((DM_MEM_SIZE - mem_mon.size_free) * 100 ) / DM_MEM_SIZE; + + cpu_pct[LV_APP_SYSMON_PNUM - 1] = cpu_busy; + mem_pct[LV_APP_SYSMON_PNUM - 1] = mem_free_pct; + + lv_app_sysmon_refr(); + + static bool mem_warn_report = false; + if(mem_mon.size_free < LV_APP_SYS_MEM_WARN && mem_warn_report == false) { + mem_warn_report = true; + lv_app_notice_add("Critically low memory"); + } + + if(mem_mon.size_free > LV_APP_SYS_MEM_WARN) { + mem_warn_report = false; + } + + static bool frag_warn_report = false; + if(mem_mon.pct_frag > LV_APP_SYS_FRAG_WARN && frag_warn_report == false) { + frag_warn_report = true; + lv_app_notice_add("Critically memory fragmentation"); + } + + if(mem_mon.pct_frag < LV_APP_SYS_FRAG_WARN) { + frag_warn_report = false; + } + +} + + +static void lv_app_sysmon_refr(void) +{ + char buf_long[256]; + sprintf(buf_long, "CPU: %d %%\n\nMEMORY: %d %%\nTotal: %d bytes\nUsed: %d bytes\nFree: %d bytes\nFrag: %d %%", + cpu_pct[LV_APP_SYSMON_PNUM - 1], + mem_pct[LV_APP_SYSMON_PNUM - 1], + DM_MEM_SIZE, + DM_MEM_SIZE - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag); + + char buf_short[128]; + sprintf(buf_short, "CPU: %d %%\nMem: %d %%\nFrag: %d %%", + cpu_pct[LV_APP_SYSMON_PNUM - 1], mem_pct[LV_APP_SYSMON_PNUM - 1], mem_mon.pct_frag); + + lv_app_inst_t * app; + app = lv_app_get_next(NULL, &my_app_dsc); + while(app != NULL) { + /*Refresh the windows*/ + my_win_data_t * win_data = app->win_data; + if(win_data != NULL) { + lv_label_set_text(win_data->label, buf_long); + lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_TOP, LV_APP_SYS_MON_PADDING, 0); + + lv_chart_set_next(win_data->chart, win_data->mem_dl, mem_pct[LV_APP_SYSMON_PNUM - 1]); + lv_chart_set_next(win_data->chart, win_data->cpu_dl, cpu_pct[LV_APP_SYSMON_PNUM - 1]); + + } + /*Refresh the shortcut*/ + my_sc_data_t * sc_data = app->sc_data; + if(sc_data != NULL) { + lv_pb_set_value(sc_data->pb_cpu, cpu_pct[LV_APP_SYSMON_PNUM - 1]); + lv_pb_set_value(sc_data->pb_mem, mem_pct[LV_APP_SYSMON_PNUM - 1]); + } + + lv_app_com_send(app, LV_APP_COM_TYPE_STR, buf_short, strlen(buf_short)); + + app = lv_app_get_next(app, &my_app_dsc); + } +} +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0*/ diff --git a/lv_appx/lv_app_sysmon.h b/lv_appx/lv_app_sysmon.h new file mode 100644 index 000000000..3f6a83fa2 --- /dev/null +++ b/lv_appx/lv_app_sysmon.h @@ -0,0 +1,39 @@ +/** + * @file lv_app_example.h + * + */ + +#ifndef LV_APP_SYSMON_H +#define LV_APP_SYSMON_H + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lv_app/lv_app.h" + +#if LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ +typedef struct +{ + +}lv_app_sysmon_conf_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ +const lv_app_dsc_t * lv_app_sysmon_init(void); + +/********************** + * MACROS + **********************/ + +#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_SYSMON != 0*/ + +#endif /* LV_APP_SYSMON_H */ diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 73b7c5dff..24b430319 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -160,7 +160,6 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p, col_bit = 7; col_byte_cnt ++; map_p ++; - } } diff --git a/lv_app/lv_icon/x2/img_add.c b/lv_icon/x2/img_add.c similarity index 100% rename from lv_app/lv_icon/x2/img_add.c rename to lv_icon/x2/img_add.c diff --git a/lv_app/lv_icon/x2/img_bubble.c b/lv_icon/x2/img_bubble.c similarity index 100% rename from lv_app/lv_icon/x2/img_bubble.c rename to lv_icon/x2/img_bubble.c diff --git a/lv_app/lv_icon/x2/img_calendar.c b/lv_icon/x2/img_calendar.c similarity index 100% rename from lv_app/lv_icon/x2/img_calendar.c rename to lv_icon/x2/img_calendar.c diff --git a/lv_app/lv_icon/x2/img_clock.c b/lv_icon/x2/img_clock.c similarity index 100% rename from lv_app/lv_icon/x2/img_clock.c rename to lv_icon/x2/img_clock.c diff --git a/lv_app/lv_icon/x2/img_close.c b/lv_icon/x2/img_close.c similarity index 100% rename from lv_app/lv_icon/x2/img_close.c rename to lv_icon/x2/img_close.c diff --git a/lv_app/lv_icon/x2/img_down.c b/lv_icon/x2/img_down.c similarity index 100% rename from lv_app/lv_icon/x2/img_down.c rename to lv_icon/x2/img_down.c diff --git a/lv_app/lv_icon/x2/img_driver.c b/lv_icon/x2/img_driver.c similarity index 100% rename from lv_app/lv_icon/x2/img_driver.c rename to lv_icon/x2/img_driver.c diff --git a/lv_app/lv_icon/x2/img_eject.c b/lv_icon/x2/img_eject.c similarity index 100% rename from lv_app/lv_icon/x2/img_eject.c rename to lv_icon/x2/img_eject.c diff --git a/lv_icon/x2/img_file.c b/lv_icon/x2/img_file.c new file mode 100644 index 000000000..4e4026be8 --- /dev/null +++ b/lv_icon/x2/img_file.c @@ -0,0 +1,50 @@ +#include "img_conf.h" +#include "lv_conf.h" + +#if USE_IMG_FILE != 0 || LV_APP_USE_INTERNAL_ICONS == 2 + +#include +#include "misc/others/color.h" + + +const color_int_t img_file [] = { /*Width = 24, Height = 33*/ +24, /*Width*/ +33, /*Heigth*/ +16, /*Color depth = 16*/ +1, /*Flags: Transp = 1*/ +2016, 31695, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +27469, 12678, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12678, 12678, 19017, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +19017, 2113, 2113, 2113, 32, 0, 0, 0, 0, 0, 2113, 4226, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +14791, 0, 0, 0, 4226, 6339, 6339, 6339, 6371, 4258, 0, 0, 0, 6371, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +14823, 0, 0, 4258, 23275, 33808, 33808, 33808, 35921, 25388, 6371, 0, 4226, 6339, 6371, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 8484, 38066, 52857, 52825, 52857, 54970, 40179, 10565, 2145, 19017, 19049, 4226, 6371, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 10597, 46518, 63422, 63422, 65503, 65535, 48631, 10597, 8484, 42260, 46486, 19017, 6339, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52857, 12678, 10597, 52825, 61309, 38066, 19017, 2145, 6339, 27501, 2016, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 61277, 44405, 19017, 4258, 6339, 19017, 2016, 2016, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 65535, 61309, 38066, 19049, 4226, 6371, 27501, 2016, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50744, 65535, 65535, 65535, 63390, 48599, 21162, 8452, 6371, 19049, 2016, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 8452, 42260, 57083, 57083, 59164, 61277, 50712, 27469, 10565, 0, 4226, 27501, 2016, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 32, 19049, 29582, 29582, 29614, 29614, 27469, 21130, 10597, 32, 0, 4258, 23275, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 54938, 21162, 8484, 19017, 23243, 23243, 23243, 23243, 23243, 25356, 19017, 4226, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 59196, 42260, 33808, 35921, 35953, 35953, 35953, 35953, 38034, 40147, 29614, 8452, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 63422, 54970, 50744, 50712, 50712, 50712, 50712, 50712, 50744, 52857, 40179, 12678, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 63422, 63390, 63390, 63390, 63390, 63390, 63390, 63422, 65535, 50712, 14823, 0, 0, 10597, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678, +16904, 0, 0, 12678, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57051, 16904, 0, 0, 12678, +16904, 0, 0, 10565, 42292, 59164, 59164, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 59164, 61309, 46518, 14791, 0, 0, 12678, +16904, 0, 0, 4258, 23275, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33840, 25388, 8452, 0, 0, 12678, +14823, 0, 0, 32, 8484, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 10565, 2113, 0, 0, 10597, +12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, +23243, 6371, 6371, 6371, 6371, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6371, 6371, 6371, 4226, 19017, +2016, 31727, 33808, 33808, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33808, 31727, 31695, 2016, +}; + +#endif diff --git a/lv_app/lv_icon/x2/img_folder.c b/lv_icon/x2/img_folder.c similarity index 100% rename from lv_app/lv_icon/x2/img_folder.c rename to lv_icon/x2/img_folder.c diff --git a/lv_app/lv_icon/x2/img_left.c b/lv_icon/x2/img_left.c similarity index 100% rename from lv_app/lv_icon/x2/img_left.c rename to lv_icon/x2/img_left.c diff --git a/lv_app/lv_icon/x2/img_ok.c b/lv_icon/x2/img_ok.c similarity index 100% rename from lv_app/lv_icon/x2/img_ok.c rename to lv_icon/x2/img_ok.c diff --git a/lv_app/lv_icon/x2/img_play.c b/lv_icon/x2/img_play.c similarity index 100% rename from lv_app/lv_icon/x2/img_play.c rename to lv_icon/x2/img_play.c diff --git a/lv_app/lv_icon/x2/img_right.c b/lv_icon/x2/img_right.c similarity index 100% rename from lv_app/lv_icon/x2/img_right.c rename to lv_icon/x2/img_right.c diff --git a/lv_app/lv_icon/x2/img_settings.c b/lv_icon/x2/img_settings.c similarity index 100% rename from lv_app/lv_icon/x2/img_settings.c rename to lv_icon/x2/img_settings.c diff --git a/lv_app/lv_icon/x2/img_shut_down.c b/lv_icon/x2/img_shut_down.c similarity index 100% rename from lv_app/lv_icon/x2/img_shut_down.c rename to lv_icon/x2/img_shut_down.c diff --git a/lv_app/lv_icon/x2/img_star.c b/lv_icon/x2/img_star.c similarity index 100% rename from lv_app/lv_icon/x2/img_star.c rename to lv_icon/x2/img_star.c diff --git a/lv_app/lv_icon/x2/img_up.c b/lv_icon/x2/img_up.c similarity index 100% rename from lv_app/lv_icon/x2/img_up.c rename to lv_icon/x2/img_up.c diff --git a/lv_app/lv_icon/x2/img_user.c b/lv_icon/x2/img_user.c similarity index 100% rename from lv_app/lv_icon/x2/img_user.c rename to lv_icon/x2/img_user.c diff --git a/lv_app/lv_icon/x2/img_volume.c b/lv_icon/x2/img_volume.c similarity index 100% rename from lv_app/lv_icon/x2/img_volume.c rename to lv_icon/x2/img_volume.c diff --git a/lv_misc/anim.c b/lv_misc/anim.c index cdd2bfa59..161c30e9a 100644 --- a/lv_misc/anim.c +++ b/lv_misc/anim.c @@ -83,7 +83,7 @@ void anim_create(anim_t * anim_p) memcpy(new_anim, anim_p, sizeof(anim_t)); /*Set the start value*/ - new_anim->fp(new_anim->var, new_anim->start); + if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start); } /** @@ -191,7 +191,7 @@ static void anim_task (void) new_val = new_val >> ANIM_PATH_NORM_SHIFT; new_val += a->start; - a->fp(a->var, new_val); /*Apply the calculated value*/ + if(a->fp != NULL) a->fp(a->var, new_val); /*Apply the calculated value*/ /*If the time is elapsed the animation is ready*/ if(a->act_time >= a->time) { diff --git a/lv_misc/font.h b/lv_misc/font.h index 3fb8e4376..eec23cbe5 100644 --- a/lv_misc/font.h +++ b/lv_misc/font.h @@ -11,6 +11,7 @@ *********************/ #include "lv_conf.h" #include +#include /********************* * DEFINES @@ -77,6 +78,8 @@ const font_t * font_get(font_types_t letter); */ static inline const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter) { + if(letter < font_p->start_ascii || letter >= font_p->start_ascii + font_p->letter_cnt) return NULL; + uint32_t index = (letter - font_p->start_ascii) * font_p->height_row * font_p->width_byte; return &font_p->bitmaps_a[index]; } diff --git a/lv_misc/fonts/dejavu_40.c b/lv_misc/fonts/dejavu_40.c index ba6b894db..1a34d8296 100644 --- a/lv_misc/fonts/dejavu_40.c +++ b/lv_misc/fonts/dejavu_40.c @@ -3258,21 +3258,21 @@ static const uint8_t dejavu_40_bitmaps[35840] = 0x1d, 0xfe, 0x3f, 0x80, // ---OOO-OOOOOOOO---OOOOOOO-----.. 0x1f, 0xfe, 0x7f, 0xc0, // ---OOOOOOOOOOOO--OOOOOOOOO----.. 0x1e, 0x0f, 0xc1, 0xe0, // ---OOOO-----OOOOOO-----OOOO---.. - 0x1e, 0x07, 0x80, 0xe0, // ---OOOO------OOOO-------OOO---.. - 0x1c, 0x07, 0x80, 0xe0, // ---OOO-------OOOO-------OOO---.. + 0x1e, 0x07, 0xC0, 0xe0, // ---OOOO------OOOOO------OOO---.. + 0x1c, 0x07, 0xC0, 0xe0, // ---OOO-------OOOOO------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. + 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. 0x1c, 0x03, 0x80, 0xe0, // ---OOO--------OOO-------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. - 0x1c, 0x03, 0x00, 0xe0, // ---OOO--------OO--------OOO---.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. 0x00, 0x00, 0x00, 0x00, // ------------------------------.. @@ -9497,4 +9497,4 @@ const font_t * dejavu_40_get_dsc(void) } -#endif \ No newline at end of file +#endif diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 1cbe9d16f..7aa2fa049 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -1041,8 +1041,6 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t bool out = (type & ANIM_DIR_MASK) == ANIM_IN ? false : true; type = type & (~ANIM_DIR_MASK); - if(type == LV_ANIM_NONE) return; - anim_t a; a.var = obj; a.time = time; @@ -1091,6 +1089,11 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t a.start = 0; a.end = lv_obj_get_height(obj); break; + case LV_ANIM_NONE: + a.fp = NULL; + a.start = 0; + a.end = 0; + break; default: break; } diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index 759c3681b..90222ec44 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -138,11 +138,17 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void* param) case LV_SIGNAL_PRESS_LOST: /*Refresh the state*/ - if(ext->state == LV_BTN_STATE_PR) { - lv_btn_set_state(btn, LV_BTN_STATE_REL); - } else if(ext->state == LV_BTN_STATE_TGL_PR) { - lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); - }lv_obj_inv(btn); + if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); + else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); + + lv_obj_inv(btn); + break; + case LV_SIGNAL_PRESSING: + if(lv_dispi_is_dragging(param) != false) { + if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); + else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL); + } + lv_obj_inv(btn); break; case LV_SIGNAL_RELEASED: @@ -218,9 +224,10 @@ void lv_btn_set_tgl(lv_obj_t * btn, bool tgl) void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state) { lv_btn_ext_t * ext = lv_obj_get_ext(btn); - - ext->state = state; - lv_obj_inv(btn); + if(ext->state != state) { + ext->state = state; + lv_obj_inv(btn); + } } /** @@ -467,7 +474,7 @@ static void lv_btns_init(void) lv_btns_def.rects.round = 4 * LV_DOWNSCALE; lv_btns_def.rects.hpad = 10 * LV_DOWNSCALE; lv_btns_def.rects.vpad = 15 * LV_DOWNSCALE; - lv_btns_def.rects.opad = 5 * LV_DOWNSCALE; + lv_btns_def.rects.opad = 10 * LV_DOWNSCALE; /*Transparent style*/ memcpy(&lv_btns_transp, &lv_btns_def, sizeof(lv_btns_t)); @@ -501,7 +508,6 @@ static void lv_btns_init(void) lv_btns_border.rects.round = 4 * LV_DOWNSCALE; lv_btns_border.rects.hpad = 10 * LV_DOWNSCALE; lv_btns_border.rects.vpad = 10 * LV_DOWNSCALE; - lv_btns_border.rects.vpad = 5 * LV_DOWNSCALE; } #endif diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index 2041e5f49..4cc9c9b87 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -40,6 +40,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask); * STATIC VARIABLES **********************/ static lv_charts_t lv_charts_def; +static lv_charts_t lv_charts_transp; static lv_design_f_t ancestor_design_fp; /********************** @@ -138,7 +139,7 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param) } /** - * Allocate and add a data line t the chart + * Allocate and add a data line to the chart * @param chart pointer to a chart object * @return pointer to the allocated data lie (an array for the data points) */ @@ -289,6 +290,9 @@ lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy) case LV_CHARTS_DEF: style_p = &lv_charts_def; break; + case LV_CHARTS_TRANSP: + style_p = &lv_charts_transp; + break; default: style_p = &lv_charts_def; } @@ -382,14 +386,16 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask) lv_chart_ext_t * ext = lv_obj_get_ext(chart); lv_charts_t * style = lv_obj_get_style(chart); + if(style->div_lines.objs.transp != 0) return; + uint8_t div_i; point_t p1; point_t p2; cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t div_opa = (uint16_t)lv_obj_get_opa(chart) * style->div_line_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; p1.x = 0 + x_ofs; p2.x = w + x_ofs; for(div_i = 1; div_i <= ext->hdiv_num; div_i ++) { @@ -424,8 +430,8 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask) cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; int32_t y_tmp; cord_t ** y_data; uint8_t dl_cnt = 0; @@ -447,7 +453,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask) p1.x = p2.x; p1.y = p2.y; - p2.x = (w / (ext->pnum - 1)) * i + x_ofs; + p2.x = ((w * i) / (ext->pnum - 1)) + x_ofs; y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h; y_tmp = y_tmp / (ext->ymax - ext->ymin); @@ -474,8 +480,8 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask) cord_t w = lv_obj_get_width(chart); cord_t h = lv_obj_get_height(chart); opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100; - cord_t x_ofs = lv_obj_get_x(chart); - cord_t y_ofs = lv_obj_get_y(chart); + cord_t x_ofs = chart->cords.x1; + cord_t y_ofs = chart->cords.y1; int32_t y_tmp; cord_t ** y_data; uint8_t dl_cnt = 0; @@ -493,7 +499,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask) rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff); for(i = 0; i < ext->pnum; i ++) { - cir_a.x1 = (w / (ext->pnum - 1)) * i + x_ofs; + cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs; cir_a.x2 = cir_a.x1 + rad; cir_a.x1 -= rad; @@ -530,8 +536,8 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask) cord_t ** y_data; uint8_t dl_cnt = 0; lv_rects_t rects; - cord_t x_ofs = w / ((ext->dl_num + 1) * ext->pnum) / 2; /*Shift with a half col.*/ - + cord_t col_w = w / (2 * ext->dl_num * ext->pnum); /* Suppose (2 * dl_num) * pnum columns*/ + cord_t x_ofs = col_w / 2; /*Shift with a half col.*/ lv_rects_get(LV_RECTS_DEF, &rects); rects.bwidth = 0; rects.empty = 0; @@ -545,12 +551,16 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask) rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff); for(i = 0; i < ext->pnum; i ++) { - /*Calculate the x coordinates. Suppose (dl_num + 1) * pnum columns */ - col_a.x1 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt)) / - (ext->pnum * (ext->dl_num + 1)) + chart->cords.x1; - col_a.x2 = (int32_t)((int32_t)w * (i * (ext->dl_num + 1) + dl_cnt + 1 )) / - (ext->pnum * (ext->dl_num + 1)) + chart->cords.x1 - 1; + /* Calculate the x coordinates. Suppose (2 * dl_num) * pnum columns and draw to every second + * the other columns will be spaces. + * col_w = w / (2 * ext->dl_num * ext->pnum) + * act_col_x = col_w * i * ext->dl_num * 2 + 2 * dl_cnt + * Reorder the operation to multiply first*/ + col_a.x1 = (int32_t)((int32_t) w * ((i * ext->dl_num * 2) + (2 * dl_cnt))) / + (ext->pnum * 2 * ext->dl_num); + col_a.x1 += chart->cords.x1; + col_a.x2 = col_a.x1 + col_w; col_a.x1 += x_ofs; col_a.x2 += x_ofs; @@ -587,17 +597,23 @@ static void lv_charts_init(void) lv_charts_def.div_line_opa = OPA_COVER; /*Data lines*/ - lv_charts_def.width = 3 * LV_DOWNSCALE; + lv_charts_def.width = 2 * LV_DOWNSCALE; lv_charts_def.data_opa = 100; lv_charts_def.dark_eff = 150; lv_charts_def.color[0] = COLOR_RED; - lv_charts_def.color[1] = COLOR_LIME; + lv_charts_def.color[1] = COLOR_GREEN; lv_charts_def.color[2] = COLOR_BLUE; lv_charts_def.color[3] = COLOR_MAGENTA; lv_charts_def.color[4] = COLOR_CYAN; lv_charts_def.color[5] = COLOR_YELLOW; lv_charts_def.color[6] = COLOR_WHITE; lv_charts_def.color[7] = COLOR_GRAY; + + + memcpy(&lv_charts_transp, &lv_charts_def, sizeof(lv_charts_t)); + lv_charts_transp.bg_rects.empty = 1; + lv_charts_transp.bg_rects.bwidth = 0; + lv_charts_transp.div_lines.objs.transp = 1; } #endif diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index 25182cfdd..a3d612118 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -10,7 +10,7 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_CHARTBG != 0 +#if USE_LV_CHART != 0 #include "../lv_obj/lv_obj.h" #include "lv_rect.h" @@ -49,6 +49,7 @@ typedef struct typedef enum { LV_CHARTS_DEF, + LV_CHARTS_TRANSP, }lv_charts_builtin_t; /*Data of chart background*/ diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index f4ad85e46..bf17082fb 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -249,6 +249,17 @@ lv_list_fit_t lv_list_get_fit(lv_obj_t * list) return LV_EA(list, lv_list_ext_t)->fit; } +/** + * Get the text of a list element + * @param liste pointer to list element + * @return pointer to the text + */ +const char * lv_list_element_get_txt(lv_obj_t * liste) +{ + /*The last child is the label*/ + lv_obj_t * label = lv_obj_get_child(liste, NULL); + return lv_label_get_text(label); +} /** * Return with a pointer to a built-in style and/or copy it to a variable diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 97755d972..b2b32cc3b 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -72,6 +72,7 @@ void lv_list_down(lv_obj_t * list); void lv_list_up(lv_obj_t * list); void lv_list_set_fit(lv_obj_t * list, lv_list_fit_t fit); lv_list_fit_t lv_list_get_fit(lv_obj_t * list); +const char * lv_list_element_get_txt(lv_obj_t * liste); /********************** * MACROS diff --git a/lv_objx/lv_pb.c b/lv_objx/lv_pb.c index 159ba1b6a..8491124ce 100644 --- a/lv_objx/lv_pb.c +++ b/lv_objx/lv_pb.c @@ -71,6 +71,9 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) ancestor_design_fp = lv_obj_get_design_f(new_pb); } + lv_obj_set_signal_f(new_pb, lv_pb_signal); + lv_obj_set_design_f(new_pb, lv_pb_design); + /*Init the new progress bar object*/ if(copy == NULL) { ext->format_str = dm_alloc(strlen(LV_PB_DEF_FORMAT) + 1); @@ -79,12 +82,10 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) ext->max_value = 100; ext->act_value = 0; - lv_label_create(new_pb, NULL); + ext->label = lv_label_create(new_pb, NULL); lv_rect_set_layout(new_pb, LV_RECT_LAYOUT_CENTER); - lv_obj_set_signal_f(new_pb, lv_pb_signal); lv_obj_set_style(new_pb, lv_pbs_get(LV_PBS_DEF, NULL)); - lv_obj_set_design_f(new_pb, lv_pb_design); lv_pb_set_value(new_pb, ext->act_value); } else { @@ -95,6 +96,12 @@ lv_obj_t * lv_pb_create(lv_obj_t * par, lv_obj_t * copy) ext->max_value = ext_copy->max_value; ext->act_value = ext_copy->act_value; + ext->label = lv_label_create(new_pb, ext_copy->label); + + lv_obj_set_style(new_pb, lv_obj_get_style(copy)); + + lv_pb_set_value(new_pb, ext->act_value); + } return new_pb; } @@ -116,6 +123,7 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param) * make the object specific signal handling */ if(valid != false) { lv_pb_ext_t * ext = lv_obj_get_ext(pb); + lv_pbs_t * style = lv_obj_get_style(pb); switch(sign) { case LV_SIGNAL_CORD_CHG: @@ -124,6 +132,10 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param) case LV_SIGNAL_CLEANUP: dm_free(ext->format_str); break; + case LV_SIGNAL_STYLE_CHG: + lv_obj_set_style(ext->label, &style->label); + lv_pb_set_value(pb, lv_pb_get_value(pb)); + break; default: break; } @@ -148,7 +160,7 @@ void lv_pb_set_value(lv_obj_t * pb, uint16_t value) char buf[LV_PB_TXT_MAX_LENGTH]; sprintf(buf, ext->format_str, ext->act_value); - lv_label_set_text(lv_obj_get_child(pb, NULL), buf); + lv_label_set_text(ext->label, buf); lv_obj_inv(pb); } @@ -263,10 +275,19 @@ static bool lv_pb_design(lv_obj_t * pb, const area_t * mask, lv_design_mode_t mo area_t bar_area; uint32_t tmp; area_cpy(&bar_area, &pb->cords); - tmp = (uint32_t)ext->act_value * lv_obj_get_width(pb); - tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); - bar_area.x2 = bar_area.x1 + (cord_t) tmp; + cord_t w = lv_obj_get_width(pb); + cord_t h = lv_obj_get_height(pb); + + if(w >= h) { + tmp = (uint32_t)ext->act_value * w; + tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); + bar_area.x2 = bar_area.x1 + (cord_t) tmp; + } else { + tmp = (uint32_t)ext->act_value * h; + tmp = (uint32_t) tmp / (ext->max_value - ext->min_value); + bar_area.y1 = bar_area.y2 - (cord_t) tmp; + } lv_pbs_t * style_p = lv_obj_get_style(pb); lv_draw_rect(&bar_area, mask, &style_p->bar, OPA_COVER); } @@ -291,6 +312,7 @@ static void lv_pbs_init(void) lv_labels_get(LV_LABELS_DEF, &lv_pbs_def.label); lv_pbs_def.label.objs.color = COLOR_MAKE(0x20, 0x20, 0x20); + lv_pbs_def.label.line_space = 0; } #endif diff --git a/lv_objx/lv_pb.h b/lv_objx/lv_pb.h index 4f50da372..69e43ed24 100644 --- a/lv_objx/lv_pb.h +++ b/lv_objx/lv_pb.h @@ -43,6 +43,7 @@ typedef struct { lv_rect_ext_t rect_ext; /*Ext. of ancestor*/ /*New data for this type */ + lv_obj_t * label; uint16_t act_value; uint16_t min_value; uint16_t max_value;