diff --git a/src/core/main.c b/src/core/main.c index c32c522d..bfc90f67 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -22,6 +22,7 @@ #include "core/settings.h" #include "core/sleep_mode.h" #include "core/thread.h" +#include "core/wallpaper.h" #include "driver/TP2825.h" #include "driver/beep.h" #include "driver/dm5680.h" @@ -136,7 +137,8 @@ void lvgl_init() { lv_disp_set_theme(dispp, theme); lv_obj_set_style_bg_color(lv_scr_act(), lv_color_make(64, 64, 64), 0); - if (load_wallpaper(WALLPAPER_PATH)) { + load_wallpaper(WALLPAPER_PATH); + if (wallpaper_is_used()) { lv_obj_t *img_obj = lv_img_create(lv_scr_act()); lv_img_set_src(img_obj, &img_menu_bg); } diff --git a/src/core/osd.c b/src/core/osd.c index 665ac275..85719e3e 100644 --- a/src/core/osd.c +++ b/src/core/osd.c @@ -992,83 +992,6 @@ void osd_shadow_clear(void) { } } -/////////////////////////////////////////////////////////////////////////////// -// load_bmp_file -int load_bmp_image(const char *file, uint32_t *obuf, int width, int height) { - char *buf; - struct stat stFile; - FILE *fd; - int size, rd; - int line_size; - - fd = fopen(file, "rb"); - if (fd == NULL) { - LOGE("%s cannot open", file); - return 0; - } - - // get file size - fseek(fd, 0, SEEK_END); - size = ftell(fd); - fseek(fd, 0, SEEK_SET); - - buf = (unsigned char *)malloc(size); - if (buf == NULL) { - LOGE("%s error 1", file); - return 0; - } - - rd = fread(buf, 1, size, fd); - if (rd != size) { - LOGE("%s error 2", file); - free(buf); - return 0; - } - - fclose(fd); - - // check image size - bmpFileHead *bmp = (bmpFileHead *)buf; - char *pb = buf + sizeof(bmpFileHead) + bmp->info.biClrUsed; - if (bmp->info.biWidth != width || bmp->info.biHeight != height) { - LOGE("%s error 3", file); - free(buf); - return 0; - } - - line_size = (width * 3 + 3) & 0xFFFC; // 4bytes align - - int x, y; - uint32_t addr; - - for (y = 0; y < height; y++) { - addr = y * line_size; - for (x = 0; x < width; x++) - obuf[(height - y - 1) * width + x] = (0xff << 24) + ((pb[addr + x * 3] & 0xff)) + ((pb[addr + x * 3 + 1] & 0xff) << 8) + ((pb[addr + x * 3 + 2] & 0xff) << 16); - } - - free(buf); - return 1; -} - -static uint32_t img_menu_bg_data[1920 * 1080]; // 0x00BBGGRR -lv_img_dsc_t img_menu_bg; -uint8_t wallpaper_is_used = 0; -int load_wallpaper(char *file_path) { - if (load_bmp_image(file_path, img_menu_bg_data, 1920, 1080)) { - img_menu_bg.header.cf = LV_IMG_CF_TRUE_COLOR; - img_menu_bg.header.always_zero = 0; - img_menu_bg.header.reserved = 0; - img_menu_bg.header.w = 1920; - img_menu_bg.header.h = 1080; - img_menu_bg.data_size = 1920 * 1080 * LV_COLOR_SIZE / 8; - img_menu_bg.data = (uint8_t *)img_menu_bg_data; - wallpaper_is_used = 1; - return 1; - } else { - return 0; - } -} /////////////////////////////////////////////////////////////////////////////// // Threads for updating FC OSD diff --git a/src/core/osd.h b/src/core/osd.h index 252afc92..cdf27fa0 100644 --- a/src/core/osd.h +++ b/src/core/osd.h @@ -93,8 +93,6 @@ typedef struct { } osd_font_t; extern uint8_t channel_osd_mode; -extern lv_img_dsc_t img_menu_bg; -extern uint8_t wallpaper_is_used; int osd_init(void); int osd_clear(void); @@ -109,7 +107,6 @@ void load_fc_osd_font(uint8_t); void *thread_osd(void *ptr); void osd_resource_path(char *buf, const char *fmt, osd_resource_t osd_resource_type, ...); void osd_toggle(); -int load_wallpaper(char *file_path); #ifdef __cplusplus } #endif diff --git a/src/core/wallpaper.c b/src/core/wallpaper.c new file mode 100644 index 00000000..00befbd8 --- /dev/null +++ b/src/core/wallpaper.c @@ -0,0 +1,90 @@ + +#include +#include +#include +#include +#include +#include +#include + +#include "core/common.hh" +#include "osd.h" +#include "wallpaper.h" + +static uint32_t img_menu_bg_data[1920 * 1080]; // 0x00BBGGRR +lv_img_dsc_t img_menu_bg; +static uint8_t wallpaper_state = 0; + +int load_bmp_image(const char *file, uint32_t *obuf, int width, int height) { + char *buf; + struct stat stFile; + FILE *fd; + int size, rd; + int line_size; + + fd = fopen(file, "rb"); + if (fd == NULL) { + LOGE("%s cannot open", file); + return 0; + } + + // get file size + fseek(fd, 0, SEEK_END); + size = ftell(fd); + fseek(fd, 0, SEEK_SET); + + buf = (unsigned char *)malloc(size); + if (buf == NULL) { + LOGE("%s error 1", file); + return 0; + } + + rd = fread(buf, 1, size, fd); + if (rd != size) { + LOGE("%s error 2", file); + free(buf); + return 0; + } + + fclose(fd); + + // check image size + bmpFileHead *bmp = (bmpFileHead *)buf; + char *pb = buf + sizeof(bmpFileHead) + bmp->info.biClrUsed; + if (bmp->info.biWidth != width || bmp->info.biHeight != height) { + LOGE("%s error 3", file); + free(buf); + return 0; + } + + line_size = (width * 3 + 3) & 0xFFFC; // 4bytes align + + int x, y; + uint32_t addr; + + for (y = 0; y < height; y++) { + addr = y * line_size; + for (x = 0; x < width; x++) + obuf[(height - y - 1) * width + x] = (0xff << 24) + ((pb[addr + x * 3] & 0xff)) + ((pb[addr + x * 3 + 1] & 0xff) << 8) + ((pb[addr + x * 3 + 2] & 0xff) << 16); + } + + free(buf); + return 1; +} + +void load_wallpaper(char *file_path) { + if (load_bmp_image(file_path, img_menu_bg_data, 1920, 1080)) { + img_menu_bg.header.cf = LV_IMG_CF_TRUE_COLOR; + img_menu_bg.header.always_zero = 0; + img_menu_bg.header.reserved = 0; + img_menu_bg.header.w = 1920; + img_menu_bg.header.h = 1080; + img_menu_bg.data_size = 1920 * 1080 * LV_COLOR_SIZE / 8; + img_menu_bg.data = (uint8_t *)img_menu_bg_data; + wallpaper_state = 1; + } +} + +uint8_t wallpaper_is_used() { + return wallpaper_state; +} \ No newline at end of file diff --git a/src/core/wallpaper.h b/src/core/wallpaper.h new file mode 100644 index 00000000..e5249ea6 --- /dev/null +++ b/src/core/wallpaper.h @@ -0,0 +1,14 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +void load_wallpaper(char *file_path); +uint8_t wallpaper_is_used(); + +extern lv_img_dsc_t img_menu_bg; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/ui/page_autoscan.c b/src/ui/page_autoscan.c index 6e4c7f07..dc8d3efd 100644 --- a/src/ui/page_autoscan.c +++ b/src/ui/page_autoscan.c @@ -2,8 +2,8 @@ #include -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/ui_style.h" static lv_coord_t col_dsc[] = {160, 150, 180, 220, 180, 160, LV_GRID_TEMPLATE_LAST}; @@ -22,7 +22,7 @@ static lv_obj_t *page_autoscan_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Auto Scan:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -33,7 +33,7 @@ static lv_obj_t *page_autoscan_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_clock.c b/src/ui/page_clock.c index f6fae17c..83477ebc 100644 --- a/src/ui/page_clock.c +++ b/src/ui/page_clock.c @@ -8,8 +8,8 @@ #include #include "core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/rtc.h" #include "ui/page_common.h" #include "ui/ui_attribute.h" @@ -354,7 +354,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Clock:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -365,7 +365,7 @@ static lv_obj_t *page_clock_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_elrs.c b/src/ui/page_elrs.c index 037baf22..47956b8d 100644 --- a/src/ui/page_elrs.c +++ b/src/ui/page_elrs.c @@ -16,8 +16,8 @@ #include "core/common.hh" #include "core/elrs.h" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/esp32.h" #include "page_version.h" #include "ui/ui_style.h" @@ -80,7 +80,7 @@ static lv_obj_t *page_elrs_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "ELRS:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -91,7 +91,7 @@ static lv_obj_t *page_elrs_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_fans.c b/src/ui/page_fans.c index 8674f20d..88a2e805 100644 --- a/src/ui/page_fans.c +++ b/src/ui/page_fans.c @@ -7,8 +7,8 @@ #include "core/app_state.h" #include "core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/fans.h" #include "driver/nct75.h" #include "ui/page_common.h" @@ -51,7 +51,7 @@ static lv_obj_t *page_fans_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Fans:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -62,7 +62,7 @@ static lv_obj_t *page_fans_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_focus_chart.c b/src/ui/page_focus_chart.c index 39ed8e90..a7cfa755 100644 --- a/src/ui/page_focus_chart.c +++ b/src/ui/page_focus_chart.c @@ -4,6 +4,7 @@ #include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/ui_porting.h" static lv_obj_t *focus_chart_img; @@ -18,7 +19,7 @@ lv_obj_t *page_focus_chart_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Focus Chart:", LV_MENU_ITEM_BUILDER_VARIANT_2); diff --git a/src/ui/page_headtracker.c b/src/ui/page_headtracker.c index 8f731c80..b3cc92c6 100644 --- a/src/ui/page_headtracker.c +++ b/src/ui/page_headtracker.c @@ -5,8 +5,8 @@ #include "common.hh" #include "core/app_state.h" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ht.h" #include "page_common.h" #include "ui/ui_style.h" @@ -141,7 +141,7 @@ static lv_obj_t *page_headtracker_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Head Tracker:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -152,7 +152,7 @@ static lv_obj_t *page_headtracker_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_imagesettings.c b/src/ui/page_imagesettings.c index c69e1ba2..413c48fb 100644 --- a/src/ui/page_imagesettings.c +++ b/src/ui/page_imagesettings.c @@ -5,8 +5,8 @@ #include "core/app_state.h" #include "core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/hardware.h" #include "driver/oled.h" #include "ui/page_common.h" @@ -36,7 +36,7 @@ static lv_obj_t *page_imagesettings_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Image Setting:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -47,7 +47,7 @@ static lv_obj_t *page_imagesettings_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_input.c b/src/ui/page_input.c index d2421fe4..0c7ccff9 100644 --- a/src/ui/page_input.c +++ b/src/ui/page_input.c @@ -9,6 +9,7 @@ #include "core/input_device.h" #include "core/osd.h" #include "core/sleep_mode.h" +#include "core/wallpaper.h" #include "ui/page_fans.h" #include "ui/ui_image_setting.h" @@ -168,7 +169,7 @@ static lv_obj_t *page_input_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, contentWidth + 93, contentHeight + 294); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Inputs:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -179,7 +180,7 @@ static lv_obj_t *page_input_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(content, LV_LAYOUT_GRID); lv_obj_clear_flag(content, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(content, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(content, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(content, col_dsc, 0); diff --git a/src/ui/page_osd.c b/src/ui/page_osd.c index a64b14e9..0807dcba 100644 --- a/src/ui/page_osd.c +++ b/src/ui/page_osd.c @@ -9,6 +9,7 @@ #include "core/common.hh" #include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/hardware.h" #include "page_common.h" #include "ui/ui_osd_element_pos.h" @@ -44,7 +45,7 @@ static lv_obj_t *page_osd_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "OSD:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -55,7 +56,7 @@ static lv_obj_t *page_osd_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_playback.c b/src/ui/page_playback.c index 016fb93b..a0dfc37f 100644 --- a/src/ui/page_playback.c +++ b/src/ui/page_playback.c @@ -14,6 +14,7 @@ #include "common.hh" #include "core/app_state.h" #include "core/osd.h" +#include "core/wallpaper.h" #include "record/record_definitions.h" #include "ui/page_common.h" #include "ui/ui_player.h" @@ -42,7 +43,7 @@ static lv_obj_t *page_playback_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1142, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Playback:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -51,7 +52,7 @@ static lv_obj_t *page_playback_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_size(cont, 1164, 760); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); for (uint32_t pos = 0; pos < ITEMS_LAYOUT_CNT; pos++) { diff --git a/src/ui/page_power.c b/src/ui/page_power.c index 3aa9a227..4d1c1883 100644 --- a/src/ui/page_power.c +++ b/src/ui/page_power.c @@ -8,8 +8,8 @@ #include "core/app_state.h" #include "core/battery.h" #include "core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/dm5680.h" #include "driver/hardware.h" #include "driver/mcp3021.h" @@ -98,7 +98,7 @@ static lv_obj_t *page_power_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1063, 984); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Power:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -109,7 +109,7 @@ static lv_obj_t *page_power_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_record.c b/src/ui/page_record.c index 0f5964f4..90e46c4b 100644 --- a/src/ui/page_record.c +++ b/src/ui/page_record.c @@ -5,8 +5,8 @@ #include #include "../core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/rtc.h" #include "page_common.h" #include "ui/ui_style.h" @@ -49,7 +49,7 @@ static lv_obj_t *page_record_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Record Option:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -60,7 +60,7 @@ static lv_obj_t *page_record_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_sleep.c b/src/ui/page_sleep.c index 69210a3c..f72f5dc9 100644 --- a/src/ui/page_sleep.c +++ b/src/ui/page_sleep.c @@ -1,6 +1,6 @@ #include "page_sleep.h" -#include "core/osd.h" +#include "core/wallpaper.h" #include "driver/fans.h" #include "page_fans.h" #include "sleep_mode.h" @@ -17,7 +17,7 @@ lv_obj_t *page_sleep_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Go Sleep:", LV_MENU_ITEM_BUILDER_VARIANT_2); diff --git a/src/ui/page_source.c b/src/ui/page_source.c index 7a29e877..bb1d29e7 100644 --- a/src/ui/page_source.c +++ b/src/ui/page_source.c @@ -11,6 +11,7 @@ #include "core/dvr.h" #include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/hardware.h" #include "driver/it66121.h" #include "driver/oled.h" @@ -39,7 +40,7 @@ static lv_obj_t *page_source_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Source:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -50,7 +51,7 @@ static lv_obj_t *page_source_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_storage.c b/src/ui/page_storage.c index 49166bde..8c0ad141 100644 --- a/src/ui/page_storage.c +++ b/src/ui/page_storage.c @@ -7,8 +7,8 @@ #include #include "core/common.hh" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/page_playback.h" #include "util/filesystem.h" #include "util/sdcard.h" @@ -361,7 +361,7 @@ static lv_obj_t *page_storage_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Storage:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -372,7 +372,7 @@ static lv_obj_t *page_storage_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_version.c b/src/ui/page_version.c index 1bc1e229..0350a357 100644 --- a/src/ui/page_version.c +++ b/src/ui/page_version.c @@ -14,6 +14,7 @@ #include "core/esp32_flash.h" #include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/beep.h" #include "driver/dm5680.h" #include "driver/esp32.h" @@ -766,7 +767,7 @@ static lv_obj_t *page_version_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Firmware:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -777,7 +778,7 @@ static lv_obj_t *page_version_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/page_wifi.c b/src/ui/page_wifi.c index 9bd24fea..c1ff476f 100644 --- a/src/ui/page_wifi.c +++ b/src/ui/page_wifi.c @@ -14,8 +14,8 @@ #include "core/app_state.h" #include "core/common.hh" #include "core/dvr.h" -#include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/page_common.h" #include "ui/ui_attribute.h" #include "ui/ui_keyboard.h" @@ -707,7 +707,7 @@ static lv_obj_t *page_wifi_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_t *section = lv_menu_section_create(page); lv_obj_add_style(section, &style_submenu, LV_PART_MAIN); lv_obj_set_size(section, 1053, 894); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "WiFi Module:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -718,7 +718,7 @@ static lv_obj_t *page_wifi_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_layout(cont, LV_LAYOUT_GRID); lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_add_style(cont, &style_context, LV_PART_MAIN); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); diff --git a/src/ui/ui_main_menu.c b/src/ui/ui_main_menu.c index a638bfee..bab5dccb 100644 --- a/src/ui/ui_main_menu.c +++ b/src/ui/ui_main_menu.c @@ -7,7 +7,7 @@ #include "common.hh" #include "core/app_state.h" -#include "core/osd.h" +#include "core/wallpaper.h" #include "driver/hardware.h" #include "driver/mcp3021.h" #include "driver/oled.h" @@ -292,7 +292,7 @@ void main_menu_init(void) { lv_obj_clear_flag(menu, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_style_bg_color(menu, lv_color_make(32, 32, 32), 0); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(menu, LV_OPA_50, 0); lv_obj_set_style_border_width(menu, 2, 0); lv_obj_set_style_border_color(menu, lv_color_make(255, 0, 0), 0); @@ -312,7 +312,7 @@ void main_menu_init(void) { lv_obj_add_style(section, &style_rootmenu, LV_PART_MAIN); lv_obj_set_size(section, 250, 975); lv_obj_set_pos(section, 0, 0); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(section, LV_OPA_50, 0); lv_obj_set_size(root_page, 250, 975); diff --git a/src/ui/ui_statusbar.c b/src/ui/ui_statusbar.c index 159baa46..e22e3367 100644 --- a/src/ui/ui_statusbar.c +++ b/src/ui/ui_statusbar.c @@ -8,6 +8,7 @@ #include "core/common.hh" #include "core/osd.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/beep.h" #include "ui/page_common.h" #include "ui/page_playback.h" @@ -53,7 +54,7 @@ int statusbar_init(void) { lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_style_bg_color(cont, lv_color_make(19, 19, 19), 0); - if (wallpaper_is_used) + if (wallpaper_is_used()) lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_border_width(cont, 0, 0); lv_obj_set_style_radius(cont, 0, 0);