config: battery: use name from config, instead of hardcoded "BAT0"

This commit is contained in:
Daniel Eklöf 2018-12-17 19:59:44 +01:00
parent ef594b877b
commit e0bd7abec6

View file

@ -306,13 +306,16 @@ module_battery_from_config(const struct yml_node *node,
const struct font *parent_font)
{
const struct yml_node *c = yml_get_value(node, "content");
const struct yml_node *name = yml_get_value(node, "name");
const struct yml_node *poll_interval = yml_get_value(node, "poll_interval");
assert(yml_is_dict(c));
assert(yml_is_scalar(name));
assert(poll_interval == NULL || yml_is_scalar(poll_interval));
return module_battery(
"BAT0", particle_from_config(c, parent_font),
yml_value_as_string(name),
particle_from_config(c, parent_font),
poll_interval != NULL ? yml_value_as_int(poll_interval) : 30);
}