gpsServer: Reduce amount of peripheral calls
Redraw screen every seconds instead of every packets received, yeah that was a bad idea.
This commit is contained in:
@@ -246,8 +246,6 @@ local function server(mode)
|
|||||||
computers[computerId] = nil
|
computers[computerId] = nil
|
||||||
page.grid.values = positions
|
page.grid.values = positions
|
||||||
page.grid:update()
|
page.grid:update()
|
||||||
page.grid:draw()
|
|
||||||
page.grid:sync()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -267,22 +265,17 @@ local function server(mode)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Event.onInterval(1, function()
|
Event.onInterval(1, function()
|
||||||
local resync = false
|
|
||||||
for _, detail in pairs(positions) do
|
for _, detail in pairs(positions) do
|
||||||
if os.clock() - detail.lastChanged > 10 then
|
if os.clock() - detail.lastChanged > 10 then
|
||||||
detail.changed = false
|
detail.changed = false
|
||||||
resync = true
|
|
||||||
end
|
end
|
||||||
if os.clock() - detail.timestamp > 60 and detail.alive then
|
if os.clock() - detail.timestamp > 60 and detail.alive then
|
||||||
detail.alive = false
|
detail.alive = false
|
||||||
detail.hbeat = false
|
detail.hbeat = false
|
||||||
resync = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if resync then
|
page:draw()
|
||||||
page:draw()
|
page:sync()
|
||||||
page:sync()
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -304,6 +297,7 @@ elseif args[1] == 'snmp' then
|
|||||||
table.insert(page.grid.columns,
|
table.insert(page.grid.columns,
|
||||||
{ heading = 'Label', key = 'label', textColor = colors.cyan }
|
{ heading = 'Label', key = 'label', textColor = colors.cyan }
|
||||||
)
|
)
|
||||||
|
page.grid.sortColumn = 'label'
|
||||||
page.grid:adjustWidth()
|
page.grid:adjustWidth()
|
||||||
server('snmp')
|
server('snmp')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user