vicious: cleanup tabs and bad intendation
This commit is contained in:
parent
cf996f2ea3
commit
18e1823ded
20
init.lua
20
init.lua
|
@ -143,17 +143,17 @@ end
|
||||||
function register(widget, wtype, format, timer, warg)
|
function register(widget, wtype, format, timer, warg)
|
||||||
local widget = widget
|
local widget = widget
|
||||||
local reg = {
|
local reg = {
|
||||||
-- Set properties
|
-- Set properties
|
||||||
wtype = wtype,
|
wtype = wtype,
|
||||||
format = format,
|
format = format,
|
||||||
timer = timer,
|
timer = timer,
|
||||||
warg = warg,
|
warg = warg,
|
||||||
widget = widget,
|
widget = widget,
|
||||||
|
|
||||||
-- Update function
|
-- Update function
|
||||||
update = function ()
|
update = function ()
|
||||||
update(widget, reg)
|
update(widget, reg)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Default to 2s timer
|
-- Default to 2s timer
|
||||||
|
|
|
@ -47,15 +47,15 @@ local function worker(format)
|
||||||
local sysnet = helpers.pathtotable("/sys/class/net/" .. name)
|
local sysnet = helpers.pathtotable("/sys/class/net/" .. name)
|
||||||
args["{"..name.." carrier}"] = tonumber(sysnet.carrier) or 0
|
args["{"..name.." carrier}"] = tonumber(sysnet.carrier) or 0
|
||||||
|
|
||||||
local now = os.time()
|
local now = os.time()
|
||||||
if nets[name] == nil then
|
if nets[name] == nil then
|
||||||
-- Default values on the first run
|
-- Default values on the first run
|
||||||
nets[name] = {}
|
nets[name] = {}
|
||||||
helpers.uformat(args, name .. " down", 0, unit)
|
helpers.uformat(args, name .. " down", 0, unit)
|
||||||
helpers.uformat(args, name .. " up", 0, unit)
|
helpers.uformat(args, name .. " up", 0, unit)
|
||||||
else -- Net stats are absolute, substract our last reading
|
else -- Net stats are absolute, substract our last reading
|
||||||
local interval = now - nets[name].time
|
local interval = now - nets[name].time
|
||||||
if interval < 0 then interval = 1 end
|
if interval < 0 then interval = 1 end
|
||||||
|
|
||||||
local down = (recv - nets[name][1]) / interval
|
local down = (recv - nets[name][1]) / interval
|
||||||
local up = (send - nets[name][2]) / interval
|
local up = (send - nets[name][2]) / interval
|
||||||
|
@ -64,7 +64,7 @@ local function worker(format)
|
||||||
helpers.uformat(args, name .. " up", up, unit)
|
helpers.uformat(args, name .. " up", up, unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
nets[name].time = now
|
nets[name].time = now
|
||||||
|
|
||||||
-- Store totals
|
-- Store totals
|
||||||
nets[name][1] = recv
|
nets[name][1] = recv
|
||||||
|
|
Loading…
Reference in New Issue