Skip to content

Commit 3e7ac7c

Browse files
authored
Merge branch 'main' into vibration-settings-2
2 parents 3611944 + 728da0f commit 3e7ac7c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/displayapp/screens/WatchFaceInfineat.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,15 @@ void WatchFaceInfineat::Refresh() {
434434

435435
batteryPercentRemaining = batteryController.PercentRemaining();
436436
isCharging = batteryController.IsCharging();
437-
if (batteryController.IsCharging()) { // Charging battery animation
438-
chargingBatteryPercent += 1;
437+
// Charging battery animation
438+
if (batteryController.IsCharging() && (xTaskGetTickCount() - chargingAnimationTick > pdMS_TO_TICKS(150))) {
439+
// Dividing 100 by the height gives the battery percentage required to shift the animation by 1 pixel
440+
chargingBatteryPercent += 100 / lv_obj_get_height(logoPine);
439441
if (chargingBatteryPercent > 100) {
440442
chargingBatteryPercent = batteryPercentRemaining.Get();
441443
}
442444
SetBatteryLevel(chargingBatteryPercent);
445+
chargingAnimationTick = xTaskGetTickCount();
443446
} else if (isCharging.IsUpdated() || batteryPercentRemaining.IsUpdated()) {
444447
chargingBatteryPercent = batteryPercentRemaining.Get();
445448
SetBatteryLevel(chargingBatteryPercent);

src/displayapp/screens/WatchFaceInfineat.h

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace Pinetime {
4747
private:
4848
uint32_t savedTick = 0;
4949
uint8_t chargingBatteryPercent = 101; // not a mistake ;)
50+
TickType_t chargingAnimationTick = 0;
5051

5152
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
5253
Utility::DirtyValue<bool> isCharging {};

0 commit comments

Comments
 (0)