From cd5815b77c325d83fcc11ec0d33d67777be1141b Mon Sep 17 00:00:00 2001 From: itzmarkoni Date: Sat, 14 Jun 2025 12:47:30 -0400 Subject: [PATCH] refactor: consolidate temperature reporting into temperature_driver and remove temperature_monitor --- temperature_monitor.lua => coolant_driver.lua | 1 - main.lua | 5 +++-- temperature_driver.lua | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) rename temperature_monitor.lua => coolant_driver.lua (99%) create mode 100644 temperature_driver.lua diff --git a/temperature_monitor.lua b/coolant_driver.lua similarity index 99% rename from temperature_monitor.lua rename to coolant_driver.lua index 5e42d45..257c6ef 100644 --- a/temperature_monitor.lua +++ b/coolant_driver.lua @@ -1,4 +1,3 @@ - local function report() local reactor = peripheral.find("fissionReactorLogicAdapter") if reactor then diff --git a/main.lua b/main.lua index a083421..ef91272 100644 --- a/main.lua +++ b/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%" } } diff --git a/temperature_driver.lua b/temperature_driver.lua new file mode 100644 index 0000000..a6959be --- /dev/null +++ b/temperature_driver.lua @@ -0,0 +1,9 @@ +local function report(reactor) + if reactor then + return reactor.getTemperature() + else + return "No reactor found" + end +end + +return { report = report } \ No newline at end of file