Ignore false battery readings if running in emulator

This commit is contained in:
Nicolas Mailloux 2021-12-21 22:27:10 -05:00
parent c24d73bf0b
commit a020f1c093
3 changed files with 24 additions and 15 deletions

View file

@ -58,20 +58,23 @@ int main(int argc, char *argv[])
global::reader::startUsbmsPrompt = false;
// 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");
if(checkconfig_str_val == "Charging\n") {
;
}
else {
global::battery::showCriticalBatteryAlert = true;
QApplication a(argc, argv);
alert w;
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
if(isBatteryCritical() == true) {
string_checkconfig_ro("/sys/devices/platform/pmic_battery.1/power_supply/mc13892_bat/status");
if(checkconfig_str_val == "Charging\n") {
;
}
else {
global::battery::showCriticalBatteryAlert = true;
QApplication a(argc, argv);
alert w;
const QScreen* screen = qApp->primaryScreen();
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
w.show();
return a.exec();
const QScreen* screen = qApp->primaryScreen();
w.setGeometry(QRect(QPoint(0,0), screen->geometry().size()));
w.show();
return a.exec();
}
}
}

View file

@ -328,7 +328,10 @@ MainWindow::MainWindow(QWidget *parent)
}
}
} );
batteryWatchdog->start();
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
batteryWatchdog->start();
}
// USB mass storage prompt
QTimer *usbmsPrompt = new QTimer(this);

View file

@ -675,7 +675,10 @@ reader::reader(QWidget *parent) :
}
}
} );
t->start();
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
t->start();
}
}
// Pages number info label