From d637e11ee52d49a52713e02ce5d7d17fee8b4cc8 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Thu, 30 May 2019 00:47:38 +0800 Subject: [PATCH] Hide OSD after timeout if background picture is present. --- menu.cpp | 33 +++++++++++++++++++++++++++++++++ video.cpp | 8 ++++++++ video.h | 1 + 3 files changed, 42 insertions(+) diff --git a/menu.cpp b/menu.cpp index fee2479..c257304 100644 --- a/menu.cpp +++ b/menu.cpp @@ -806,6 +806,39 @@ void HandleUI(void) cfg.bootcore[0] = '\0'; } + if (is_menu_core()) + { + static int menu_visible = 1; + static unsigned long timeout = 0; + if (!video_fb_state() && video_bg_has_picture()) + { + if (timeout && menu_visible && CheckTimer(timeout)) + { + menu_visible = 0; + spi_osd_cmd(MM1_OSDCMDDISABLE); + } + + if (c || menustate != MENU_FILE_SELECT2) + { + timeout = 0; + if (!menu_visible) + { + c = 0; + menu_visible = 1; + spi_osd_cmd(MM1_OSDCMDWRITE | 8); + spi_osd_cmd(MM1_OSDCMDENABLE); + } + } + + if (!timeout) timeout = GetTimer(120000); + } + else + { + timeout = 0; + menu_visible = 1; + } + } + //prevent OSD control while script is executing on framebuffer if (!video_fb_state() || video_chvt(0) != 2) { diff --git a/video.cpp b/video.cpp index 0688c6c..5fe87a3 100644 --- a/video.cpp +++ b/video.cpp @@ -854,9 +854,11 @@ static void vs_wait() printf("vs_wait(us): %llu\n", t2 - t1); } +static int bg_has_picture = 0; extern uint8_t _binary_logo_png_start[], _binary_logo_png_end[]; void video_menu_bg(int n) { + bg_has_picture = 0; menu_bg = n; if (n) { @@ -952,6 +954,7 @@ void video_menu_bg(int n) 0, 0, //int destination_x, int destination_y, fb_width, fb_height //int destination_width, int destination_height ); + bg_has_picture = 1; break; } else @@ -1018,6 +1021,11 @@ void video_menu_bg(int n) video_fb_enable(0); } +int video_bg_has_picture() +{ + return bg_has_picture; +} + int video_chvt(int num) { static int cur_vt = 0; diff --git a/video.h b/video.h index 6c6647d..a1471f0 100644 --- a/video.h +++ b/video.h @@ -14,6 +14,7 @@ int hasAPI1_5(); void video_fb_enable(int enable, int n = 0); int video_fb_state(); void video_menu_bg(int n); +int video_bg_has_picture(); int video_chvt(int num); void video_cmd(char *cmd);