Device shut down timer

Added toggle to shut down the device after being offroad for a specified amount of time.
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent 3af959128d
commit e3bfe75ca2
6 changed files with 46 additions and 3 deletions

View File

@@ -109,6 +109,7 @@ private:
ButtonControl *updateTime;
int deviceShutdown;
int schedule;
int time;
};

View File

@@ -62,6 +62,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
}
});
time = params.getInt("UpdateTime");
deviceShutdown = params.getInt("DeviceShutdown") * 3600;
updateTime->setValue(hours[time]);
addItem(updateTime);
@@ -216,7 +217,7 @@ void SoftwarePanel::automaticUpdate() {
static bool isDownloadCompleted = false;
if (isDownloadCompleted && params.getBool("UpdateAvailable")) {
params.putBool(true);
params.putBool(timer > deviceShutdown ? "DoShutdown" : "DoReboot", true);
return;
}