mirror of
https://github.com/polybar/polybar.git
synced 2024-11-11 13:50:56 -05:00
fix(power): add comments to explain current/power_now
This commit is contained in:
parent
95d3b4f1eb
commit
2a056d5b23
1 changed files with 2 additions and 0 deletions
|
@ -85,11 +85,13 @@ namespace modules {
|
|||
m_consumption_reader = make_unique<consumption_reader>([this,&path_battery] {
|
||||
float consumption;
|
||||
|
||||
// if the rate we found was the current, calculate power (P = I*V)
|
||||
if (m_frate == path_battery + "current_now") {
|
||||
unsigned long current{std::strtoul(file_util::contents(m_frate).c_str(), nullptr, 10)};
|
||||
unsigned long voltage{std::strtoul(file_util::contents(m_fvoltage).c_str(), nullptr, 10)};
|
||||
|
||||
consumption = ((voltage / 1000.0) * (current / 1000.0)) / 1e6;
|
||||
// if it was power, just use as is
|
||||
} else {
|
||||
unsigned long power{std::strtoul(file_util::contents(m_frate).c_str(), nullptr, 10)};
|
||||
|
||||
|
|
Loading…
Reference in a new issue