Tell shell scripts that we're running

This commit is contained in:
Nicolas Mailloux 2021-06-28 12:26:04 -04:00
parent 08b8951750
commit 01ee2eaf87
2 changed files with 11 additions and 2 deletions

View file

@ -30,6 +30,9 @@
int main(int argc, char *argv[])
{
// Tell scripts that we're currently running
string_writeconfig("/tmp/inkbox_running", "true");
// Checking if battery level is critical; if true (and if it is not charging), then display a "Please charge your eReader" splash and power off.
if(isBatteryCritical() == true) {
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");

View file

@ -275,8 +275,14 @@ MainWindow::MainWindow(QWidget *parent)
}
else {
if(isBatteryCritical() == true) {
qDebug() << "Warning! Battery is at a critical charge level!";
openCriticalBatteryAlertWindow();
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
if(checkconfig_str_val == "Charging\n") {
;
}
else {
qDebug() << "Warning! Battery is at a critical charge level!";
openCriticalBatteryAlertWindow();
}
}
}