From 5976b2c1c3edbed58b85ef0585f07ddb7c53545d Mon Sep 17 00:00:00 2001 From: itzmarkoni Date: Sat, 14 Jun 2025 12:39:46 -0400 Subject: [PATCH] refactor: streamline driver loading in main and startup scripts --- kernel.lua | 1 + main.lua | 5 ++--- startup.lua | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/kernel.lua b/kernel.lua index 4edeee7..1e91d60 100644 --- a/kernel.lua +++ b/kernel.lua @@ -5,6 +5,7 @@ local function addDriver(fileName) local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/" shell.execute("wget", baseRoute .. fullFile) sleep(1) + return require(fileName) end return { addDriver = addDriver } \ No newline at end of file diff --git a/main.lua b/main.lua index f16a533..278df88 100644 --- a/main.lua +++ b/main.lua @@ -1,8 +1,7 @@ local function run() - print("Running main loop") - local tempDriver = require("temperature_monitor") + local kernel = require("kernel") + local tempDrive = kernel.addDriver("temperature_monitor") local monitor = peripheral.find("monitor") - while true do monitor.clear() monitor.setCursorPos(1,1) diff --git a/startup.lua b/startup.lua index cfbcada..810bbb0 100644 --- a/startup.lua +++ b/startup.lua @@ -1,7 +1,3 @@ -local kernel = require("kernel") -kernel.addDriver("temperature_monitor") -kernel.addDriver("main") +local main = kernel.addDriver("main") sleep(5) - -local main = require("main") main.run() \ No newline at end of file