mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
convert get_battery_perct_bar to double
This commit is contained in:
parent
4133d8fdbe
commit
bfd7eabc0f
@ -60,7 +60,7 @@ void get_acpi_ac_adapter(char *, size_t);
|
||||
void get_acpi_fan(char *, size_t);
|
||||
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
||||
int get_battery_perct(const char *bat);
|
||||
uint8_t get_battery_perct_bar(struct text_object *);
|
||||
double get_battery_perct_bar(struct text_object *);
|
||||
void get_battery_short_status(char *buf, unsigned int n, const char *bat);
|
||||
|
||||
void scan_loadavg_arg(struct text_object *, const char *);
|
||||
|
@ -297,7 +297,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(battery_bar, 0)
|
||||
char bat[64];
|
||||
if (arg) {
|
||||
arg = scan_bar(obj, arg, 255);
|
||||
arg = scan_bar(obj, arg, 100);
|
||||
sscanf(arg, "%63s", bat);
|
||||
} else {
|
||||
strcpy(bat, "BAT0");
|
||||
|
@ -471,10 +471,10 @@ int get_battery_perct(const char *bat)
|
||||
return batperct > 100 ? 100 : batperct;
|
||||
}
|
||||
|
||||
uint8_t get_battery_perct_bar(struct text_object *obj)
|
||||
double get_battery_perct_bar(struct text_object *obj)
|
||||
{
|
||||
int batperct = get_battery_perct(obj->data.s);
|
||||
return round_to_int((double)batperct * 2.55);
|
||||
return batperct;
|
||||
}
|
||||
|
||||
int open_acpi_temperature(const char *name)
|
||||
|
@ -2055,13 +2055,13 @@ int get_battery_perct(const char *bat)
|
||||
return last_battery_perct[idx];
|
||||
}
|
||||
|
||||
uint8_t get_battery_perct_bar(struct text_object *obj)
|
||||
double get_battery_perct_bar(struct text_object *obj)
|
||||
{
|
||||
int idx;
|
||||
|
||||
get_battery_perct(obj->data.s);
|
||||
idx = get_battery_idx(obj->data.s);
|
||||
return round_to_int((double)last_battery_perct[idx] * 2.55);
|
||||
return last_battery_perct[idx];
|
||||
}
|
||||
|
||||
/* On Apple powerbook and ibook:
|
||||
|
Loading…
Reference in New Issue
Block a user