parent
e551dbfea9
commit
7ecd132610
@ -13,6 +13,7 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "errors.hpp"
|
#include "errors.hpp"
|
||||||
|
#include "utils/math.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
@ -30,9 +31,10 @@ namespace net {
|
|||||||
int max{0};
|
int max{0};
|
||||||
|
|
||||||
int percentage() const {
|
int percentage() const {
|
||||||
if (max < 0)
|
if (val < 0) {
|
||||||
return 2 * (val + 100);
|
return std::max(std::min(std::abs(math_util::percentage(val, max, -20)), 100), 0);
|
||||||
return static_cast<float>(val) / max * 100.0f + 0.5f;
|
}
|
||||||
|
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
|
// Check if the values are defined in dBm
|
||||||
if (stats.qual.level > range.max_qual.level) {
|
if (stats.qual.level > range.max_qual.level) {
|
||||||
m_signalstrength.val -= 0x100;
|
m_signalstrength.val -= 0x100;
|
||||||
m_signalstrength.max -= 0x100;
|
m_signalstrength.max = (stats.qual.level - range.max_qual.level) - 0x100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user