mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-22 18:06:40 +00:00
[Main] Filter POWER button down
And remove uneeded double press protection through sleep().
This commit is contained in:
parent
997e250c43
commit
81eb1d0972
2 changed files with 18 additions and 16 deletions
15
ipl/btn.c
15
ipl/btn.c
|
@ -34,9 +34,24 @@ u32 btn_read()
|
|||
u32 btn_wait()
|
||||
{
|
||||
u32 res = 0, btn = btn_read();
|
||||
int pwr = 0;
|
||||
|
||||
// Power button down, raise a filter.
|
||||
if (btn & BTN_POWER)
|
||||
{
|
||||
pwr = 1;
|
||||
btn &= 0xFFFFFFFE;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
res = btn_read();
|
||||
// Power button up, remove filter.
|
||||
if (!(res & BTN_POWER) && pwr)
|
||||
pwr = 0;
|
||||
// Power button still down.
|
||||
else if (pwr)
|
||||
res &= 0xFFFFFFFE;
|
||||
} while (btn == res);
|
||||
return res;
|
||||
}
|
||||
|
|
19
ipl/main.c
19
ipl/main.c
|
@ -344,14 +344,11 @@ void print_fuseinfo()
|
|||
|
||||
gfx_puts(&gfx_con, "\nPress POWER to dump them to SD Card.\nPress VOL to go to the menu.\n");
|
||||
|
||||
sleep(1000000);
|
||||
|
||||
u32 btn = btn_wait();
|
||||
if (btn & BTN_POWER)
|
||||
{
|
||||
if (sd_mount())
|
||||
{
|
||||
FIL fuseFp;
|
||||
char fuseFilename[9];
|
||||
memcpy(fuseFilename, "fuse.bin", 8);
|
||||
fuseFilename[8] = 0;
|
||||
|
@ -361,7 +358,7 @@ void print_fuseinfo()
|
|||
else
|
||||
gfx_puts(&gfx_con, "\nDone!\n");
|
||||
}
|
||||
sleep(2000000);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
}
|
||||
|
@ -380,14 +377,11 @@ void print_kfuseinfo()
|
|||
|
||||
gfx_puts(&gfx_con, "\nPress POWER to dump them to SD Card.\nPress VOL to go to the menu.\n");
|
||||
|
||||
sleep(1000000);
|
||||
|
||||
u32 btn = btn_wait();
|
||||
if (btn & BTN_POWER)
|
||||
{
|
||||
if (sd_mount())
|
||||
{
|
||||
FIL kfuseFp;
|
||||
char kfuseFilename[10];
|
||||
memcpy(kfuseFilename, "kfuse.bin", 9);
|
||||
kfuseFilename[9] = 0;
|
||||
|
@ -397,7 +391,7 @@ void print_kfuseinfo()
|
|||
else
|
||||
gfx_puts(&gfx_con, "\nDone!\n");
|
||||
}
|
||||
sleep(2000000);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +535,6 @@ void print_mmc_info()
|
|||
|
||||
out:
|
||||
sdmmc_storage_end(&storage);
|
||||
sleep(1000000);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
|
@ -594,8 +587,6 @@ void print_sdcard_info()
|
|||
sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF, sd_fs.csize * 512);
|
||||
}
|
||||
|
||||
sleep(1000000);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
@ -640,7 +631,6 @@ void print_tsec_key()
|
|||
out:;
|
||||
free(pkg1);
|
||||
sdmmc_storage_end(&storage);
|
||||
sleep(1000000);
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1004,6 @@ static void dump_emmc_selected(dumpType_t dumpType)
|
|||
gfx_puts(&gfx_con, "\nDone. Press any key.\n");
|
||||
|
||||
out:;
|
||||
sleep(1000000);
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1088,7 @@ out:;
|
|||
free(pkg1);
|
||||
free(secmon);
|
||||
free(warmboot);
|
||||
sleep(1000000);
|
||||
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
@ -1187,7 +1176,6 @@ void toggle_autorcm(){
|
|||
gfx_printf(&gfx_con, "%kAutoRCM mode toggled!%k\n", 0xFF00EE2C, 0xFFCCCCCC);
|
||||
|
||||
out:;
|
||||
sleep(1000000);
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
@ -1225,7 +1213,6 @@ void about()
|
|||
gfx_printf(&gfx_con, octopus, 0xFFFFCC00, 0xFFCCCCCC,
|
||||
0xFFFFCC00, 0xFFCCFF00, 0xFFFFCC00, 0xFFCCCCCC);
|
||||
|
||||
sleep(1000000);
|
||||
btn_wait();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue