Added units to verbose output and changed battery level from a fractional
float to a percentage.
This commit is contained in:
parent
006725f4a3
commit
4a942d92f7
@ -72,15 +72,15 @@ int main(int argc, char *const argv[]){
|
||||
}
|
||||
|
||||
if(run_verbose){
|
||||
printf("Current charge: %d\n", c_now);
|
||||
printf("Full charge: %d\n", c_full);
|
||||
printf("Current charge: %d\n microampere-hours", c_now);
|
||||
printf("Full charge: %d\n microampere-hours", c_full);
|
||||
}
|
||||
|
||||
if(!run_terse) {
|
||||
printf("Battery percentage: ");
|
||||
}
|
||||
float pct = ((float)c_now) / ((float)c_full);
|
||||
printf("%f\n", pct);
|
||||
|
||||
float frac = ((float)c_now) / ((float)c_full);
|
||||
int pct = (int)(frac * 100);
|
||||
printf("%d\n", pct);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user