Respond to iris opening quicker

This commit is contained in:
2026-01-02 00:24:27 -05:00
parent d11641693b
commit cc0fd4974f
4 changed files with 60 additions and 14 deletions

View File

@ -64,7 +64,7 @@ function handlers.handlePasswordInput()
local remoteIrisState = transceiver.checkConnectedShielding()
if not remoteIrisState or remoteIrisState == 0 then
-- Iris opened! Exit password prompt
utils.log("Remote iris opened, canceling password prompt")
utils.log("Remote iris opened via transceiver check, canceling password prompt")
state.enteringPassword = false
return "IRIS_OPENED"
end
@ -74,19 +74,29 @@ function handlers.handlePasswordInput()
local event = { os.pullEvent() }
local eventType = event[1]
utils.log("DEBUG: Password handler received event: " .. tostring(eventType))
-- Handle GDO events
if eventType == "transceiver_transmission_received" then
-- Pass to GDO handler
utils.log("DEBUG: Processing GDO transmission in password handler")
handlers.handleGDOTransmission(table.unpack(event))
-- Continue loop to check iris state
elseif eventType == "stargate_message_received" then
-- Pass to message handler
handlers.handleMessage(table.unpack(event))
-- Check if iris opened
if state.lastReceivedMessage == "IRIS_OPEN" then
utils.log("DEBUG: Message in password handler: " .. tostring(state.lastReceivedMessage))
-- Check if iris opened (via password or GDO)
if state.lastReceivedMessage == "IRIS_OPEN" or state.lastReceivedMessage == "GDO_IRIS_OPEN" then
utils.log("Received iris open confirmation: " .. state.lastReceivedMessage)
state.lastReceivedMessage = nil
utils.log("DEBUG: Setting enteringPassword to false")
state.enteringPassword = false
return "IRIS_OPENED"
utils.log("DEBUG: state.enteringPassword is now: " .. tostring(state.enteringPassword))
utils.log("DEBUG: About to return IRIS_OPENED from password handler")
local returnValue = "IRIS_OPENED"
utils.log("DEBUG: Return value set to: " .. returnValue)
return returnValue
end
elseif eventType == "monitor_touch" then
local x, y = event[3], event[4]
@ -123,12 +133,16 @@ function handlers.handlePasswordInput()
end
end
utils.log("DEBUG: Exited password entry loop")
-- If we got here with a password, send it
if password ~= "" then
utils.sendPasswordAttempt(password)
utils.log("DEBUG: Returning password: " .. password)
return password
end
utils.log("DEBUG: Returning nil from password handler")
return nil
end
@ -258,6 +272,13 @@ function handlers.handleGDOTransmission(eventType, side, frequency, idc, matches
utils.log("Valid GDO code received - opening iris")
utils.debug("Valid GDO - opening iris")
utils.openIris()
-- Send message to remote gate that iris opened via GDO
if config.enableMessaging then
gate.sendStargateMessage("GDO_IRIS_OPEN")
utils.log("Sent GDO iris open notification to remote gate")
utils.debug("Sent: GDO_IRIS_OPEN")
end
end
return "gdo_received"