From d455e99ed0191685d82b0a1f0f2f5c330ab7274a Mon Sep 17 00:00:00 2001 From: Navid Sassan Date: Tue, 9 Dec 2025 22:37:03 +0100 Subject: [PATCH] . --- de_react_auto | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/de_react_auto b/de_react_auto index 22982fd..625d5b2 100644 --- a/de_react_auto +++ b/de_react_auto @@ -97,6 +97,7 @@ local monitor = nil local lastDisplayUpdate = 0 local reactorInfo = {} local shutdownRequested = false +local chargeRequested = false -- Track when user requests charging local errorMessage = "" local fieldErrors = {} -- Track specific field read errors @@ -448,6 +449,12 @@ local function processStateMachine() return end + -- Reactor is no longer cold - clear charge request flag + if chargeRequested then + chargeRequested = false + print("[INFO] Reactor started, charge request cleared") + end + if reactorStatus == "cooling" then if state == STATES.EMERGENCY or state == STATES.SHUTDOWN then -- Keep current state during cooldown @@ -571,9 +578,16 @@ local function controlReactor() outputRate = 0 else - -- OFFLINE: Reactor is cold, no action needed - inputRate = 0 - outputRate = 0 + -- OFFLINE: Reactor is cold + if chargeRequested then + -- User requested charge - provide input flux to start charging the field + inputRate = CONFIG.emergency_field_input + outputRate = 0 + else + -- No action needed + inputRate = 0 + outputRate = 0 + end end -- Apply the flow rates with rate limiting @@ -886,12 +900,13 @@ local function handleInput() -- Charge reactor if state == STATES.OFFLINE or state == STATES.SHUTDOWN then shutdownRequested = false + chargeRequested = true -- Flag to provide input flux if reactor then pcall(function() reactor.chargeReactor() end) end - print("Charging reactor...") + print("Charging reactor... providing input flux") end elseif key == keys.x then -- Force exit