Merge pull request #680 from akobel/master
Fix round to 0 or 1 in capacity computation with given full-at
This commit is contained in:
commit
44ed61b2c3
|
@ -119,7 +119,7 @@ const std::tuple<uint8_t, float, std::string> waybar::modules::Battery::getInfos
|
||||||
if (config_["full-at"].isUInt()) {
|
if (config_["full-at"].isUInt()) {
|
||||||
auto full_at = config_["full-at"].asUInt();
|
auto full_at = config_["full-at"].asUInt();
|
||||||
if (full_at < 100) {
|
if (full_at < 100) {
|
||||||
capacity = static_cast<float>(capacity / full_at) * 100;
|
capacity = 100.f * capacity / full_at;
|
||||||
if (capacity > full_at) {
|
if (capacity > full_at) {
|
||||||
capacity = full_at;
|
capacity = full_at;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue