Respond to iris opening quicker
This commit is contained in:
19
handlers.lua
19
handlers.lua
@ -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,18 +74,24 @@ 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
|
||||
state.enteringPassword = false
|
||||
utils.log("DEBUG: About to return IRIS_OPENED from password handler")
|
||||
return "IRIS_OPENED"
|
||||
end
|
||||
elseif eventType == "monitor_touch" then
|
||||
@ -258,6 +264,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"
|
||||
|
||||
Reference in New Issue
Block a user