infineat: Battery display simplification

This commit is contained in:
Riku Isokoski 2023-01-21 13:30:10 +02:00
parent a3a4091e03
commit 52bc0cd623

View file

@ -409,17 +409,13 @@ void WatchFaceInfineat::Refresh() {
batteryPercentRemaining = batteryController.PercentRemaining(); batteryPercentRemaining = batteryController.PercentRemaining();
isCharging = batteryController.IsCharging(); isCharging = batteryController.IsCharging();
// We store if battery and charging are updated before calling Get(), if (batteryController.IsCharging()) { // Charging battery animation
// since Get() sets isUpdated to false.
bool isBatteryUpdated = batteryPercentRemaining.IsUpdated();
bool isChargingUpdated = isCharging.IsUpdated();
if (isCharging.Get()) { // Charging battery animation
chargingBatteryPercent += 1; chargingBatteryPercent += 1;
if (chargingBatteryPercent > 100) { if (chargingBatteryPercent > 100) {
chargingBatteryPercent = batteryPercentRemaining.Get(); chargingBatteryPercent = batteryPercentRemaining.Get();
} }
SetBatteryLevel(chargingBatteryPercent); SetBatteryLevel(chargingBatteryPercent);
} else if (isChargingUpdated || isBatteryUpdated) { } else if (isCharging.IsUpdated() || batteryPercentRemaining.IsUpdated()) {
chargingBatteryPercent = batteryPercentRemaining.Get(); chargingBatteryPercent = batteryPercentRemaining.Get();
SetBatteryLevel(chargingBatteryPercent); SetBatteryLevel(chargingBatteryPercent);
} }