firmware: Add background image

This commit is contained in:
2024-12-12 01:19:02 +00:00
parent 8bdd1c018f
commit b6f242a73a
9 changed files with 74 additions and 5 deletions

View File

@@ -1,3 +1,3 @@
idf_component_register(
SRCS "valconomy.c" "ui.c" "lcd.c" "usb.c" "font/tungsten_120.c"
SRCS "valconomy.c" "ui.c" "lcd.c" "usb.c" "font/tungsten_120.c" "img/bg.c"
INCLUDE_DIRS ".")

View File

View File

@@ -2,7 +2,12 @@
#include "ui.h"
static const lv_font_t *font_normal = &lv_font_montserrat_14;
static const lv_font_t *font_normal = &lv_font_montserrat_24;
static lv_color_t color_primary, color_secondary;
static lv_color_t color_text_hero;
static lv_style_t s_hero;
static void b_cfg_cb(lv_event_t *e) {
lv_obj_t *box = lv_msgbox_create(NULL);
@@ -12,8 +17,11 @@ static void b_cfg_cb(lv_event_t *e) {
}
static void ui_home() {
lv_obj_t *i_bg = lv_image_create(lv_screen_active());
lv_image_set_src(i_bg, &ui_img_bg);
lv_obj_t *l_test = lv_label_create(lv_screen_active());
lv_obj_set_style_text_font(l_test, &lv_font_tungsten_120, 0);
lv_obj_add_style(l_test, &s_hero, 0);
lv_label_set_text(l_test, "VAL TIME");
lv_obj_t *b_cfg = lv_button_create(lv_screen_active());
@@ -26,12 +34,21 @@ static void ui_home() {
}
void val_lvgl_ui(lv_display_t *disp) {
color_primary = lv_color_hex(0xff4655);
color_secondary = lv_color_hex(0xf7518f);
color_text_hero = lv_palette_lighten(LV_PALETTE_GREY, 2);
// init default theme
lv_theme_default_init(
disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
disp, color_primary, color_secondary,
true, // dark theme
font_normal);
// lv_sysmon_hide_performance(disp);
lv_style_init(&s_hero);
lv_style_set_text_font(&s_hero, &lv_font_tungsten_120);
lv_style_set_text_color(&s_hero, color_text_hero);
ui_home();
}

View File

@@ -4,4 +4,6 @@
LV_FONT_DECLARE(lv_font_tungsten_120)
LV_IMAGE_DECLARE(ui_img_bg);
void val_lvgl_ui(lv_display_t *disp);