feat: open battery app when charging

This commit is contained in:
John Crawford 2023-10-04 17:32:00 -06:00
parent 3a7dfdba8e
commit 8b85d2856e

View file

@ -362,7 +362,16 @@ void DisplayApp::Refresh() {
break;
case Messages::OnChargingEvent:
RestoreBrightness();
motorController.RunForDuration(15);
if (batteryController.IsCharging() && currentApp == Apps::Clock) {
// Open the battery app if on the clock screen
LoadNewScreen(Apps::BatteryInfo, DisplayApp::FullRefreshDirections::None);
} else if (!batteryController.IsCharging() && currentApp == Apps::BatteryInfo) {
// Close the battery app after being unplugged
LoadNewScreen(Apps::Clock, DisplayApp::FullRefreshDirections::None);
} else {
// Vibrate normally otherwise as to not close any open app
motorController.RunForDuration(15);
}
break;
}
}