updated
This commit is contained in:
42
main.lua
42
main.lua
@@ -4,12 +4,18 @@ local monitor = peripheral.find("monitor")
|
||||
local tempDriver = kernel.addDriver("temperature_driver")
|
||||
local coolantDriver = kernel.addDriver("coolant_driver")
|
||||
local statusDriver = kernel.addDriver("status_driver")
|
||||
local turbineDriver = kernel.addDriver("turbine_driver")
|
||||
|
||||
isWarningState = false
|
||||
isCriticalState = false
|
||||
isShutdownState = false
|
||||
|
||||
local function runMonitors()
|
||||
while true do
|
||||
tempDriver.watch(reactor, monitor)
|
||||
coolantDriver.watch(reactor, monitor)
|
||||
statusDriver.watch(reactor, monitor)
|
||||
turbineDriver.watch(reactor, monitor)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,12 +23,20 @@ local function runDisplay()
|
||||
monitor.clear()
|
||||
monitor.setTextScale(1)
|
||||
while true do
|
||||
if(isWarningState or isCriticalState or isShutdownState) then
|
||||
monitor.setBackgroundColor(colors.red)
|
||||
monitor.clear()
|
||||
monitor.setCursorPos(1, 1)
|
||||
monitor.write("Reactor in critical state!")
|
||||
sleep(2)
|
||||
monitor.clear()
|
||||
end
|
||||
monitor.setCursorPos(1, 1)
|
||||
|
||||
local drivers = {
|
||||
{ Label = "Status", driver = statusDriver },
|
||||
{ Label = "Temperature", driver = tempDriver },
|
||||
{ Label = "Coolant", driver = coolantDriver },
|
||||
{ Label = "Turbine", driver = turbineDriver },
|
||||
}
|
||||
|
||||
for i, item in ipairs(drivers) do
|
||||
@@ -50,29 +64,3 @@ local function run()
|
||||
end
|
||||
|
||||
return { run = run}
|
||||
|
||||
-- local monitor = peripheral.wrap("top")
|
||||
-- local modem = peripheral.wrap("back")
|
||||
-- print(monitor)
|
||||
-- monitor.clear()
|
||||
-- monitor.setTextScale(1)
|
||||
-- local maxWidth, maxHeight = monitor.getSize()
|
||||
-- local y = 1
|
||||
-- monitor.setCursorPos(1, y)
|
||||
-- local init = "Initalizing stream...."
|
||||
-- monitor.write(init)
|
||||
-- print(init)
|
||||
-- y = y+1
|
||||
-- modem.open(80)
|
||||
|
||||
-- while true do
|
||||
-- local _, _, _, _, message = os.pullEvent("modem_message")
|
||||
-- monitor.setCursorPos(1, y)
|
||||
-- print(message)
|
||||
-- monitor.write(message)
|
||||
-- y=y+1
|
||||
-- if(y > maxHeight) then
|
||||
-- y=maxHeight
|
||||
-- monitor.scroll(1)
|
||||
-- end
|
||||
-- end
|
||||
Reference in New Issue
Block a user