]> mj.ucw.cz Git - misc.git/commitdiff
Handle fully charged state.
authorMartin Mares <mj@ucw.cz>
Fri, 13 Jul 2007 14:23:43 +0000 (16:23 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 13 Jul 2007 14:23:43 +0000 (16:23 +0200)
Makefile
batt.c

index ff28ffef316839973c9c61509545c5e035c942f4..90348c1260732e9e3af447b6fdd3fb4363ceb5c3 100644 (file)
--- 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 eadab5908455adc76cce3069ba0bcf998a9d0cce..d1a2768214a609a8f88cf1a8cd9140cc78566c4d 100644 (file)
--- 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);
 }