Add "Silent" auto full power off option

This commit is contained in:
Hunter 2018-09-29 19:09:18 -04:00
parent fac8db4238
commit 288b5c08db
3 changed files with 25 additions and 17 deletions

View file

@ -37,7 +37,7 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
| bootwait=3 | 0: Disable (It also disables bootlogo. Having **VOL-** pressed since injection goes to menu.), #: Time to wait for **VOL-** to enter menu. | | bootwait=3 | 0: Disable (It also disables bootlogo. Having **VOL-** pressed since injection goes to menu.), #: Time to wait for **VOL-** to enter menu. |
| customlogo=0 | 0: Use default hekate bootlogo, 1: Use bootlogo.bmp. | | customlogo=0 | 0: Use default hekate bootlogo, 1: Use bootlogo.bmp. |
| verification=2 | 0: Disable Backup/Restore verification, 1: Sparse (block based, fast and not 100% reliable), 2: Full (sha256 based, slow and 100% reliable). | | verification=2 | 0: Disable Backup/Restore verification, 1: Sparse (block based, fast and not 100% reliable), 2: Full (sha256 based, slow and 100% reliable). |
| autohosoff=1 | If woke up from HOS via an rtc alarm, power off completely.| | autohosoff=1 | 0: Disable, 1: If woke up from HOS via an RTC alarm, shows logo, then powers off completely, 2: No logo, immediately powers off.|
| backlight=100 | Screen backlight level. 0-255. | | backlight=100 | Screen backlight level. 0-255. |

View file

@ -645,10 +645,10 @@ void config_auto_hos_poweroff()
gfx_clear_grey(&gfx_ctxt, 0x1B); gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
ment_t *ments = (ment_t *)malloc(sizeof(ment_t) * 5); ment_t *ments = (ment_t *)malloc(sizeof(ment_t) * 6);
u32 *hp_values = (u32 *)malloc(sizeof(u32) * 2); u32 *hp_values = (u32 *)malloc(sizeof(u32) * 3);
for (u32 j = 0; j < 2; j++) for (u32 j = 0; j < 3; j++)
{ {
hp_values[j] = j; hp_values[j] = j;
ments[j + 2].type = MENT_DATA; ments[j + 2].type = MENT_DATA;
@ -660,19 +660,26 @@ void config_auto_hos_poweroff()
ments[1].type = MENT_CHGLINE; ments[1].type = MENT_CHGLINE;
if (h_cfg.autohosoff) if (h_cfg.autohosoff == 1)
{ {
ments[2].caption = " Disable"; ments[2].caption = " Disable";
ments[3].caption = "*Enable"; ments[3].caption = "*Enable";
ments[4].caption = " Enable (No logo)";
}
else if (h_cfg.autohosoff >= 2)
{
ments[2].caption = " Disable";
ments[3].caption = " Enable";
ments[4].caption = "*Enable (No logo)";
} }
else else
{ {
ments[2].caption = "*Disable"; ments[2].caption = "*Disable";
ments[3].caption = " Enable"; ments[3].caption = " Enable";
ments[4].caption = " Enable (No logo)";
} }
memset(&ments[4], 0, sizeof(ment_t)); memset(&ments[5], 0, sizeof(ment_t));
menu_t menu = {ments, "Power off if woke up from HOS", 0, 0}; menu_t menu = {ments, "Power off if woke up from HOS", 0, 0};
u32 *temp_autohosoff = (u32 *)tui_do_menu(&gfx_con, &menu); u32 *temp_autohosoff = (u32 *)tui_do_menu(&gfx_con, &menu);

View file

@ -260,17 +260,18 @@ void check_power_off_from_hos()
if (hosWakeup & MAX77620_IRQ_TOP_RTC_MASK) if (hosWakeup & MAX77620_IRQ_TOP_RTC_MASK)
{ {
sd_unmount(); sd_unmount();
if (h_cfg.autohosoff == 1)
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
u8 *BOOTLOGO = (void *)malloc(0x4000);
blz_uncompress_srcdest(BOOTLOGO_BLZ, SZ_BOOTLOGO_BLZ, BOOTLOGO, SZ_BOOTLOGO);
gfx_set_rect_grey(&gfx_ctxt, BOOTLOGO, X_BOOTLOGO, Y_BOOTLOGO, 326, 544);
gfx_clear_grey(&gfx_ctxt, 0x1B); display_backlight_brightness(10, 5000);
u8 *BOOTLOGO = (void *)malloc(0x4000); display_backlight_brightness(100, 25000);
blz_uncompress_srcdest(BOOTLOGO_BLZ, SZ_BOOTLOGO_BLZ, BOOTLOGO, SZ_BOOTLOGO); usleep(600000);
gfx_set_rect_grey(&gfx_ctxt, BOOTLOGO, X_BOOTLOGO, Y_BOOTLOGO, 326, 544); display_backlight_brightness(0, 20000);
}
display_backlight_brightness(10, 5000);
display_backlight_brightness(100, 25000);
usleep(600000);
display_backlight_brightness(0, 20000);
power_off(); power_off();
} }
} }