feat: open battery app when charging

This commit is contained in:
John Crawford 2023-10-04 17:32:00 -06:00 committed by Victor Kareh
parent 997e4cee8c
commit 8f68c67718

View file

@ -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;
}
}