Introduction
Introduction Statistics Contact Development Disclaimer Help
tbatt.c: show power consumption - spoon - [fork] customized build of spoon, the…
git clone git://src.adamsgaard.dk/spoon
Log
Files
Refs
LICENSE
---
commit b351340dc924cffe79aefc12700c2d6f0ea3d7e6
parent 7365d31d3c34ce9d6ae191a4e38a9817199cf22c
Author: Anders Damsgaard <[email protected]>
Date: Wed, 31 Aug 2022 22:18:33 +0200
batt.c: show power consumption
Diffstat:
M batt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/batt.c b/batt.c
t@@ -10,16 +10,17 @@ char *crit[] = {
};
void
-battprint(char *buf, size_t len, int acon, int life, int remain)
+battprint(char *buf, size_t len, int acon, int life, int remain, int power)
{
char c;
static int frame = 0;
c = acon ? '=' : ' ';
if (c == ' ' && remain != 0)
- snprintf(buf, len, " %d%% %d:%02d |", life, remain/60, remain%…
+ snprintf(buf, len, " %d%% %d:%02d (%.2g W) |",
+ life, remain/60, remain%60, (float)power/1000000);
else
- snprintf(buf, len, " %d%% |", life);
+ snprintf(buf, len, " %d%% (%.2g W) |", life, (float)power/1000…
}
t@@ -94,7 +95,7 @@ battread(void *arg, char *buf, size_t len)
}
fscanf(fp, "%d", &power);
fclose(fp);
- battprint(buf, len, acon, life, (float)energy / power * 60.0);
+ battprint(buf, len, acon, life, (float)energy / power * 60.0, power);
return 0;
}
#endif
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.