From fc5e147fcf304131507a5cc9080561242cbe74f5 Mon Sep 17 00:00:00 2001 From: Kiss-Vamosi Gabor Date: Fri, 30 Dec 2016 21:48:58 +0100 Subject: [PATCH] LV_APP_COM_TYPE_... reworked, minor updates --- lv_app/lv_app.c | 53 ++++++++++++++------- lv_app/lv_app.h | 13 +++-- lv_app/lv_app_util/lv_app_notice.c | 2 +- lv_appx/lv_app_example.c | 28 +++++------ lv_appx/lv_app_example.h | 2 +- lv_appx/lv_app_sysmon.c | 76 +++++++++++++++++------------- lv_misc/anim.h | 3 +- lv_objx/lv_pb.c | 1 + 8 files changed, 106 insertions(+), 72 deletions(-) diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index a3ef697a4..67b208619 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -17,6 +17,7 @@ #include "../lv_appx/lv_app_example.h" #include "../lv_appx/lv_app_sysmon.h" +#include "../lv_appx/lv_app_terminal.h" /********************* * DEFINES @@ -49,6 +50,7 @@ static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app); static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app); #if LV_APP_EFFECT_ANIM != 0 && LV_APP_ANIM_WIN != 0 static void lv_app_win_close_anim_cb(lv_obj_t * app_win); +static void lv_app_win_minim_anim_cb(lv_obj_t * app_win); #endif static void lv_app_init_icons(void); @@ -134,6 +136,11 @@ void lv_app_init(void) dsc = ll_ins_head(&app_dsc_ll); *dsc = lv_app_sysmon_init(); #endif + +#if USE_LV_APP_TERMINAL != 0 + dsc = ll_ins_head(&app_dsc_ll); + *dsc = lv_app_terminal_init(); +#endif } /** @@ -168,10 +175,17 @@ void lv_app_close(lv_app_inst_t * app) lv_app_win_close(app); lv_app_sc_close(app); + /*Clear the connection list*/ + lv_app_con_del(app, NULL); + lv_app_con_del(NULL, app); + app->dsc->app_close(app); dm_free(app->app_data); dm_free(app->name); + + ll_rem(&app_inst_ll, app); + dm_free(app); } /** @@ -246,7 +260,6 @@ void lv_app_sc_close(lv_app_inst_t * app) */ lv_obj_t * lv_app_win_open(lv_app_inst_t * app) { - /*Close the app list if opened*/ if(app_list != NULL) { lv_obj_del(app_list); @@ -290,23 +303,20 @@ void lv_app_win_close(lv_app_inst_t * app) * @param app_send pointer to the application which is sending 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 + * @param size length of 'data' in bytes * @return number application which were received the message */ -uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t len) +uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t size) { + if(type == LV_APP_COM_TYPE_INV) return 0; + lv_app_con_t * con; uint16_t rec_cnt = 0; - /*Add the notifications to the notice utility*/ - if(type == LV_APP_COM_TYPE_NOTICE) { - lv_app_notice_add(data); - } - LL_READ(app_con_ll, con) { if(con->sender == app_send) { if(con->receiver->dsc->com_rec != NULL) - con->receiver->dsc->com_rec(app_send, con->receiver, type, data, len); + con->receiver->dsc->com_rec(app_send, con->receiver, type, data, size); rec_cnt ++; } } @@ -350,15 +360,16 @@ void lv_app_con_set(lv_app_inst_t * sender, lv_app_inst_t * receiver) /** * Delete a communication connection - * @param sender pointer to a data sender application - * @param receiver pointer to a data receiver application + * @param sender pointer to a data sender application or NULL to be true for all sender + * @param receiver pointer to a data receiver application or NULL to be true for all receiver */ void lv_app_con_del(lv_app_inst_t * sender, lv_app_inst_t * receiver) { lv_app_con_t * con; LL_READ(app_con_ll, con) { - if(con->sender == sender && con->receiver == receiver) { + if((con->sender == sender || sender == NULL) && + (con->receiver == receiver || receiver == NULL)) { ll_rem(&app_con_ll, con); dm_free(con); } @@ -444,7 +455,7 @@ lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc) /** * Refresh the style of the applications * */ -void lv_app_refr_style(void) +void lv_app_style_refr(void) { lv_style_refr_all(NULL); @@ -510,7 +521,7 @@ static void lv_app_init_desktop(void) */ lv_obj_align(sys_apph, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); - lv_app_refr_style(); + lv_app_style_refr(); } /*----------------------- @@ -720,6 +731,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_FLOAT_BOTTOM | ANIM_OUT, LV_APP_ANIM_WIN, 0, NULL); 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*/ @@ -854,7 +866,7 @@ 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; - a.end_cb = (void (*)(void *))lv_app_win_close_anim_cb; + a.end_cb = (void (*)(void *))lv_app_win_minim_anim_cb; anim_create(&a); return LV_ACTION_RES_OK; @@ -866,10 +878,19 @@ static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app) #if LV_APP_EFFECT_ANIM != 0 /** - * Called when the window close or minimization animation is ready to close the window + * Called when the window close animation is ready to close the application * @param app_win pointer to a window */ static void lv_app_win_close_anim_cb(lv_obj_t * app_win) +{ + lv_app_inst_t * app = lv_obj_get_free_p(app_win); + lv_app_close(app); +} +/** + * Called when the window minimization animation is ready to close the window + * @param app_win pointer to a window + */ +static void lv_app_win_minim_anim_cb(lv_obj_t * app_win) { lv_app_inst_t * app = lv_obj_get_free_p(app_win); lv_app_win_close(app); diff --git a/lv_app/lv_app.h b/lv_app/lv_app.h index 9eb6a29d3..53677a7ec 100644 --- a/lv_app/lv_app.h +++ b/lv_app/lv_app.h @@ -29,11 +29,12 @@ typedef enum 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_CHAR, /*Stream of characters. Always '\0' terminated*/ + LV_APP_COM_TYPE_INT, /*Stream of 'int32_t' numbers*/ 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)*/ + LV_APP_COM_TYPE_INV, /*Invalid type*/ + LV_APP_COM_TYPE_NUM, /*Indicates the number of com. types*/ }lv_app_com_type_t; struct __LV_APP_DSC_T; @@ -99,7 +100,7 @@ typedef struct { void lv_app_init(void); 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); +uint16_t lv_app_com_send(lv_app_inst_t * app_send, lv_app_com_type_t type , const void * data, uint32_t size); lv_obj_t * lv_app_sc_open(lv_app_inst_t * app); void lv_app_sc_close(lv_app_inst_t * app); lv_obj_t * lv_app_win_open(lv_app_inst_t * app); @@ -107,10 +108,12 @@ void lv_app_win_close(lv_app_inst_t * app); 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); +bool lv_app_con_check(lv_app_inst_t * sender, lv_app_inst_t * receiver); void lv_app_con_set(lv_app_inst_t * sender, lv_app_inst_t * receiver); +void lv_app_con_del(lv_app_inst_t * sender, lv_app_inst_t * receiver); 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); +void lv_app_style_refr(void); lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc); diff --git a/lv_app/lv_app_util/lv_app_notice.c b/lv_app/lv_app_util/lv_app_notice.c index 35bd01c40..acb1d46e0 100644 --- a/lv_app/lv_app_util/lv_app_notice.c +++ b/lv_app/lv_app_util/lv_app_notice.c @@ -123,7 +123,7 @@ void lv_app_notice_add(const char * txt) a.fp = (anim_fp_t) lv_obj_set_height; a.start = lv_obj_get_height(n); a.end = 0; - a.end_cb = lv_obj_del; + a.end_cb = (anim_cb_t)lv_obj_del; anim_create(&a); #else anim_t a; diff --git a/lv_appx/lv_app_example.c b/lv_appx/lv_app_example.c index 280ea0bb5..d78e35c22 100644 --- a/lv_appx/lv_app_example.c +++ b/lv_appx/lv_app_example.c @@ -43,7 +43,7 @@ typedef struct **********************/ 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_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 size); 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); @@ -79,6 +79,10 @@ static lv_app_dsc_t my_app_dsc = * GLOBAL FUNCTIONS **********************/ +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ const lv_app_dsc_t * lv_app_example_init(void) { return &my_app_dsc; @@ -122,24 +126,18 @@ static void my_app_close(lv_app_inst_t * app) * @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 + * @param size 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) + lv_app_com_type_t type , const void * data, uint32_t size) { - if(type == LV_APP_COM_TYPE_STR) { /*data: string*/ + if(type == LV_APP_COM_TYPE_CHAR) { /*data: string*/ my_sc_data_t * sc_data = app_rec->sc_data; if (sc_data->label != NULL) { - lv_label_set_text(sc_data->label, data); + lv_label_set_text_array(sc_data->label, data, size); lv_obj_align(sc_data->label , NULL,LV_ALIGN_CENTER, 0, 0); } } - else if(type == LV_APP_COM_TYPE_BIN) { /*data: array of 'int32_t' */ - - } - else if(type == LV_APP_COM_TYPE_TRIG) { /*data: ignored' */ - - } } /** @@ -151,10 +149,11 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) { my_sc_data_t * sc_data = app->sc_data; + lv_app_style_t * app_style = lv_app_style_get(); sc_data->label = lv_label_create(sc, NULL); lv_label_set_text(sc_data->label, "Empty"); - lv_obj_set_style(sc_data->label, lv_labels_get(LV_LABELS_DEF, NULL)); + lv_obj_set_style(sc_data->label, &app_style->sc_txt_style); lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0); } @@ -206,7 +205,8 @@ static void my_win_close(lv_app_inst_t * app) */ static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) { - lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_CLR, NULL, kb_ok_action); + lv_ta_set_text(ta, ""); /*Clear the ta*/ + lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, kb_ok_action); return LV_ACTION_RES_OK; } @@ -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_STR, txt, strlen(txt) + 1); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, txt, strlen(txt)); } #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 038d917a3..38c9dcffc 100644 --- a/lv_appx/lv_app_example.h +++ b/lv_appx/lv_app_example.h @@ -36,4 +36,4 @@ const lv_app_dsc_t * lv_app_example_init(void); #endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/ -#endif /* LV_APP_EXAMPLE */ +#endif /* LV_APP_EXAMPLE_H */ diff --git a/lv_appx/lv_app_sysmon.c b/lv_appx/lv_app_sysmon.c index d41b22c7c..4258782c7 100644 --- a/lv_appx/lv_app_sysmon.c +++ b/lv_appx/lv_app_sysmon.c @@ -11,17 +11,13 @@ #include #include "misc/os/ptask.h" +#include "misc/os/idle.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 @@ -54,7 +50,7 @@ typedef struct **********************/ 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_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 size); 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); @@ -96,6 +92,10 @@ static dm_mon_t mem_mon; * GLOBAL FUNCTIONS **********************/ +/** + * Initialize the application + * @return pointer to the application descriptor of this application + */ const lv_app_dsc_t * lv_app_sysmon_init(void) { ptask_create(sysmon_task, LV_APP_SYSMON_REFR_TIME, PTASK_PRIO_LOW); @@ -103,6 +103,7 @@ const lv_app_dsc_t * lv_app_sysmon_init(void) memset(mem_pct, 0, sizeof(mem_pct)); memset(cpu_pct, 0, sizeof(cpu_pct)); + /*Create progress bar styles for the shortcut*/ 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); @@ -164,20 +165,12 @@ static void my_app_close(lv_app_inst_t * app) * @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 + * @param size 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) + lv_app_com_type_t type , const void * data, uint32_t size) { - 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' */ - - } } /** @@ -192,6 +185,7 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) cord_t w = lv_obj_get_width(sc) / 5; + /*Create 2 progress bars fr the CPU and the Memory*/ 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); @@ -206,7 +200,6 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc) lv_pb_set_format_str(sc_data->pb_mem, "M\ne\nm"); lv_app_sysmon_refr(); - } /** @@ -228,7 +221,9 @@ static void my_sc_close(lv_app_inst_t * app) static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) { my_win_data_t * win_data = app->win_data; + lv_app_style_t * app_style = lv_app_style_get(); + /*Create a chart with two data lines*/ 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); @@ -244,9 +239,10 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win) win_data->mem_dl[i] = mem_pct[i]; } - lv_app_style_t * app_style = lv_app_style_get(); + /*Create a label for the details of Memory and CPU usage*/ + cord_t opad = app_style->win_style.content.scrable_rects.opad; 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_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_MID, opad, 0); lv_obj_set_style(win_data->label, &app_style->win_txt_style); lv_app_sysmon_refr(); @@ -264,9 +260,13 @@ static void my_win_close(lv_app_inst_t * app) /*-------------------- * OTHER FUNCTIONS ---------------------*/ + +/** + * Called periodically to monitor the CPU and memory usage. + * It refreshes the shortcuts and windows and also add notifications if there is any problem. + */ static void sysmon_task(void) { - /*Shift out the oldest data*/ uint16_t i; for(i = 1; i < LV_APP_SYSMON_PNUM; i++) { @@ -274,6 +274,7 @@ static void sysmon_task(void) cpu_pct[i - 1] = cpu_pct[i]; } + /*Get CPU and memory information */ uint8_t cpu_busy = 0; #if USE_IDLE != 0 cpu_busy = 100 - idle_get(); @@ -282,36 +283,40 @@ static void sysmon_task(void) dm_monitor(&mem_mon); uint8_t mem_free_pct = (uint32_t) ((DM_MEM_SIZE - mem_mon.size_free) * 100 ) / DM_MEM_SIZE; + /*Add the CPU and memory data*/ cpu_pct[LV_APP_SYSMON_PNUM - 1] = cpu_busy; mem_pct[LV_APP_SYSMON_PNUM - 1] = mem_free_pct; + /*Refresh the shortcuts and windows*/ lv_app_sysmon_refr(); + /*Add notifications if something is critical*/ static bool mem_warn_report = false; - if(mem_mon.size_free < LV_APP_SYS_MEM_WARN && mem_warn_report == false) { + if(mem_mon.size_free < LV_APP_SYSMON_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; - } + if(mem_mon.size_free > LV_APP_SYSMON_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; + if(mem_mon.pct_frag > LV_APP_SYSMON_FRAG_WARN) { + if(frag_warn_report == false) { + frag_warn_report = true; + lv_app_notice_add("Critically memory fragmentation"); + } + dm_defrag(); /*Defrag. if the fragmentation is critical*/ } + if(mem_mon.pct_frag < LV_APP_SYSMON_FRAG_WARN) frag_warn_report = false; } - +/** + * Refresh the shortcuts and windows. + */ static void lv_app_sysmon_refr(void) { + /*Create a long detailed string*/ 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], @@ -319,10 +324,13 @@ static void lv_app_sysmon_refr(void) DM_MEM_SIZE, DM_MEM_SIZE - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag); + /*Create a short string*/ 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_style_t * app_style = lv_app_style_get(); + cord_t opad = app_style->win_style.content.scrable_rects.opad; lv_app_inst_t * app; app = lv_app_get_next(NULL, &my_app_dsc); while(app != NULL) { @@ -330,7 +338,7 @@ static void lv_app_sysmon_refr(void) 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_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_TOP, opad, 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]); @@ -343,7 +351,7 @@ static void lv_app_sysmon_refr(void) 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)); + lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf_short, strlen(buf_short)); app = lv_app_get_next(app, &my_app_dsc); } diff --git a/lv_misc/anim.h b/lv_misc/anim.h index 1c1de9017..5c9e7b264 100644 --- a/lv_misc/anim.h +++ b/lv_misc/anim.h @@ -28,12 +28,13 @@ typedef enum typedef uint8_t anim_path_t; typedef void (*anim_fp_t)(void *, int32_t); +typedef void (*anim_cb_t)(void *); typedef struct { void * var; /*Variable to animate*/ anim_fp_t fp; /*Animator function*/ - void (*end_cb) (void *); /*Call it when the animation is ready*/ + anim_cb_t end_cb; /*Call it when the animation is ready*/ anim_path_t * path; /*An array with the steps of animations*/ int32_t start; /*Start value*/ int32_t end; /*End value*/ diff --git a/lv_objx/lv_pb.c b/lv_objx/lv_pb.c index 8491124ce..ac123e944 100644 --- a/lv_objx/lv_pb.c +++ b/lv_objx/lv_pb.c @@ -131,6 +131,7 @@ bool lv_pb_signal(lv_obj_t * pb, lv_signal_t sign, void * param) break; case LV_SIGNAL_CLEANUP: dm_free(ext->format_str); + ext->format_str = NULL; break; case LV_SIGNAL_STYLE_CHG: lv_obj_set_style(ext->label, &style->label);