set display

This commit is contained in:
marc 2025-11-17 20:39:38 +01:00
parent 829dcfc285
commit 27c2376717

View File

@ -1087,10 +1087,61 @@ 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");
lv_obj_t * bg_cont = lv_obj_create(lv_scr_act());
lv_obj_remove_style_all(bg_cont);
lv_obj_set_size(bg_cont, LV_PCT(100), LV_PCT(100));
lv_obj_set_flex_flow(bg_cont, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_top(bg_cont, 5, 0);
/* info area */
lv_obj_t * info_area = lv_obj_create(bg_cont);
lv_obj_remove_style_all(info_area);
lv_obj_set_width(info_area, LV_PCT(100));
//lv_obj_set_style_pad_left(info_area, c->sz->gap[10], 0);
//lv_obj_set_style_pad_right(info_area, c->sz->gap[10], 0);
lv_obj_set_flex_grow(info_area, 1);
lv_obj_set_flex_flow(info_area, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(info_area, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_t * date_and_time = lv_obj_create(info_area);
lv_obj_remove_style_all(date_and_time);
lv_obj_set_size(date_and_time, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_t * date = lv_spangroup_create(date_and_time);
//lv_obj_add_style(date, &c->fonts[FONT_HEADING_MD], 0);
//lv_obj_add_style(date, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_spangroup_add_span(date);
lv_span_t * day_and_month = lv_spangroup_add_span(date);
//lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, date, day_and_month);
//lv_subject_add_observer_obj(&c->subject_groups.date.group, date_observer_cb, date, c);
lv_obj_t * time = lv_spangroup_create(date_and_time);
//lv_obj_add_style(time, &c->fonts[FONT_HEADING_XXL], 0);
//lv_obj_add_style(time, &c->styles[STYLE_COLOR_BASE][STYLE_TYPE_TEXT], 0);
lv_spangroup_add_span(time);
lv_span_t * minute = lv_spangroup_add_span(time);
//lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, time, minute);
//lv_subject_add_observer_obj(&c->subject_groups.time.group, time_observer_cb, time, c);
lv_obj_t * apps = lv_obj_create(bg_cont);
lv_obj_remove_style_all(apps);
lv_obj_set_size(apps, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_set_style_pad_bottom(apps, 8, 0);
lv_obj_set_style_pad_left(apps, 8, 0);
lv_obj_set_style_pad_right(apps, 8, 0);
lv_obj_set_style_border_side(apps, LV_BORDER_SIDE_BOTTOM, 0);
lv_obj_set_style_border_color(apps, lv_color_black(), 0);
lv_obj_set_style_border_width(apps, 1, 0);
lv_obj_set_style_border_opa(apps, 8 * 255 / 100, 0);
lv_obj_set_flex_flow(apps, LV_FLEX_FLOW_ROW);
lv_obj_set_style_pad_column(apps,6, 0);
create_card(apps, "Météo");
create_card(apps,"Volets");
create_card(apps,"Machine à laver");
return;
//Create a Tab view object
@ -1157,7 +1208,7 @@ void draw_ihm()
lv_obj_set_flex_flow(tabMeteo, LV_FLEX_FLOW_COLUMN);
}
void create_card(char *lbl)
void create_card(lv_obj_t * parent, char *lbl)
{
lv_color_t base = LV_COLOR_MAKE(0xff, 0xff, 0xff);
lv_color_t accent = LV_COLOR_MAKE(0xcc, 0x00, 0x00);
@ -1173,7 +1224,7 @@ void create_card(char *lbl)
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_t *app_card = lv_obj_create(parent);
lv_obj_remove_style_all(app_card);
lv_obj_set_size(app_card, 300, 180);
lv_obj_set_style_radius(app_card, 20, 0);