refactor: consolidate temperature reporting into temperature_driver and remove temperature_monitor

This commit is contained in:
2025-06-14 12:47:30 -04:00
parent dc85446d47
commit cd5815b77c
3 changed files with 12 additions and 3 deletions

View File

@@ -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

View File

@@ -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
View 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 }