mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
feat: open battery app when charging
This commit is contained in:
parent
a2356f2f4a
commit
29bc698a44
|
@ -454,7 +454,24 @@ void DisplayApp::Refresh() {
|
|||
motorController.RunForDuration(35);
|
||||
break;
|
||||
case Messages::OnChargingEvent:
|
||||
motorController.RunForDuration(15);
|
||||
switch (currentApp) {
|
||||
case Apps::Clock:
|
||||
if (batteryController.IsCharging() && settingsController.IsAutoOpenOn(Controllers::Settings::AutoOpen::Battery)) {
|
||||
// Open the battery app if on the clock screen
|
||||
LoadNewScreen(Apps::BatteryInfo, DisplayApp::FullRefreshDirections::None);
|
||||
}
|
||||
break;
|
||||
case Apps::BatteryInfo:
|
||||
if (!batteryController.IsCharging()) {
|
||||
// Close the battery app after being unplugged
|
||||
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Vibrate normally otherwise as to not close any open app
|
||||
motorController.RunForDuration(15);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue