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:
Alex 2020-04-27 08:47:22 +02:00 committed by GitHub
commit 44ed61b2c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
} }