diff options
| author | Steveis <SteveAmor@users.noreply.github.com> | 2025-02-26 23:16:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 23:16:20 +0000 |
| commit | 728da0f4a08d327344aeaf4bf2730a0ce74ab74f (patch) | |
| tree | 088f7d2ed32d7b2ddcf870a1753e407057e36ca7 /src/displayapp/screens/WatchFaceInfineat.cpp | |
| parent | 993118a3bc5400e0b09a58fa1aa0bc8ae72634a2 (diff) | |
Fix Infineat crash when charging with AOD (#2256)
Optimise the battery animation to not use 100% CPU (which causes DisplayApp to spin forever with AOD)
(DisplayApp also needs to be fixed in the future so it cannot spin infinitely)
Diffstat (limited to 'src/displayapp/screens/WatchFaceInfineat.cpp')
| -rw-r--r-- | src/displayapp/screens/WatchFaceInfineat.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 4c6fc196..40f2abbb 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -434,12 +434,15 @@ void WatchFaceInfineat::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); isCharging = batteryController.IsCharging(); - if (batteryController.IsCharging()) { // Charging battery animation - chargingBatteryPercent += 1; + // Charging battery animation + if (batteryController.IsCharging() && (xTaskGetTickCount() - chargingAnimationTick > pdMS_TO_TICKS(150))) { + // Dividing 100 by the height gives the battery percentage required to shift the animation by 1 pixel + chargingBatteryPercent += 100 / lv_obj_get_height(logoPine); if (chargingBatteryPercent > 100) { chargingBatteryPercent = batteryPercentRemaining.Get(); } SetBatteryLevel(chargingBatteryPercent); + chargingAnimationTick = xTaskGetTickCount(); } else if (isCharging.IsUpdated() || batteryPercentRemaining.IsUpdated()) { chargingBatteryPercent = batteryPercentRemaining.Get(); SetBatteryLevel(chargingBatteryPercent); |
