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:
@@ -109,6 +109,7 @@ private:
|
||||
|
||||
ButtonControl *updateTime;
|
||||
|
||||
int deviceShutdown;
|
||||
int schedule;
|
||||
int time;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user