diff --git a/burnrate_driver.lua b/burnrate_driver.lua index 4edfdcc..85b4bd8 100644 --- a/burnrate_driver.lua +++ b/burnrate_driver.lua @@ -14,25 +14,25 @@ end --- local function watch() --- while true do --- sleep(0.05) -- Update every tenth second --- end --- end +local function watch() + while true do + sleep(0.05) -- Update every tenth second + end +end local function stepUp() - -- local value = getValue() - -- if value < max then - -- reactor.setBurnRate(value + rateStep) - -- end + local value = getValue() + if value < max then + reactor.setBurnRate(value + rateStep) + end end local function stepDown() - -- local value = getValue() - -- if value > min then - -- reactor.setBurnRate(value - rateStep) - -- end + local value = getValue() + if value > min then + reactor.setBurnRate(value - rateStep) + end end diff --git a/coolant_driver.lua b/coolant_driver.lua index cc2878a..43361f8 100644 --- a/coolant_driver.lua +++ b/coolant_driver.lua @@ -15,17 +15,17 @@ local function checkCoolantLevel() return true end --- local function watch() --- while true do --- checkCoolantLevel() --- sleep(0.05) --- end --- end - local function watch() - checkCoolantLevel() + while true do + checkCoolantLevel() + sleep(0.05) + end end +-- local function watch() +-- checkCoolantLevel() +-- end + local function report() local value = getValue() local color = color() diff --git a/main.lua b/main.lua index 112a9ec..1868717 100644 --- a/main.lua +++ b/main.lua @@ -11,14 +11,18 @@ burnRateDriver = kernel.addDriver("burnrate_driver") local function runMonitors() - while true do - tempDriver.watch() - coolantDriver.watch() - statusDriver.watch() - turbineDriver.watch() - burnRateDriver.watch() - sleep(0.05) - end + + + parallel.waitForAll(tempDriver.watch, coolantDriver.watch, statusDriver.watch, turbineDriver.watch, burnRateDriver.watch) + + -- while true do + -- tempDriver.watch() + -- coolantDriver.watch() + -- statusDriver.watch() + -- turbineDriver.watch() + -- burnRateDriver.watch() + -- sleep(0.05) + -- end end local function runDisplay() diff --git a/status_driver.lua b/status_driver.lua index 20d4757..f98f904 100644 --- a/status_driver.lua +++ b/status_driver.lua @@ -19,13 +19,18 @@ local function checkStatus() local value = getValue() end +-- local function watch() +-- checkStatus() +-- end + local function watch() - checkStatus() + while true do + checkStatus() + sleep(0.05) -- Update every tenth second + end end - - local function report() local value = getValue() local color = color() diff --git a/temperature_driver.lua b/temperature_driver.lua index 8954978..7824bd3 100644 --- a/temperature_driver.lua +++ b/temperature_driver.lua @@ -22,19 +22,19 @@ local function checkTemperature() end end -local function color() - local temperature = getValue() - return colors.black -end - --- local function watch() --- while true do --- print("Temperature: " .. getValue()) --- checkTemperature() --- sleep(0.05) -- Update every tenth second --- end +-- local function color() +-- local temperature = getValue() +-- return colors.black -- end +local function watch() + while true do + print("Temperature: " .. getValue()) + checkTemperature() + sleep(0.05) -- Update every tenth second + end +end + diff --git a/turbine_driver.lua b/turbine_driver.lua index 1cc4d04..4d3c286 100644 --- a/turbine_driver.lua +++ b/turbine_driver.lua @@ -12,12 +12,7 @@ local function color() return colors.black end --- local function watch() --- while true do --- checkSteamLevel() --- sleep(0.05) -- Update every tenth second --- end --- end + local function checkSteamLevel() local value = getValue() @@ -40,10 +35,16 @@ local function checkSteamLevel() end end -local function watch() - checkSteamLevel() -end +-- local function watch() +-- checkSteamLevel() +-- end +local function watch() + while true do + checkSteamLevel() + sleep(0.05) -- Update every tenth second + end +end local function report() local color = color()