diff options
| author | 0scar <qgt268@alumni.ku.dk> | 2024-10-31 21:51:11 +0000 |
|---|---|---|
| committer | 0scar <qgt268@alumni.ku.dk> | 2024-10-31 21:51:11 +0000 |
| commit | 15efcd8b6e9a26ec07edc15b21259da7e1895a1d (patch) | |
| tree | b134cf49e80636ab5ac7f613a3fe6652bcd5f7f6 /status.c | |
| parent | 1480b613be6746335335dd78b5feb3cef4c80edd (diff) | |
Show other battery + hide debug info
Diffstat (limited to 'status.c')
| -rw-r--r-- | status.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -90,6 +90,11 @@ struct battery_status get_battery_status(const char* buf) { return (struct battery_status){.status = bat_unknown, .charge = (float)charge / capacity}; } +void get_battery1_status(char* buf) { + struct battery_status s = get_battery_status("BAT1"); + + snprintf(buf, ELEMENT_STRBUF_SZ, "\uf581 %.1f%%", 100.f * s.charge); +} void get_battery0_status(char* buf) { struct battery_status s = get_battery_status("BAT0"); @@ -97,8 +102,9 @@ void get_battery0_status(char* buf) { } static struct element statusbar[] = { - {get_battery0_status, {5,0}, 0}, - {date, {1,500000}, 0}, + {get_battery0_status, {60,0}, 0}, + {get_battery1_status, {60,0}, 0}, + {date, {2,500000}, 0}, }; int main() { @@ -137,7 +143,7 @@ int main() { next_update = next_fire; } - printf("[%ld.%ld] %s\n", statusbar[i].fire_interval.tv_sec, statusbar[i].fire_interval.tv_usec, (char*)statusbar[i].buf); + //printf("[%ld.%ld] %s\n", statusbar[i].fire_interval.tv_sec, statusbar[i].fire_interval.tv_usec, (char*)statusbar[i].buf); } |
