From c539e50f1ef052d52dbc531acf22072f12da7781 Mon Sep 17 00:00:00 2001 From: ligenxxxx Date: Tue, 11 Jun 2024 18:57:29 +0800 Subject: [PATCH 1/5] load /mnt/extsd/resource/OSD/GOGGLE/wallpaper.bmp --- src/core/main.c | 6 ++++ src/core/osd.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ src/core/osd.h | 3 +- 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/core/main.c b/src/core/main.c index 55d4db49..2f8b9f9c 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -135,6 +135,12 @@ void lvgl_init() { false, LV_FONT_DEFAULT); lv_disp_set_theme(dispp, theme); lv_obj_set_style_bg_color(lv_scr_act(), lv_color_make(64, 64, 64), 0); + + // user wallpaper + if (load_wallpaper("/mnt/extsd/resource/OSD/GOGGLE/wallpaper.bmp")) { + lv_obj_t *img_obj = lv_img_create(lv_scr_act()); + lv_img_set_src(img_obj, &img_menu_bg); + } } int main(int argc, char *argv[]) { diff --git a/src/core/osd.c b/src/core/osd.c index 85719e3e..2269e141 100644 --- a/src/core/osd.c +++ b/src/core/osd.c @@ -992,6 +992,81 @@ 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; +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; + return 1; + } else { + return 0; + } +} /////////////////////////////////////////////////////////////////////////////// // Threads for updating FC OSD diff --git a/src/core/osd.h b/src/core/osd.h index c5ef4dfe..21adc08b 100644 --- a/src/core/osd.h +++ b/src/core/osd.h @@ -87,6 +87,7 @@ typedef struct { } osd_font_t; extern uint8_t channel_osd_mode; +extern lv_img_dsc_t img_menu_bg; int osd_init(void); int osd_clear(void); @@ -101,7 +102,7 @@ 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 From a13ab068aeb78fbb2a6582f1d034cd01c1db7f35 Mon Sep 17 00:00:00 2001 From: ligenxxxx Date: Thu, 20 Jun 2024 16:32:58 +0800 Subject: [PATCH 2/5] translucent statusbar and submenu --- src/core/osd.c | 2 ++ src/core/osd.h | 1 + src/ui/page_autoscan.c | 5 +++++ src/ui/page_clock.c | 5 +++++ src/ui/page_elrs.c | 5 +++++ src/ui/page_fans.c | 5 +++++ src/ui/page_focus_chart.c | 2 ++ src/ui/page_headtracker.c | 5 +++++ src/ui/page_imagesettings.c | 5 +++++ src/ui/page_input.c | 20 ++++++++++++-------- src/ui/page_osd.c | 4 ++++ src/ui/page_playback.c | 4 ++++ src/ui/page_power.c | 7 ++++++- src/ui/page_record.c | 5 +++++ src/ui/page_sleep.c | 3 +++ src/ui/page_source.c | 5 +++++ src/ui/page_storage.c | 5 +++++ src/ui/page_version.c | 4 ++++ src/ui/page_wifi.c | 9 +++++++-- src/ui/ui_main_menu.c | 14 +++++++++----- src/ui/ui_statusbar.c | 2 ++ 21 files changed, 101 insertions(+), 16 deletions(-) diff --git a/src/core/osd.c b/src/core/osd.c index 2269e141..665ac275 100644 --- a/src/core/osd.c +++ b/src/core/osd.c @@ -1053,6 +1053,7 @@ int load_bmp_image(const char *file, uint32_t *obuf, int width, int height) { 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; @@ -1062,6 +1063,7 @@ int load_wallpaper(char *file_path) { 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; diff --git a/src/core/osd.h b/src/core/osd.h index 21adc08b..9c64f9a1 100644 --- a/src/core/osd.h +++ b/src/core/osd.h @@ -88,6 +88,7 @@ typedef struct { 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); diff --git a/src/ui/page_autoscan.c b/src/ui/page_autoscan.c index b3132e5b..6e4c7f07 100644 --- a/src/ui/page_autoscan.c +++ b/src/ui/page_autoscan.c @@ -2,6 +2,7 @@ #include +#include "core/osd.h" #include "core/settings.h" #include "ui/ui_style.h" @@ -21,6 +22,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Auto Scan:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -30,6 +33,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_clock.c b/src/ui/page_clock.c index effb5892..f6fae17c 100644 --- a/src/ui/page_clock.c +++ b/src/ui/page_clock.c @@ -8,6 +8,7 @@ #include #include "core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "driver/rtc.h" #include "ui/page_common.h" @@ -353,6 +354,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Clock:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -362,6 +365,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_elrs.c b/src/ui/page_elrs.c index 2506ec67..037baf22 100644 --- a/src/ui/page_elrs.c +++ b/src/ui/page_elrs.c @@ -16,6 +16,7 @@ #include "core/common.hh" #include "core/elrs.h" +#include "core/osd.h" #include "core/settings.h" #include "driver/esp32.h" #include "page_version.h" @@ -79,6 +80,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "ELRS:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -88,6 +91,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_fans.c b/src/ui/page_fans.c index f1241fd5..8674f20d 100644 --- a/src/ui/page_fans.c +++ b/src/ui/page_fans.c @@ -7,6 +7,7 @@ #include "core/app_state.h" #include "core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "driver/fans.h" #include "driver/nct75.h" @@ -50,6 +51,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Fans:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -59,6 +62,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_focus_chart.c b/src/ui/page_focus_chart.c index 798eaa82..39ed8e90 100644 --- a/src/ui/page_focus_chart.c +++ b/src/ui/page_focus_chart.c @@ -18,6 +18,8 @@ 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) + 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 223c19c1..8f731c80 100644 --- a/src/ui/page_headtracker.c +++ b/src/ui/page_headtracker.c @@ -5,6 +5,7 @@ #include "common.hh" #include "core/app_state.h" +#include "core/osd.h" #include "core/settings.h" #include "ht.h" #include "page_common.h" @@ -140,6 +141,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Head Tracker:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -149,6 +152,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_imagesettings.c b/src/ui/page_imagesettings.c index 02efe1e5..c69e1ba2 100644 --- a/src/ui/page_imagesettings.c +++ b/src/ui/page_imagesettings.c @@ -5,6 +5,7 @@ #include "core/app_state.h" #include "core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "driver/hardware.h" #include "driver/oled.h" @@ -35,6 +36,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Image Setting:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -44,6 +47,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_input.c b/src/ui/page_input.c index d963d7e2..d2421fe4 100644 --- a/src/ui/page_input.c +++ b/src/ui/page_input.c @@ -7,8 +7,8 @@ #include "core/dvr.h" #include "core/ht.h" #include "core/input_device.h" -#include "core/sleep_mode.h" #include "core/osd.h" +#include "core/sleep_mode.h" #include "ui/page_fans.h" #include "ui/ui_image_setting.h" @@ -37,10 +37,10 @@ static lv_coord_t col_dsc[] = {160, 200, 160, 160, 160, 120, LV_GRID_TEMPLATE_LA static lv_coord_t row_dsc[] = {60, 60, 60, 60, 60, 60, 60, 60, 60, LV_GRID_TEMPLATE_LAST}; const char *btnOptions[] = {"Toggle OSD", "Main menu", "Toggle DVR", "Center HT", "Calibrate HT", "Go Sleep!", "Toggle fan speed"}; -void (* const btnFunctionPointers[])() = {&osd_toggle, &app_switch_to_menu, &dvr_toggle, &ht_set_center_position, &ht_calibrate, &go_sleep, &step_topfan}; +void (*const btnFunctionPointers[])() = {&osd_toggle, &app_switch_to_menu, &dvr_toggle, &ht_set_center_position, &ht_calibrate, &go_sleep, &step_topfan}; const char *rollerOptions[] = {"Switch channel", "Change fan speed", "OLED Brightness"}; -void (* const rollerFunctionPointers[])(uint8_t) = {&tune_channel, &change_topfan, &change_oled_brightness}; +void (*const rollerFunctionPointers[])(uint8_t) = {&tune_channel, &change_topfan, &change_oled_brightness}; const uint16_t rollerDefaultOption = 0; static rowType_t selectedRow = ROW_COUNT; @@ -51,7 +51,7 @@ static uint16_t previousSelection; /** * Build a '\n'-separated list of all available options for the dropdown element */ -static void build_options_string(const char** input, size_t arraySize, char* output) { +static void build_options_string(const char **input, size_t arraySize, char *output) { output[0] = 0; for (size_t i = 0; i < arraySize; i++) { strcat(output, input[i]); @@ -168,6 +168,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Inputs:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -177,6 +179,8 @@ 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) + lv_obj_set_style_bg_opa(content, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(content, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(content, row_dsc, 0); @@ -246,7 +250,7 @@ static void page_input_exit() { */ static void page_input_on_roller(uint8_t key) { if (is_any_dropdown_open()) { - lv_obj_t * const targetItem = pageItems[selectedRow]; + lv_obj_t *const targetItem = pageItems[selectedRow]; uint32_t evt = (key == DIAL_KEY_DOWN) ? LV_KEY_UP : LV_KEY_DOWN; lv_event_send(targetItem, LV_EVENT_KEY, &evt); @@ -275,7 +279,7 @@ static void page_input_on_roller(uint8_t key) { static void page_input_on_click(uint8_t key, int sel) { LV_UNUSED(key); - if ((rowType_t) sel >= BACK_BTN) { + if ((rowType_t)sel >= BACK_BTN) { return; } @@ -283,10 +287,10 @@ static void page_input_on_click(uint8_t key, int sel) { accept_dropdown(pageItems[selectedRow]); } else { selectedRow = (rowType_t)sel; - lv_obj_t * const currentItem = pageItems[selectedRow]; + lv_obj_t *const currentItem = pageItems[selectedRow]; lv_dropdown_open(currentItem); - lv_obj_t * const list = lv_dropdown_get_list(currentItem); + lv_obj_t *const list = lv_dropdown_get_list(currentItem); lv_obj_add_style(list, &style_dropdown, LV_PART_MAIN); lv_obj_set_style_text_color(list, lv_color_make(0, 0, 0), LV_PART_SELECTED | LV_STATE_CHECKED); previousSelection = lv_dropdown_get_selected(currentItem); diff --git a/src/ui/page_osd.c b/src/ui/page_osd.c index bfd8d4ed..a64b14e9 100644 --- a/src/ui/page_osd.c +++ b/src/ui/page_osd.c @@ -44,6 +44,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "OSD:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -53,6 +55,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_playback.c b/src/ui/page_playback.c index 0d0d6425..016fb93b 100644 --- a/src/ui/page_playback.c +++ b/src/ui/page_playback.c @@ -42,6 +42,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Playback:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -49,6 +51,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); for (uint32_t pos = 0; pos < ITEMS_LAYOUT_CNT; pos++) { pb_ui[pos]._img = lv_img_create(cont); diff --git a/src/ui/page_power.c b/src/ui/page_power.c index 373a8395..3aa9a227 100644 --- a/src/ui/page_power.c +++ b/src/ui/page_power.c @@ -8,6 +8,7 @@ #include "core/app_state.h" #include "core/battery.h" #include "core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "driver/dm5680.h" #include "driver/hardware.h" @@ -42,7 +43,7 @@ static btn_group_t btn_group_osd_display_mode; static btn_group_t btn_group_warn_type; static btn_group_t btn_group_power_ana; -static slider_group_t* selected_slider_group = NULL; +static slider_group_t *selected_slider_group = NULL; static lv_coord_t col_dsc[] = {160, 200, 160, 160, 120, 160, LV_GRID_TEMPLATE_LAST}; static lv_coord_t row_dsc[] = {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, LV_GRID_TEMPLATE_LAST}; @@ -97,6 +98,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Power:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -106,6 +109,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_record.c b/src/ui/page_record.c index 20f31bb8..0f5964f4 100644 --- a/src/ui/page_record.c +++ b/src/ui/page_record.c @@ -5,6 +5,7 @@ #include #include "../core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "driver/rtc.h" #include "page_common.h" @@ -48,6 +49,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Record Option:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -57,6 +60,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_sleep.c b/src/ui/page_sleep.c index 4c3820f2..69210a3c 100644 --- a/src/ui/page_sleep.c +++ b/src/ui/page_sleep.c @@ -1,5 +1,6 @@ #include "page_sleep.h" +#include "core/osd.h" #include "driver/fans.h" #include "page_fans.h" #include "sleep_mode.h" @@ -16,6 +17,8 @@ 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) + 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 7e3bf5dc..7a29e877 100644 --- a/src/ui/page_source.c +++ b/src/ui/page_source.c @@ -39,6 +39,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Source:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -48,6 +50,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); @@ -77,6 +81,7 @@ static lv_obj_t *page_source_create(lv_obj_t *parent, panel_arr_t *arr) { label[4] = NULL; create_label_item(cont, "< Back", 1, 7, 3); } + return page; } diff --git a/src/ui/page_storage.c b/src/ui/page_storage.c index 19e749df..49166bde 100644 --- a/src/ui/page_storage.c +++ b/src/ui/page_storage.c @@ -7,6 +7,7 @@ #include #include "core/common.hh" +#include "core/osd.h" #include "core/settings.h" #include "ui/page_playback.h" #include "util/filesystem.h" @@ -360,6 +361,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Storage:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -369,6 +372,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_version.c b/src/ui/page_version.c index 9c22a2f5..1bc1e229 100644 --- a/src/ui/page_version.c +++ b/src/ui/page_version.c @@ -766,6 +766,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "Firmware:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -775,6 +777,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/page_wifi.c b/src/ui/page_wifi.c index fbd48aa4..9bd24fea 100644 --- a/src/ui/page_wifi.c +++ b/src/ui/page_wifi.c @@ -14,6 +14,7 @@ #include "core/app_state.h" #include "core/common.hh" #include "core/dvr.h" +#include "core/osd.h" #include "core/settings.h" #include "ui/page_common.h" #include "ui/ui_attribute.h" @@ -473,8 +474,8 @@ static void page_wifi_update_current_page(int which) { lv_obj_clear_flag(page_wifi.page_2.gateway.input, LV_OBJ_FLAG_HIDDEN); if (page_wifi.page_1.mode.button.current == WIFI_MODE_AP || - (page_wifi.page_1.mode.button.current == WIFI_MODE_STA && - page_wifi.page_2.dhcp.button.current == 1)) { + (page_wifi.page_1.mode.button.current == WIFI_MODE_STA && + page_wifi.page_2.dhcp.button.current == 1)) { lv_obj_clear_state(page_wifi.page_2.netmask.label, STATE_DISABLED); lv_obj_clear_state(page_wifi.page_2.netmask.input, STATE_DISABLED); lv_obj_clear_state(page_wifi.page_2.gateway.label, STATE_DISABLED); @@ -706,6 +707,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_TRANSP, 0); create_text(NULL, section, false, "WiFi Module:", LV_MENU_ITEM_BUILDER_VARIANT_2); @@ -715,6 +718,8 @@ 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) + lv_obj_set_style_bg_opa(cont, LV_OPA_50, 0); lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0); diff --git a/src/ui/ui_main_menu.c b/src/ui/ui_main_menu.c index bd4729ea..07dffadb 100644 --- a/src/ui/ui_main_menu.c +++ b/src/ui/ui_main_menu.c @@ -7,6 +7,7 @@ #include "common.hh" #include "core/app_state.h" +#include "core/osd.h" #include "driver/hardware.h" #include "driver/mcp3021.h" #include "driver/oled.h" @@ -76,15 +77,15 @@ static page_pack_t *find_pp(lv_obj_t *page) { return NULL; } -static void select_menu_tab(page_pack_t* pp) { +static void select_menu_tab(page_pack_t *pp) { lv_obj_clear_flag(pp->icon, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_style_bg_opa(((lv_menu_t*)menu)->selected_tab, LV_OPA_50, LV_STATE_CHECKED); + lv_obj_set_style_bg_opa(((lv_menu_t *)menu)->selected_tab, LV_OPA_50, LV_STATE_CHECKED); } -static void deselect_menu_tab(page_pack_t* pp) { +static void deselect_menu_tab(page_pack_t *pp) { // LV_OPA_20 is the default for pressed menu // see lv_theme_default.c styles->menu_pressed - lv_obj_set_style_bg_opa(((lv_menu_t*)menu)->selected_tab, LV_OPA_20, LV_STATE_CHECKED); + lv_obj_set_style_bg_opa(((lv_menu_t *)menu)->selected_tab, LV_OPA_20, LV_STATE_CHECKED); lv_obj_add_flag(pp->icon, LV_OBJ_FLAG_HIDDEN); } @@ -98,7 +99,8 @@ void submenu_enter(void) { if (pp->p_arr.max) { // if we have selectable entries, select the first selectable one - for (pp->p_arr.cur = 0; !lv_obj_has_flag(pp->p_arr.panel[pp->p_arr.cur], FLAG_SELECTABLE); ++pp->p_arr.cur); + for (pp->p_arr.cur = 0; !lv_obj_has_flag(pp->p_arr.panel[pp->p_arr.cur], FLAG_SELECTABLE); ++pp->p_arr.cur) + ; set_select_item(&pp->p_arr, pp->p_arr.cur); } @@ -290,6 +292,8 @@ 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) + 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); lv_obj_set_style_border_side(menu, LV_BORDER_SIDE_LEFT | LV_BORDER_SIDE_RIGHT, 0); diff --git a/src/ui/ui_statusbar.c b/src/ui/ui_statusbar.c index 61506164..159baa46 100644 --- a/src/ui/ui_statusbar.c +++ b/src/ui/ui_statusbar.c @@ -53,6 +53,8 @@ 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) + 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); lv_obj_set_style_pad_row(cont, 0, 0); From 655b0ae94344a3a32b53b1b47e09800ecf3dbeb2 Mon Sep 17 00:00:00 2001 From: ligenxxxx Date: Thu, 20 Jun 2024 16:42:13 +0800 Subject: [PATCH 3/5] translucent rootmanu --- src/ui/ui_main_menu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ui/ui_main_menu.c b/src/ui/ui_main_menu.c index 07dffadb..a638bfee 100644 --- a/src/ui/ui_main_menu.c +++ b/src/ui/ui_main_menu.c @@ -312,6 +312,8 @@ 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) + lv_obj_set_style_bg_opa(section, LV_OPA_50, 0); lv_obj_set_size(root_page, 250, 975); lv_obj_set_pos(root_page, 0, 0); From fc59a5c471d28e4bd8650ca0398ec1e6fad00d16 Mon Sep 17 00:00:00 2001 From: ligenxxxx Date: Thu, 20 Jun 2024 17:23:49 +0800 Subject: [PATCH 4/5] emulator support wallpaper --- src/core/main.c | 3 +-- src/core/osd.h | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 2f8b9f9c..c32c522d 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -136,8 +136,7 @@ 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); - // user wallpaper - if (load_wallpaper("/mnt/extsd/resource/OSD/GOGGLE/wallpaper.bmp")) { + if (load_wallpaper(WALLPAPER_PATH)) { 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.h b/src/core/osd.h index 9c64f9a1..252afc92 100644 --- a/src/core/osd.h +++ b/src/core/osd.h @@ -19,6 +19,12 @@ extern "C" { #define OSD_BOUNDRY_0 0 #define OSD_BOUNDRY_1 6 +#ifdef EMULATOR_BUILD +#define WALLPAPER_PATH "wallpaper.bmp" +#else +#define WALLPAPER_PATH "/mnt/extsd/resource/OSD/GOGGLE/wallpaper.bmp" +#endif + typedef enum { OSD_RESOURCE_720 = 0, OSD_RESOURCE_1080, From e973cadb4035c2bb7ae891cebea8b4e8a27e57b4 Mon Sep 17 00:00:00 2001 From: ligenxxxx Date: Fri, 21 Jun 2024 15:33:21 +0800 Subject: [PATCH 5/5] create wallpaper.c --- src/core/main.c | 4 +- src/core/osd.c | 77 ------------------------------- src/core/osd.h | 3 -- src/core/wallpaper.c | 90 +++++++++++++++++++++++++++++++++++++ src/core/wallpaper.h | 14 ++++++ src/ui/page_autoscan.c | 6 +-- src/ui/page_clock.c | 6 +-- src/ui/page_elrs.c | 6 +-- src/ui/page_fans.c | 6 +-- src/ui/page_focus_chart.c | 3 +- src/ui/page_headtracker.c | 6 +-- src/ui/page_imagesettings.c | 6 +-- src/ui/page_input.c | 5 ++- src/ui/page_osd.c | 5 ++- src/ui/page_playback.c | 5 ++- src/ui/page_power.c | 6 +-- src/ui/page_record.c | 6 +-- src/ui/page_sleep.c | 4 +- src/ui/page_source.c | 5 ++- src/ui/page_storage.c | 6 +-- src/ui/page_version.c | 5 ++- src/ui/page_wifi.c | 6 +-- src/ui/ui_main_menu.c | 6 +-- src/ui/ui_statusbar.c | 3 +- 24 files changed, 161 insertions(+), 128 deletions(-) create mode 100644 src/core/wallpaper.c create mode 100644 src/core/wallpaper.h 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);