mirror of
https://github.com/polybar/polybar.git
synced 2025-02-17 15:55:20 -05:00
parent
e551dbfea9
commit
7ecd132610
2 changed files with 6 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "common.hpp"
|
||||
#include "config.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "utils/math.hpp"
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
|
@ -30,9 +31,10 @@ namespace net {
|
|||
int max{0};
|
||||
|
||||
int percentage() const {
|
||||
if (max < 0)
|
||||
return 2 * (val + 100);
|
||||
return static_cast<float>(val) / max * 100.0f + 0.5f;
|
||||
if (val < 0) {
|
||||
return std::max(std::min(std::abs(math_util::percentage(val, max, -20)), 100), 0);
|
||||
}
|
||||
return std::max(std::min(math_util::percentage(val, 0, max), 100), 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ namespace net {
|
|||
// Check if the values are defined in dBm
|
||||
if (stats.qual.level > range.max_qual.level) {
|
||||
m_signalstrength.val -= 0x100;
|
||||
m_signalstrength.max -= 0x100;
|
||||
m_signalstrength.max = (stats.qual.level - range.max_qual.level) - 0x100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue