mirror of https://github.com/lcpz/lain.git
parent
0fd2187471
commit
ed8853a301
|
@ -64,6 +64,7 @@ local function worker(args)
|
|||
bat_now.n_status = {}
|
||||
for i = 1, #batteries do
|
||||
bat_now.n_status[i] = "N/A"
|
||||
bat_now.perc[i] = 0
|
||||
end
|
||||
|
||||
function update()
|
||||
|
@ -73,7 +74,6 @@ local function worker(args)
|
|||
local sum_rate_energy = 0
|
||||
local sum_energy_now = 0
|
||||
local sum_energy_full = 0
|
||||
local sum_energy_percentage = 0
|
||||
local pspath = "/sys/class/power_supply/"
|
||||
|
||||
for i, battery in ipairs(batteries) do
|
||||
|
@ -98,6 +98,7 @@ local function worker(args)
|
|||
math.floor((energy_now / energy_full) * 100)
|
||||
|
||||
bat_now.n_status[i] = first_line(bstr .. "/status") or "N/A"
|
||||
bat_now.perc[i] = energy_percentage or bat_now.perc[i]
|
||||
|
||||
sum_rate_current = sum_rate_current + (rate_current or 0)
|
||||
sum_rate_voltage = sum_rate_voltage + (rate_voltage or 0)
|
||||
|
@ -105,7 +106,6 @@ local function worker(args)
|
|||
sum_rate_energy = sum_rate_energy + (rate_power or (((rate_voltage or 0) * (rate_current or 0)) / 1e6))
|
||||
sum_energy_now = sum_energy_now + (energy_now or 0)
|
||||
sum_energy_full = sum_energy_full + (energy_full or 0)
|
||||
sum_energy_percentage = sum_energy_percentage + (energy_percentage or 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue