From dab8e3ed1fad3417771abd3345f8c67ca44eeadd Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 13 Jul 2007 16:23:43 +0200 Subject: [PATCH] Handle fully charged state. --- Makefile | 2 +- batt.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ff28ffe..90348c1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -W all: @echo "Please choose what to make:" - @grep '^[^ ]*:' Makefile + @grep '^[^ ]*:' Makefile | grep -v = parrot: parrot.c diff --git a/batt.c b/batt.c index eadab59..d1a2768 100644 --- a/batt.c +++ b/batt.c @@ -82,7 +82,7 @@ static void scan_batt(void) else { if (rate <= 0) - total_discharge += 359999; + total_discharge += 1000000; else total_discharge += remains*3600 / rate; } @@ -100,12 +100,10 @@ static void show(void) p += sprintf(p, "%d%%", 100*total_full/total_capa); else p += sprintf(p, "??%%"); - if (total_discharge) + if (total_discharge && total_discharge < 1000000) p += sprintf(p, " %d:%02d remains", total_discharge/3600, (total_discharge/60)%60); else if (total_charge) p += sprintf(p, " %d:%02d charging", total_charge/3600, (total_charge/60)%60); - else - p += sprintf(p, " ????"); xosd_display(osd, 0, XOSD_string, status); } -- 2.39.2