diff --git a/src/core/main.c b/src/core/main.c index 55d4db49..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" @@ -135,6 +136,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); + + 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); + } } int main(int argc, char *argv[]) { diff --git a/src/core/osd.h b/src/core/osd.h index c5ef4dfe..cdf27fa0 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, @@ -101,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(); - #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 b3132e5b..dc8d3efd 100644 --- a/src/ui/page_autoscan.c +++ b/src/ui/page_autoscan.c @@ -3,6 +3,7 @@ #include #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}; @@ -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..83477ebc 100644 --- a/src/ui/page_clock.c +++ b/src/ui/page_clock.c @@ -9,6 +9,7 @@ #include "core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/rtc.h" #include "ui/page_common.h" #include "ui/ui_attribute.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..47956b8d 100644 --- a/src/ui/page_elrs.c +++ b/src/ui/page_elrs.c @@ -17,6 +17,7 @@ #include "core/common.hh" #include "core/elrs.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/esp32.h" #include "page_version.h" #include "ui/ui_style.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..88a2e805 100644 --- a/src/ui/page_fans.c +++ b/src/ui/page_fans.c @@ -8,6 +8,7 @@ #include "core/app_state.h" #include "core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/fans.h" #include "driver/nct75.h" #include "ui/page_common.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..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,6 +19,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..b3cc92c6 100644 --- a/src/ui/page_headtracker.c +++ b/src/ui/page_headtracker.c @@ -6,6 +6,7 @@ #include "common.hh" #include "core/app_state.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ht.h" #include "page_common.h" #include "ui/ui_style.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..413c48fb 100644 --- a/src/ui/page_imagesettings.c +++ b/src/ui/page_imagesettings.c @@ -6,6 +6,7 @@ #include "core/app_state.h" #include "core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/hardware.h" #include "driver/oled.h" #include "ui/page_common.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..0c7ccff9 100644 --- a/src/ui/page_input.c +++ b/src/ui/page_input.c @@ -7,8 +7,9 @@ #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 "core/wallpaper.h" #include "ui/page_fans.h" #include "ui/ui_image_setting.h" @@ -37,10 +38,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 +52,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 +169,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 +180,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 +251,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 +280,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 +288,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..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,6 +45,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 +56,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..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,6 +43,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 +52,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..4d1c1883 100644 --- a/src/ui/page_power.c +++ b/src/ui/page_power.c @@ -9,6 +9,7 @@ #include "core/battery.h" #include "core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/dm5680.h" #include "driver/hardware.h" #include "driver/mcp3021.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..90e46c4b 100644 --- a/src/ui/page_record.c +++ b/src/ui/page_record.c @@ -6,6 +6,7 @@ #include "../core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "driver/rtc.h" #include "page_common.h" #include "ui/ui_style.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..f72f5dc9 100644 --- a/src/ui/page_sleep.c +++ b/src/ui/page_sleep.c @@ -1,5 +1,6 @@ #include "page_sleep.h" +#include "core/wallpaper.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..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,6 +40,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 +51,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 +82,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..8c0ad141 100644 --- a/src/ui/page_storage.c +++ b/src/ui/page_storage.c @@ -8,6 +8,7 @@ #include "core/common.hh" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/page_playback.h" #include "util/filesystem.h" #include "util/sdcard.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..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,6 +767,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 +778,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..c1ff476f 100644 --- a/src/ui/page_wifi.c +++ b/src/ui/page_wifi.c @@ -15,6 +15,7 @@ #include "core/common.hh" #include "core/dvr.h" #include "core/settings.h" +#include "core/wallpaper.h" #include "ui/page_common.h" #include "ui/ui_attribute.h" #include "ui/ui_keyboard.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..bab5dccb 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/wallpaper.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); @@ -308,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); diff --git a/src/ui/ui_statusbar.c b/src/ui/ui_statusbar.c index 61506164..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,6 +54,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);