cards
This commit is contained in:
parent
4abbf3abea
commit
829dcfc285
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ esp-idf/
|
||||
gdbinit/
|
||||
sdkconfig
|
||||
sdkconfig.old
|
||||
components/domotic_display/test_host/sdkconfig
|
||||
|
||||
@ -5,6 +5,7 @@ endfunction()
|
||||
make_font(12)
|
||||
make_font(18)
|
||||
make_font(24)
|
||||
execute_process(COMMAND podman run -v /home/marc/rgb_lcd/components/domotic_display/fonts:/app -w /app lvfontconv lv_font_conv --bpp 4 --size 36 --no-compress --font Roboto-Medium.ttf --symbols "0123456789.°àéèûCABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz %,'():ê/-" --format lvgl -o roboto_medium_36.c --font fa-solid-900.ttf --range 61461,0xf0c2,0xf575)
|
||||
|
||||
idf_component_register(SRC_DIRS . fonts
|
||||
INCLUDE_DIRS "include"
|
||||
|
||||
BIN
components/domotic_display/fonts/Roboto-Medium.ttf
Normal file
BIN
components/domotic_display/fonts/Roboto-Medium.ttf
Normal file
Binary file not shown.
2780
components/domotic_display/fonts/roboto_medium_36.c
Normal file
2780
components/domotic_display/fonts/roboto_medium_36.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1049,6 +1049,7 @@ void lv_theme_copy(lv_theme_t * dst, const lv_theme_t * src)
|
||||
LV_FONT_DECLARE(montserrat_medium_12);
|
||||
LV_FONT_DECLARE(montserrat_medium_18);
|
||||
LV_FONT_DECLARE(montserrat_medium_24);
|
||||
LV_FONT_DECLARE(roboto_medium_36);
|
||||
void draw_ihm()
|
||||
{
|
||||
|
||||
@ -1056,9 +1057,9 @@ void draw_ihm()
|
||||
|
||||
/*Initialize the styles*/
|
||||
lv_style_init(&style_btn);
|
||||
lv_style_set_bg_color(&style_btn, lv_palette_main(LV_PALETTE_GREEN));
|
||||
lv_style_set_border_color(&style_btn, lv_palette_darken(LV_PALETTE_GREEN, 3));
|
||||
lv_style_set_border_width(&style_btn, 3);
|
||||
//lv_style_set_bg_color(&style_btn, lv_palette_main(LV_PALETTE_GREEN));
|
||||
//lv_style_set_border_color(&style_btn, lv_palette_darken(LV_PALETTE_GREEN, 3));
|
||||
//lv_style_set_border_width(&style_btn, 3);
|
||||
|
||||
/* Initialize the new theme with the current theme as its parent
|
||||
* The user is responsible for freeing the theme when it's no longer needed */
|
||||
@ -1086,8 +1087,11 @@ void draw_ihm()
|
||||
|
||||
// keys.clear();
|
||||
lv_obj_clean(lv_scr_act());
|
||||
|
||||
|
||||
lv_obj_set_flex_flow(lv_scr_act(),LV_FLEX_FLOW_ROW);
|
||||
create_card("Météo");
|
||||
create_card("Volets");
|
||||
create_card("Machine à laver");
|
||||
return;
|
||||
|
||||
//Create a Tab view object
|
||||
tabview = lv_tabview_create(lv_screen_active());
|
||||
@ -1153,6 +1157,46 @@ void draw_ihm()
|
||||
lv_obj_set_flex_flow(tabMeteo, LV_FLEX_FLOW_COLUMN);
|
||||
}
|
||||
|
||||
void create_card(char *lbl)
|
||||
{
|
||||
lv_color_t base = LV_COLOR_MAKE(0xff, 0xff, 0xff);
|
||||
lv_color_t accent = LV_COLOR_MAKE(0xcc, 0x00, 0x00);
|
||||
|
||||
static lv_style_t objstyle;
|
||||
static lv_style_t txtstyle;
|
||||
lv_style_init(&objstyle);
|
||||
lv_style_init(&txtstyle);
|
||||
lv_style_set_bg_color(&objstyle, accent);
|
||||
lv_style_set_outline_color(&objstyle, accent);
|
||||
|
||||
lv_style_set_text_color(&txtstyle, accent);
|
||||
lv_style_set_line_color(&txtstyle, accent);
|
||||
lv_style_set_text_font(&txtstyle, &roboto_medium_36);
|
||||
// if(icon_img_dsc == NULL) return;
|
||||
lv_obj_t *app_card = lv_obj_create(lv_screen_active());
|
||||
lv_obj_remove_style_all(app_card);
|
||||
lv_obj_set_size(app_card, 300, 180);
|
||||
lv_obj_set_style_radius(app_card, 20, 0);
|
||||
lv_obj_set_style_bg_opa(app_card, 16 * 255 / 100, 0);
|
||||
lv_obj_set_style_pad_all(app_card, 24, 0);
|
||||
lv_obj_add_style(app_card, &objstyle, 0);
|
||||
// lv_obj_add_event_cb(app_card, app_card_click_cb, LV_EVENT_CLICKED, (void *)((lv_uintptr_t)app_cb));
|
||||
|
||||
lv_obj_t *label = lv_label_create(app_card);
|
||||
lv_label_set_text(label, lbl);
|
||||
lv_obj_set_align(label, LV_ALIGN_BOTTOM_LEFT);
|
||||
lv_obj_add_style(label, &txtstyle, 0);
|
||||
|
||||
lv_obj_t *icon = lv_image_create(app_card);
|
||||
// lv_obj_set_size(icon, icon_img_dsc->header.w, icon_img_dsc->header.h);
|
||||
lv_image_set_inner_align(icon, LV_IMAGE_ALIGN_CENTER);
|
||||
// lv_image_set_src(icon, icon_img_dsc);
|
||||
lv_obj_set_style_bg_opa(icon, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_bg_color(icon, lv_color_white(), 0);
|
||||
lv_obj_set_style_radius(icon, LV_COORD_MAX, 0);
|
||||
// lv_obj_add_style(icon, &c->styles[STYLE_COLOR_ACCENT][STYLE_TYPE_A8_IMG], 0);
|
||||
lv_obj_add_flag(icon, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||
}
|
||||
|
||||
void log_cb(lv_log_level_t level, const char * buf){
|
||||
ESP_LOGE(TAG, "%s",buf);
|
||||
|
||||
@ -18,6 +18,8 @@ void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr);
|
||||
void draw_tabVolets();
|
||||
void draw_ihm();
|
||||
|
||||
void create_card();
|
||||
|
||||
void weather_data_retreived_start();
|
||||
|
||||
void weather_data_retreived(meteodailyforecast_data dailyDatas[3], meteoforecast_data datas[3]);
|
||||
|
||||
@ -7,6 +7,7 @@ idf_component_register(SRCS
|
||||
"../../fonts/montserrat_medium_12.c"
|
||||
"../../fonts/montserrat_medium_18.c"
|
||||
"../../fonts/montserrat_medium_24.c"
|
||||
"../../fonts/roboto_medium_36.c"
|
||||
INCLUDE_DIRS
|
||||
"../../include"
|
||||
WHOLE_ARCHIVE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
11
components/domotic_display/test_host/sdkconfig.defaults
Normal file
11
components/domotic_display/test_host/sdkconfig.defaults
Normal file
@ -0,0 +1,11 @@
|
||||
# This file was generated using idf.py save-defconfig. It can be edited manually.
|
||||
# Espressif IoT Development Framework (ESP-IDF) 5.5.1 Project Minimal Configuration
|
||||
#
|
||||
CONFIG_IDF_TARGET="linux"
|
||||
CONFIG_LV_CONF_SKIP=n
|
||||
CONFIG_LV_USE_LOG=y
|
||||
CONFIG_LV_LOG_PRINTF=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_40=y
|
||||
CONFIG_LV_USE_SDL=y
|
||||
CONFIG_LV_BUILD_EXAMPLES=n
|
||||
CONFIG_LV_BUILD_DEMOS=n
|
||||
Loading…
x
Reference in New Issue
Block a user