infineat: Battery display simplification
This commit is contained in:
parent
a3a4091e03
commit
52bc0cd623
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user