refactor: consolidate temperature reporting into temperature_driver and remove temperature_monitor
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
local function report()
|
local function report()
|
||||||
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
local reactor = peripheral.find("fissionReactorLogicAdapter")
|
||||||
if reactor then
|
if reactor then
|
||||||
5
main.lua
5
main.lua
@@ -1,13 +1,14 @@
|
|||||||
local function run()
|
local function run()
|
||||||
local kernel = require("kernel")
|
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")
|
local monitor = peripheral.find("monitor")
|
||||||
while true do
|
while true do
|
||||||
monitor.clear()
|
monitor.clear()
|
||||||
monitor.setCursorPos(1,1)
|
monitor.setCursorPos(1,1)
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
{ Label = "Temperature", value = tempDriver.report()},
|
{ Label = "Temperature", value = tempDriver.report(reactor)},
|
||||||
{ Label = "Pressure", value = "101kPa" },
|
{ Label = "Pressure", value = "101kPa" },
|
||||||
{ Label = "Humidity", value = "45%" }
|
{ 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