File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -434,12 +434,15 @@ void WatchFaceInfineat::Refresh() {
434
434
435
435
batteryPercentRemaining = batteryController.PercentRemaining ();
436
436
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);
439
441
if (chargingBatteryPercent > 100 ) {
440
442
chargingBatteryPercent = batteryPercentRemaining.Get ();
441
443
}
442
444
SetBatteryLevel (chargingBatteryPercent);
445
+ chargingAnimationTick = xTaskGetTickCount ();
443
446
} else if (isCharging.IsUpdated () || batteryPercentRemaining.IsUpdated ()) {
444
447
chargingBatteryPercent = batteryPercentRemaining.Get ();
445
448
SetBatteryLevel (chargingBatteryPercent);
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ namespace Pinetime {
47
47
private:
48
48
uint32_t savedTick = 0 ;
49
49
uint8_t chargingBatteryPercent = 101 ; // not a mistake ;)
50
+ TickType_t chargingAnimationTick = 0 ;
50
51
51
52
Utility::DirtyValue<uint8_t > batteryPercentRemaining {};
52
53
Utility::DirtyValue<bool > isCharging {};
You can’t perform that action at this time.
0 commit comments