BigW Consortium Gitlab

Commit 5e0fffda by Kiss-Vamosi Gabor

Minor improvments with the application system

parent 4182154c
......@@ -196,7 +196,7 @@ void lv_app_close(lv_app_inst_t * app)
lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
{
/*Save the current position of the scrollable part of the page*/
cord_t scrl_y = lv_obj_get_y(lv_page_get_scrable(sc_page));
cord_t scrl_y = lv_obj_get_y(lv_page_get_scrl(sc_page));
/*Create a basic shortcut*/
app->sc = lv_btn_create(sc_page, NULL);
......@@ -229,7 +229,7 @@ lv_obj_t * lv_app_sc_open(lv_app_inst_t * app)
/* Restore position of the scrollable part of the page because
* it moved when the shortcut is created*/
lv_obj_set_y(lv_page_get_scrable(sc_page), scrl_y);
lv_obj_set_y(lv_page_get_scrl(sc_page), scrl_y);
#if LV_APP_EFFECT_ANIM == 0
lv_page_focus(sc_page, app->sc, false);
#else
......@@ -270,7 +270,7 @@ lv_obj_t * lv_app_win_open(lv_app_inst_t * app)
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_obj_t * win_content = lv_page_get_scrl(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);
......@@ -462,7 +462,7 @@ void lv_app_style_refr(void)
lv_obj_set_opa(menuh, app_style.menu_opa);
lv_obj_set_opa(app_btn, app_style.menu_btn_opa);
lv_obj_set_width(lv_page_get_scrable(sc_page),
lv_obj_set_width(lv_page_get_scrl(sc_page),
LV_HOR_RES - 2 * (app_style.sc_page_style.bg_rects.hpad));
}
......@@ -490,8 +490,8 @@ static void lv_app_init_desktop(void)
lv_obj_set_style(sc_page, &app_style.sc_page_style);
lv_obj_set_size(sc_page, LV_HOR_RES, LV_VER_RES);
lv_obj_set_pos(sc_page, 0, 0);
lv_rect_set_fit(lv_page_get_scrable(sc_page), false, true);
lv_rect_set_layout(lv_page_get_scrable(sc_page), LV_RECT_LAYOUT_GRID);
lv_rect_set_fit(lv_page_get_scrl(sc_page), false, true);
lv_rect_set_layout(lv_page_get_scrl(sc_page), LV_RECT_LAYOUT_GRID);
lv_page_set_rel_action(sc_page, lv_app_sc_page_rel_action);
/*Menu on the top*/
......@@ -545,7 +545,7 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
else {
app_list = lv_list_create(lv_scr_act(), NULL);
lv_obj_set_style(app_list, &app_style.app_list_style);
lv_obj_set_opa(app_list, app_style.menu_opa);
lv_obj_set_opar(app_list, app_style.menu_opa);
lv_obj_set_size(app_list, app_style.app_list_w, app_style.app_list_h);
lv_obj_set_y(app_list, app_style.menu_h);
......@@ -556,6 +556,18 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d
elem = lv_list_add(app_list, NULL, (*dsc)->name, lv_app_menu_elem_rel_action);
lv_obj_set_free_p(elem, *dsc);
lv_obj_set_opa(elem, app_style.menu_btn_opa);
elem = lv_list_add(app_list, NULL, (*dsc)->name, lv_app_menu_elem_rel_action);
lv_obj_set_free_p(elem, *dsc);
lv_obj_set_opa(elem, app_style.menu_btn_opa);
elem = lv_list_add(app_list, NULL, (*dsc)->name, lv_app_menu_elem_rel_action);
lv_obj_set_free_p(elem, *dsc);
lv_obj_set_opa(elem, app_style.menu_btn_opa);
elem = lv_list_add(app_list, NULL, (*dsc)->name, lv_app_menu_elem_rel_action);
lv_obj_set_free_p(elem, *dsc);
lv_obj_set_opa(elem, app_style.menu_btn_opa);
}
}
}
......@@ -905,7 +917,7 @@ static void lv_app_init_style(void)
/*Coordinates*/
app_style.menu_h = 40 * LV_DOWNSCALE;
app_style.app_list_w = LV_HOR_RES / 3;
app_style.app_list_h = (2 * LV_VER_RES) / 3;
app_style.app_list_h = (3 * LV_VER_RES) / 4;
app_style.sc_title_margin = 2 * LV_DOWNSCALE;
/*Opacity*/
......@@ -949,17 +961,13 @@ static void lv_app_init_style(void)
app_style.menu_btn_img_style.recolor_opa = OPA_90;
/*App list styles*/
lv_lists_get(LV_LISTS_DEF,&app_style.app_list_style);
memcpy(&app_style.app_list_style.liste_btns, &app_style.menu_btn_style, sizeof(lv_btns_t));
memcpy(&app_style.app_list_style.bg_pages.bg_rects, &app_style.menu_style, sizeof(lv_rects_t));
lv_lists_get(LV_LISTS_SCRL,&app_style.app_list_style);
memcpy(&app_style.app_list_style.bg_pages.scrl_rects, &app_style.menu_style, sizeof(lv_rects_t));
app_style.app_list_style.bg_pages.scrl_rects.hpad = 0 * LV_DOWNSCALE;
app_style.app_list_style.bg_pages.scrl_rects.vpad = 0 * LV_DOWNSCALE;
app_style.app_list_style.bg_pages.scrl_rects.opad = 0 * LV_DOWNSCALE;
memcpy(&app_style.app_list_style.liste_labels, &app_style.menu_btn_label_style, sizeof(lv_labels_t));
app_style.app_list_style.bg_pages.bg_rects.vpad = 0;
app_style.app_list_style.bg_pages.bg_rects.hpad = 0;
app_style.app_list_style.bg_pages.bg_rects.opad = 0;
app_style.app_list_style.bg_pages.scrable_rects.objs.transp = 1;
app_style.app_list_style.bg_pages.scrable_rects.vpad = 0;
app_style.app_list_style.bg_pages.scrable_rects.hpad = 0;
app_style.app_list_style.bg_pages.scrable_rects.opad = 0;
memcpy(&app_style.app_list_style.liste_btns, &app_style.menu_btn_style, sizeof(lv_btns_t));
app_style.app_list_style.bg_pages.sb_rects.objs.color = COLOR_GRAY;
app_style.app_list_style.bg_pages.sb_rects.gcolor = COLOR_GRAY;
app_style.app_list_style.bg_pages.sb_width = 8 * LV_DOWNSCALE;
......@@ -972,10 +980,10 @@ static void lv_app_init_style(void)
app_style.sc_page_style.bg_rects.vpad = app_style.menu_h;
app_style.sc_page_style.bg_rects.hpad = 0;
app_style.sc_page_style.bg_rects.opad = 0;
app_style.sc_page_style.scrable_rects.objs.transp = 1;
app_style.sc_page_style.scrable_rects.hpad = 20 * LV_DOWNSCALE;
app_style.sc_page_style.scrable_rects.vpad = 20 * LV_DOWNSCALE;
app_style.sc_page_style.scrable_rects.opad = 20 * LV_DOWNSCALE;
app_style.sc_page_style.scrl_rects.objs.transp = 1;
app_style.sc_page_style.scrl_rects.hpad = 20 * LV_DOWNSCALE;
app_style.sc_page_style.scrl_rects.vpad = 20 * LV_DOWNSCALE;
app_style.sc_page_style.scrl_rects.opad = 20 * LV_DOWNSCALE;
/*Shortcut styles*/
lv_btns_get(LV_BTNS_DEF,&app_style.sc_style);
......@@ -1039,7 +1047,7 @@ static void lv_app_init_style(void)
app_style.win_style.content.bg_rects.vpad = app_style.win_style.ctrl_btn_h +
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;
app_style.win_style.content.scrl_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;
......
......@@ -64,11 +64,9 @@ void lv_app_fsel_init(void)
{
lv_app_style_t * app_style = lv_app_style_get();
lv_lists_get(LV_LISTS_DEF, &fsel_lists);
lv_lists_get(LV_LISTS_TRANSP, &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;
......@@ -141,10 +139,11 @@ static void fsel_refr(void)
/*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_set_size(fsel_list, LV_HOR_RES - 2 * (wins->content.bg_rects.hpad + wins->content.scrl_rects.hpad), LV_VER_RES -
wins->content.bg_rects.vpad - 2 * wins->content.scrl_rects.vpad);
lv_obj_align(fsel_list, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style(fsel_list, &fsel_lists);
lv_list_set_fit(fsel_list, LV_LIST_FIT_WIDTH_SB);
fs_res_t res = FS_RES_OK;
......
......@@ -124,7 +124,7 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
/*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_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;
cord_t win_cont_h = lv_obj_get_height(lv_win_get_content(kb_win)) - 2 * app_style->win_style.content.scrl_rects.vpad;
kb_ta_ori_size = lv_obj_get_height(kb_ta);
if(lv_obj_get_height(kb_ta) > win_cont_h) {
lv_obj_set_height(kb_ta, win_cont_h);
......
......@@ -14,6 +14,7 @@
#include "misc/os/idle.h"
#include "lvgl/lv_objx/lv_chart.h"
#include "lvgl/lv_app/lv_app_util/lv_app_notice.h"
#include "hal/systick/systick.h"
/*********************
* DEFINES
......@@ -240,7 +241,7 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
}
/*Create a label for the details of Memory and CPU usage*/
cord_t opad = app_style->win_style.content.scrable_rects.opad;
cord_t opad = app_style->win_style.content.scrl_rects.opad;
win_data->label = lv_label_create(win, NULL);
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);
......@@ -290,6 +291,16 @@ static void sysmon_task(void)
/*Refresh the shortcuts and windows*/
lv_app_sysmon_refr();
/*Handle periodic defrag. if enabled*/
#if LV_APP_SYSMON_DEFRAG_PERIOD != 0
static uint32_t last_defrag = 0;
if(systick_elaps(last_defrag) > LV_APP_SYSMON_DEFRAG_PERIOD) {
dm_defrag();
last_defrag = systick_get();
}
#endif
/*Add notifications if something is critical*/
static bool mem_warn_report = false;
if(mem_mon.size_free < LV_APP_SYSMON_MEM_WARN && mem_warn_report == false) {
......@@ -304,8 +315,8 @@ static void sysmon_task(void)
if(frag_warn_report == false) {
frag_warn_report = true;
lv_app_notice_add("Critically memory fragmentation");
dm_defrag(); /*Defrag. if the fragmentation is critical*/
}
dm_defrag(); /*Defrag. if the fragmentation is critical*/
}
if(mem_mon.pct_frag < LV_APP_SYSMON_FRAG_WARN) frag_warn_report = false;
......@@ -330,7 +341,7 @@ static void lv_app_sysmon_refr(void)
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;
cord_t opad = app_style->win_style.content.scrl_rects.opad;
lv_app_inst_t * app;
app = lv_app_get_next(NULL, &my_app_dsc);
while(app != NULL) {
......
......@@ -9,7 +9,7 @@
#include "lv_app_terminal.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0
#include "../lv_app/lv_app_util/lv_app_kb.h"
#include "lvgl/lv_app/lv_app_util/lv_app_kb.h"
#include <stdio.h>
/*********************
......@@ -157,11 +157,11 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
/*Add the recevied data if the type is matches*/
if(type == app_data->com_type) {
if(app_data->txt[0] != '\0') add_data(app_rec, "\n", 1);
add_data(app_rec, "@", 1);
add_data(app_rec, app_send->name, strlen(app_send->name));
add_data(app_rec, "\n", 1);
add_data(app_rec, data, size);
add_data(app_rec, "\n", 1);
}
}
......@@ -213,14 +213,14 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
my_app_data_t * app_data = app->app_data;
lv_app_style_t * app_style = lv_app_style_get();
cord_t opad = app_style->win_style.content.scrable_rects.opad;
cord_t opad = app_style->win_style.content.scrl_rects.opad;
/*Create a label for the text of the terminal*/
win_data->label = lv_label_create(win, NULL);
lv_label_set_long_mode(win_data->label, LV_LABEL_LONG_BREAK);
lv_obj_set_width(win_data->label, LV_HOR_RES -
2 * (app_style->win_style.content.bg_rects.hpad +
app_style->win_style.content.scrable_rects.hpad));
app_style->win_style.content.scrl_rects.hpad));
lv_obj_set_style(win_data->label, &app_style->win_txt_style);
lv_label_set_text_static(win_data->label, app_data->txt); /*Use the app. data text directly*/
......@@ -228,10 +228,12 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
/*Create a text area. Text can be added to the terminal from here by app. keyboard.*/
win_data->ta = lv_ta_create(win, NULL);
lv_obj_set_size(win_data->ta, LV_HOR_RES / 2, LV_VER_RES / 4);
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
lv_obj_set_free_p(win_data->ta, app);
lv_page_set_rel_action(win_data->ta, win_ta_rel_action);
lv_ta_set_text(win_data->ta, "");
lv_obj_set_style(win_data->ta, lv_tas_get(LV_TAS_DEF, NULL));
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
/*Creat a button to set the communication type (char, integer etc.)*/
win_data->com_type_btn = lv_btn_create(win, NULL);
......@@ -244,8 +246,8 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
/*Align the window to see the text area on the bottom*/
lv_obj_align(lv_page_get_scrable(lv_win_get_content(app->win)), NULL, LV_ALIGN_IN_BOTTOM_LEFT,
0, - app_style->win_style.content.scrable_rects.vpad);
lv_obj_align(lv_page_get_scrl(lv_win_get_content(app->win)), NULL, LV_ALIGN_IN_BOTTOM_LEFT,
0, - app_style->win_style.content.scrl_rects.vpad);
}
......@@ -304,13 +306,13 @@ static lv_action_res_t win_comch_rel_action(lv_obj_t * btn, lv_dispi_t * dispi)
static void win_ta_kb_ok_action(lv_obj_t * ta)
{
lv_app_inst_t * app = lv_obj_get_free_p(ta);
my_app_data_t * app_data = app->app_data;
const char * ta_txt = lv_ta_get_txt(ta);
uint32_t ta_txt_len = strlen(ta_txt);
if(app_data->txt[0] != '\0') add_data(app, "\n", 1);
add_data(app, ">", 1);
add_data(app, ta_txt, ta_txt_len);
add_data(app, "\n", 1);
my_app_data_t * app_data = app->app_data;
lv_app_com_send(app, app_data->com_type, ta_txt, ta_txt_len);
lv_ta_set_text(ta, "");
......@@ -357,11 +359,11 @@ static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len)
lv_app_style_t * app_style = lv_app_style_get();
if(win_data != NULL) {
cord_t opad = app_style->win_style.content.scrable_rects.opad;
cord_t opad = app_style->win_style.content.scrl_rects.opad;
lv_label_set_text_static(win_data->label, app_data->txt);
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
lv_obj_align(lv_page_get_scrable(lv_win_get_content(app->win)), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - app_style->win_style.content.scrable_rects.vpad);
lv_obj_align(lv_page_get_scrl(lv_win_get_content(app->win)), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - app_style->win_style.content.scrl_rects.vpad);
}
/*Set the last line on the shortcut*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment