refactor: consolidate temperature reporting into temperature_driver and remove temperature_monitor
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
local function report()
|
||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||
if reactor then
|
||||
5
main.lua
5
main.lua
@@ -1,13 +1,14 @@
|
||||
local function run()
|
||||
local kernel = require("kernel")
|
||||
local tempDriver = kernel.addDriver("temperature_monitor")
|
||||
local tempDriver = kernel.addDriver("temperature_driver")
|
||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||
local monitor = peripheral.find("monitor")
|
||||
while true do
|
||||
monitor.clear()
|
||||
monitor.setCursorPos(1,1)
|
||||
|
||||
local data = {
|
||||
{ Label = "Temperature", value = tempDriver.report()},
|
||||
{ Label = "Temperature", value = tempDriver.report(reactor)},
|
||||
{ Label = "Pressure", value = "101kPa" },
|
||||
{ Label = "Humidity", value = "45%" }
|
||||
}
|
||||
|
||||
9
temperature_driver.lua
Normal file
9
temperature_driver.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
local function report(reactor)
|
||||
if reactor then
|
||||
return reactor.getTemperature()
|
||||
else
|
||||
return "No reactor found"
|
||||
end
|
||||
end
|
||||
|
||||
return { report = report }
|
||||
Reference in New Issue
Block a user