From 8b85d2856eff81b118cb295591c896feef377ba2 Mon Sep 17 00:00:00 2001 From: John Crawford Date: Wed, 4 Oct 2023 17:32:00 -0600 Subject: [PATCH] feat: open battery app when charging --- src/displayapp/DisplayApp.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index cd941f16..fecec51a 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -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; } }