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,6 +58,8 @@ 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.
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") {
@ -74,6 +76,7 @@ int main(int argc, char *argv[])
return a.exec();
}
}
}
// Checking if there has been an ALERT flag set up, and if there is, show a big warning
if(checkconfig("/external_root/boot/flags/ALERT") == true) {

View file

@ -328,7 +328,10 @@ MainWindow::MainWindow(QWidget *parent)
}
}
} );
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,8 +675,11 @@ reader::reader(QWidget *parent) :
}
}
} );
string_checkconfig_ro("/opt/inkbox_device");
if(checkconfig_str_val != "emu\n") {
t->start();
}
}
// Pages number info label
if(is_epub == true) {