Menu core: improved OSD timeout, hide logo as well, darked the screen after double timeout.

This commit is contained in:
sorgelig
2019-06-04 15:49:06 +08:00
parent 6965cf08a7
commit d78a41aa31
7 changed files with 93 additions and 41 deletions

View File

@@ -19,6 +19,8 @@ menu_pal=0 ; 1 - PAL mode for menu core
hdmi_limited=0 ; 1 - use limited (16..235) color range over HDMI
fb_size=0 ; 0 - automatic, 1 - full size, 2 - 1/2 of resolution, 4 - 1/4 of resolution.
fb_terminal=1 ; 1 - enabled (default), 0 - disabled
osd_timeout=30 ; 5-3600 timeout (in seconds) for OSD to disappear in Menu core. 30 seconds if not set.
; Background picture will get darker after double timout
; lastcore - Autoboot the last loaded core (corename autosaved in CONFIG/lastcore.dat) first found on the SD/USB
; lastexactcore - Autoboot the last loaded exact core (corename_yyyymmdd.rbf autosaved in CONFIG/lastcore.dat) first found on the SD/USB

View File

@@ -53,6 +53,7 @@ const ini_var_t ini_vars[] = {
{ "FONT", (void*)(&(cfg.font)), STRING, 0, sizeof(cfg.font) - 1, 1 },
{ "FB_SIZE", (void*)(&(cfg.fb_size)), UINT8, 1, 4, 1 },
{ "FB_TERMINAL", (void*)(&(cfg.fb_terminal)), UINT8, 0, 1, 1 },
{ "OSD_TIMEOUT", (void*)(&(cfg.osd_timeout)), INT16, 5, 3600, 1 },
};
// mist ini config

1
cfg.h
View File

@@ -36,6 +36,7 @@ typedef struct {
int16_t bootcore_timeout;
uint8_t fb_size;
uint8_t fb_terminal;
uint16_t osd_timeout;
char bootcore[256];
char video_conf[1024];
char video_conf_pal[1024];

View File

@@ -810,12 +810,21 @@ void HandleUI(void)
{
static int menu_visible = 1;
static unsigned long timeout = 0;
if (!video_fb_state() && video_bg_has_picture())
if (!video_fb_state() && cfg.fb_terminal)
{
if (timeout && menu_visible && CheckTimer(timeout))
if (timeout && CheckTimer(timeout))
{
menu_visible = 0;
spi_osd_cmd(MM1_OSDCMDDISABLE);
timeout = 0;
if (menu_visible)
{
menu_visible = 0;
video_menu_bg((user_io_8bit_set_status(0, 0) & 0xE) >> 1, 1);
spi_osd_cmd(MM1_OSDCMDDISABLE);
}
else
{
video_menu_bg((user_io_8bit_set_status(0, 0) & 0xE) >> 1, 2);
}
}
if (c || menustate != MENU_FILE_SELECT2)
@@ -825,12 +834,17 @@ void HandleUI(void)
{
c = 0;
menu_visible = 1;
video_menu_bg((user_io_8bit_set_status(0, 0) & 0xE) >> 1);
spi_osd_cmd(MM1_OSDCMDWRITE | 8);
spi_osd_cmd(MM1_OSDCMDENABLE);
}
}
if (!timeout) timeout = GetTimer(120000);
if (!timeout)
{
if (!cfg.osd_timeout) cfg.osd_timeout = 30;
timeout = GetTimer(cfg.osd_timeout*1000);
}
}
else
{
@@ -851,7 +865,7 @@ void HandleUI(void)
break;
case KEY_F1:
if (is_menu_core())
if (is_menu_core() && cfg.fb_terminal)
{
unsigned long status = (user_io_8bit_set_status(0, 0)+ 2) & 0xE;
user_io_8bit_set_status(status, 0xE);

View File

@@ -597,7 +597,8 @@ void user_io_init(const char *path)
if (is_menu_core())
{
user_io_8bit_set_status((cfg.menu_pal) ? 0x10 : 0, 0x10);
video_menu_bg((status >> 1) & 7);
if (cfg.fb_terminal) video_menu_bg((status >> 1) & 7);
else user_io_8bit_set_status(0, 0xE);
}
else
{

View File

@@ -28,10 +28,10 @@
#define FB_ADDR (0x20000000 + (32*1024*1024)) // 512mb + 32mb(Core's fb)
/*
-- [2:0] : 011=8bpp(palette) 100=16bpp 101=24bpp 110=32bpp
-- [3] : 0=16bits 565 1=16bits 1555
-- [4] : 0=RGB 1=BGR (for 16/24/32 modes)
-- [5] : TBD
-- [2:0] : 011=8bpp(palette) 100=16bpp 101=24bpp 110=32bpp
-- [3] : 0=16bits 565 1=16bits 1555
-- [4] : 0=RGB 1=BGR (for 16/24/32 modes)
-- [5] : TBD
*/
#define FB_FMT_565 0b00100
@@ -857,7 +857,7 @@ static void vs_wait()
static int bg_has_picture = 0;
extern uint8_t _binary_logo_png_start[], _binary_logo_png_end[];
void video_menu_bg(int n)
void video_menu_bg(int n, int idle)
{
bg_has_picture = 0;
menu_bg = n;
@@ -909,6 +909,21 @@ void video_menu_bg(int n)
Imlib_Image *bg = (menu_bgn == 1) ? &bg1 : &bg2;
//printf("*bg = %p\n", *bg);
static Imlib_Image curtain = 0;
if (!curtain)
{
curtain = imlib_create_image(fb_width, fb_height);
imlib_context_set_image(curtain);
imlib_image_set_has_alpha(1);
uint32_t *data = imlib_image_get_data();
int sz = fb_width * fb_height;
for (int i = 0; i < sz; i++)
{
*data++ = 0x9F000000;
}
}
switch (n)
{
case 1:
@@ -949,7 +964,7 @@ void video_menu_bg(int n)
if (*bg)
{
imlib_context_set_image(*bg);
imlib_blend_image_onto_image(menubg, 255,
imlib_blend_image_onto_image(menubg, 0,
0, 0, //int source_x, int source_y,
src_w, src_h, //int source_width, int source_height,
0, 0, //int destination_x, int destination_y,
@@ -990,7 +1005,7 @@ void video_menu_bg(int n)
break;
}
if (logo)
if (logo && !idle)
{
imlib_context_set_image(logo);
@@ -1001,7 +1016,7 @@ void video_menu_bg(int n)
if (*bg)
{
imlib_context_set_image(*bg);
imlib_blend_image_onto_image(logo, 255,
imlib_blend_image_onto_image(logo, 1,
0, 0, //int source_x, int source_y,
src_w, src_h, //int source_width, int source_height,
0, 0, //int destination_x, int destination_y,
@@ -1014,6 +1029,24 @@ void video_menu_bg(int n)
}
}
if (curtain && idle > 1)
{
if (*bg)
{
imlib_context_set_image(*bg);
imlib_blend_image_onto_image(curtain, 1,
0, 0, //int source_x, int source_y,
fb_width, fb_height, //int source_width, int source_height,
0, 0, //int destination_x, int destination_y,
fb_width, fb_height //int destination_width, int destination_height
);
}
}
else
{
printf("curtain = 0!\n");
}
//test the fb driver
vs_wait();
printf("**** BG DEBUG END ****\n");
@@ -1098,31 +1131,31 @@ void video_cmd(char *cmd)
if (accept)
{
switch (fmt)
{
case 8888:
bpp = 4;
sc_fmt = FB_FMT_8888;
break;
case 1555:
bpp = 2;
sc_fmt = FB_FMT_1555;
break;
case 565:
bpp = 2;
sc_fmt = FB_FMT_565;
break;
case 8:
bpp = 1;
sc_fmt = FB_FMT_PAL8;
rb = 0;
break;
default:
accept = 0;
switch (fmt)
{
case 8888:
bpp = 4;
sc_fmt = FB_FMT_8888;
break;
case 1555:
bpp = 2;
sc_fmt = FB_FMT_1555;
break;
case 565:
bpp = 2;
sc_fmt = FB_FMT_565;
break;
case 8:
bpp = 1;
sc_fmt = FB_FMT_PAL8;
rb = 0;
break;
default:
accept = 0;
}
}

View File

@@ -13,7 +13,7 @@ int hasAPI1_5();
void video_fb_enable(int enable, int n = 0);
int video_fb_state();
void video_menu_bg(int n);
void video_menu_bg(int n, int idle = 0);
int video_bg_has_picture();
int video_chvt(int num);
void video_cmd(char *cmd);