mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] AppsContainer: 'shutdownDueToLowBattery' can be call when the
battery is actually LOW (due to some oscillations between LOW and EMPTY). Handle that case
This commit is contained in:
@@ -312,6 +312,14 @@ void AppsContainer::displayExamModePopUp(bool activate) {
|
||||
}
|
||||
|
||||
void AppsContainer::shutdownDueToLowBattery() {
|
||||
if (Ion::Battery::level() != Ion::Battery::Charge::EMPTY) {
|
||||
/* We early escape here. When the battery switches from LOW to EMPTY, it
|
||||
* oscillates a few times before stabilizing to EMPTY. So we might call
|
||||
* 'shutdownDueToLowBattery' but the battery level still answers LOW instead
|
||||
* of EMPTY. We want to avoid uselessly redrawing the whole window in that
|
||||
* case. */
|
||||
return;
|
||||
}
|
||||
while (Ion::Battery::level() == Ion::Battery::Charge::EMPTY) {
|
||||
Ion::Backlight::setBrightness(0);
|
||||
m_emptyBatteryWindow.redraw(true);
|
||||
|
||||
Reference in New Issue
Block a user