From 47e0a90116e9f1d9d38487ffae33512aac1aec02 Mon Sep 17 00:00:00 2001 From: Anavrins Date: Tue, 21 Apr 2020 20:56:21 -0400 Subject: [PATCH] gpsServer: Reduce amount of peripheral calls Redraw screen every seconds instead of every packets received, yeah that was a bad idea. --- gps/gpsServer.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/gps/gpsServer.lua b/gps/gpsServer.lua index 5c60926..58461d6 100644 --- a/gps/gpsServer.lua +++ b/gps/gpsServer.lua @@ -246,8 +246,6 @@ local function server(mode) computers[computerId] = nil page.grid.values = positions page.grid:update() - page.grid:draw() - page.grid:sync() end end @@ -267,22 +265,17 @@ local function server(mode) end) Event.onInterval(1, function() - local resync = false for _, detail in pairs(positions) do if os.clock() - detail.lastChanged > 10 then detail.changed = false - resync = true end if os.clock() - detail.timestamp > 60 and detail.alive then detail.alive = false detail.hbeat = false - resync = true end end - if resync then - page:draw() - page:sync() - end + page:draw() + page:sync() end) end @@ -304,6 +297,7 @@ elseif args[1] == 'snmp' then table.insert(page.grid.columns, { heading = 'Label', key = 'label', textColor = colors.cyan } ) + page.grid.sortColumn = 'label' page.grid:adjustWidth() server('snmp')