From 9d403329ad1ad1d6ef3acb936e617666aa902a6f Mon Sep 17 00:00:00 2001 From: BirdZhang <0312birdzhang@gmail.com> Date: Thu, 29 Aug 2019 13:40:58 +0800 Subject: Do not divide by battery size if percent less than 0.01 --- src/service.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index 06a74de..be17a55 100644 --- a/src/service.c +++ b/src/service.c @@ -1342,10 +1342,12 @@ create_totalled_battery_device (const GList * devices) const time_t t = indicator_power_device_get_time (walk); const UpDeviceState state = indicator_power_device_get_state (walk); - ++n_batteries; if (percent > 0.01) - sum_percent += percent; + { + sum_percent += percent; + ++n_batteries; + } if (state == UP_DEVICE_STATE_CHARGING) { -- cgit v1.2.3