Skip to content

Commit 7198b5b

Browse files
committed
Prevent blocking when Infineat watchface is charging
1 parent 993118a commit 7198b5b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/displayapp/screens/WatchFaceInfineat.cpp

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

435435
batteryPercentRemaining = batteryController.PercentRemaining();
436436
isCharging = batteryController.IsCharging();
437-
if (batteryController.IsCharging()) { // Charging battery animation
438-
chargingBatteryPercent += 1;
437+
if (batteryController.IsCharging() && (uint32_t(lv_tick_get() - savedAnimationTick) > 150)) { // Charging battery animation
438+
chargingBatteryPercent += 3; // 100% / pine_small height = 3
439439
if (chargingBatteryPercent > 100) {
440440
chargingBatteryPercent = batteryPercentRemaining.Get();
441441
}
442442
SetBatteryLevel(chargingBatteryPercent);
443+
savedAnimationTick = lv_tick_get();
443444
} else if (isCharging.IsUpdated() || batteryPercentRemaining.IsUpdated()) {
444445
chargingBatteryPercent = batteryPercentRemaining.Get();
445446
SetBatteryLevel(chargingBatteryPercent);

src/displayapp/screens/WatchFaceInfineat.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ namespace Pinetime {
4646

4747
private:
4848
uint32_t savedTick = 0;
49+
uint32_t savedAnimationTick = 0;
4950
uint8_t chargingBatteryPercent = 101; // not a mistake ;)
5051

5152
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};

0 commit comments

Comments
 (0)