Implement Auto Reboot Timer (#518)

This commit is contained in:
Sun 2019-04-21 22:21:05 -07:00
parent a09c08994f
commit 650ee8fd97
3 changed files with 12 additions and 0 deletions

View File

@ -84,5 +84,10 @@ void InitializeFatalConfig() {
setsysGetFlag(SetSysFlag_Quest, &config->quest_flag);
if(R_FAILED(setsysGetSettingsItemValue("atmosphere", "fatal_auto_reboot_interval", &config->fatal_auto_reboot_interval, sizeof(config->fatal_auto_reboot_interval)))) {
config->fatal_auto_reboot_interval = -1;
}
SetupConfigLanguages();
}

View File

@ -29,6 +29,7 @@ struct FatalConfig {
const char *error_msg;
const char *error_desc;
const char *quest_desc;
s64 fatal_auto_reboot_interval;
};
IEvent *GetFatalSettingsEvent();

View File

@ -96,6 +96,12 @@ void PowerButtonObserveTask::WaitForPowerButton() {
const FatalConfig *config = GetFatalConfig();
TimeoutHelper reboot_helper(config->quest_reboot_interval_second * 1000000000UL);
if (config->fatal_auto_reboot_interval != -1) {
svcSleepThread(config->fatal_auto_reboot_interval);
bpcRebootSystem();
return;
}
bool check_vol_up = true, check_vol_down = true;
GpioPadSession vol_up_btn, vol_down_btn;
if (R_FAILED(gpioOpenSession(&vol_up_btn, GpioPadName_ButtonVolUp))) {