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 3a0d673df4
commit 6d55842fc5

View file

@ -447,7 +447,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;
}
}