lv_app_notice: max notice num added
This commit is contained in:
@@ -18,6 +18,18 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
/*Add the required configurations*/
|
||||||
|
#ifndef LV_APP_NOTICE_SHOW_TIME
|
||||||
|
#define LV_APP_NOTICE_SHOW_TIME 4000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LV_APP_NOTICE_MAX_NUM
|
||||||
|
#define LV_APP_NOTICE_MAX_NUM 6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LV_APP_NOTICE_MAX_LEN
|
||||||
|
#define LV_APP_NOTICE_MAX_LEN 256
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@@ -81,6 +93,14 @@ lv_obj_t * lv_app_notice_add(const char * format, ...)
|
|||||||
lv_mbox_start_auto_close(mbox, LV_APP_NOTICE_SHOW_TIME);
|
lv_mbox_start_auto_close(mbox, LV_APP_NOTICE_SHOW_TIME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*Delete the last children if there are too many*/
|
||||||
|
uint32_t child_num = lv_obj_get_child_num(notice_h);
|
||||||
|
if(child_num > LV_APP_NOTICE_MAX_NUM) {
|
||||||
|
lv_obj_t * last_child = ll_get_tail(¬ice_h->child_ll);
|
||||||
|
lv_obj_del(last_child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*make sure the notices are on the top*/
|
||||||
lv_obj_set_parent(notice_h, lv_scr_act());
|
lv_obj_set_parent(notice_h, lv_scr_act());
|
||||||
|
|
||||||
return mbox;
|
return mbox;
|
||||||
|
|||||||
@@ -194,6 +194,7 @@
|
|||||||
|
|
||||||
/* App. utility settings */
|
/* App. utility settings */
|
||||||
#define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/
|
#define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/
|
||||||
|
#define LV_APP_NOTICE_MAX_NUM 6 /*Max. number of notices*/
|
||||||
#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/
|
#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/
|
||||||
/*==================
|
/*==================
|
||||||
* LV APP X USAGE
|
* LV APP X USAGE
|
||||||
|
|||||||
Reference in New Issue
Block a user