milo cleanup

This commit is contained in:
kepler155c
2018-11-11 14:45:39 -05:00
parent a00a66f4e6
commit fe1fc6ea93
13 changed files with 200 additions and 200 deletions

View File

@@ -4,11 +4,15 @@ local Peripheral = require('peripheral')
local UI = require('ui')
local Util = require('util')
local colors = _G.colors
local colors = _G.colors
local context = Milo:getContext()
local mon = Peripheral.lookup(context.config.activityMonitor)
local ActivityTask = {
name = 'activity',
priority = 30,
}
if not mon then
return
end
@@ -110,7 +114,7 @@ function page:refresh()
self.grid:draw()
end
Event.onInterval(5, function()
function page:update()
if context.storage:isOnline() then
page:refresh()
page:sync()
@@ -119,6 +123,10 @@ Event.onInterval(5, function()
page.grid:centeredWrite(math.ceil(page.height / 2), 'Storage Offline')
page:sync()
end
end
Event.on({ 'storage_offline', 'storage_online' }, function()
page:update()
end)
Event.on('monitor_touch', function(_, side)
@@ -128,5 +136,11 @@ Event.on('monitor_touch', function(_, side)
end
end)
function ActivityTask:cycle()
page:update()
end
Milo:registerTask(ActivityTask)
page:draw()
page:sync()