From 1864d68961b65bc807287cb771642162f4918b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 5 Jun 2020 13:44:38 +0200 Subject: [PATCH] module/battery: don't need 'energy' unless we're estimating time left --- modules/battery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/battery.c b/modules/battery.c index 2a70fa4..9bde2f6 100644 --- a/modules/battery.c +++ b/modules/battery.c @@ -63,13 +63,13 @@ content(struct module *mod) m->state == STATE_CHARGING || m->state == STATE_DISCHARGING); - unsigned long energy = m->state == STATE_CHARGING - ? m->energy_full - m->energy : m->energy; - unsigned long hours; unsigned long minutes; if (m->time_to_empty < 0) { + unsigned long energy = m->state == STATE_CHARGING + ? m->energy_full - m->energy : m->energy; + double hours_as_float; if (m->state == STATE_FULL) hours_as_float = 0.0;