mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +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_acpi_fan(char *, size_t);
|
||||||
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
||||||
int get_battery_perct(const char *bat);
|
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 get_battery_short_status(char *buf, unsigned int n, const char *bat);
|
||||||
|
|
||||||
void scan_loadavg_arg(struct text_object *, const char *);
|
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)
|
END OBJ(battery_bar, 0)
|
||||||
char bat[64];
|
char bat[64];
|
||||||
if (arg) {
|
if (arg) {
|
||||||
arg = scan_bar(obj, arg, 255);
|
arg = scan_bar(obj, arg, 100);
|
||||||
sscanf(arg, "%63s", bat);
|
sscanf(arg, "%63s", bat);
|
||||||
} else {
|
} else {
|
||||||
strcpy(bat, "BAT0");
|
strcpy(bat, "BAT0");
|
||||||
|
@ -471,10 +471,10 @@ int get_battery_perct(const char *bat)
|
|||||||
return batperct > 100 ? 100 : batperct;
|
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);
|
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)
|
int open_acpi_temperature(const char *name)
|
||||||
|
@ -2055,13 +2055,13 @@ int get_battery_perct(const char *bat)
|
|||||||
return last_battery_perct[idx];
|
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;
|
int idx;
|
||||||
|
|
||||||
get_battery_perct(obj->data.s);
|
get_battery_perct(obj->data.s);
|
||||||
idx = get_battery_idx(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:
|
/* On Apple powerbook and ibook:
|
||||||
|
Loading…
Reference in New Issue
Block a user