Respond to iris opening quicker
This commit is contained in:
30
startup.lua
30
startup.lua
@ -11,6 +11,12 @@
|
||||
- Whitelist/blacklist security
|
||||
]]
|
||||
|
||||
---------------------------------------------
|
||||
-- PROGRAM VERSION
|
||||
---------------------------------------------
|
||||
|
||||
local PROGRAM_VERSION = "2.0"
|
||||
|
||||
---------------------------------------------
|
||||
-- LOAD MODULES
|
||||
---------------------------------------------
|
||||
@ -461,8 +467,8 @@ local function handleIncomingWormhole()
|
||||
|
||||
-- Send version message to remote gate
|
||||
sleep(0.5) -- Brief delay to ensure connection is stable
|
||||
utils.sendVersionMessage()
|
||||
utils.debug("Sent: SGCS_V" .. config.programVersion)
|
||||
utils.sendVersionMessage(PROGRAM_VERSION)
|
||||
utils.debug("Sent: SGCS_V" .. PROGRAM_VERSION)
|
||||
|
||||
-- Handle iris
|
||||
if config.autoCloseIrisOnIncoming then
|
||||
@ -753,6 +759,11 @@ local function handleOutgoingDial()
|
||||
utils.log("Remote gate requires password for entry")
|
||||
lastMessageTime = os.clock()
|
||||
break -- Got password request, that's all we need
|
||||
elseif message == "GDO_IRIS_OPEN" then
|
||||
utils.log("Remote iris opened via GDO")
|
||||
state.remotePasswordRequired = false
|
||||
lastMessageTime = os.clock()
|
||||
break -- Iris opened, no password needed
|
||||
end
|
||||
elseif result == 2 then
|
||||
-- GDO transmission received (handled by event system)
|
||||
@ -802,8 +813,11 @@ local function handleOutgoingDial()
|
||||
|
||||
-- Check if iris opened during password entry (via GDO)
|
||||
if result == "IRIS_OPENED" then
|
||||
utils.log("Iris opened during password entry")
|
||||
utils.log("Iris opened during password entry (via GDO or message)")
|
||||
connectionSafe = true
|
||||
-- Show success message briefly
|
||||
display.showPasswordResult(true)
|
||||
sleep(1)
|
||||
elseif result then
|
||||
-- Password was entered, send it
|
||||
utils.debug("Sent: IRIS_PASSWORD:" .. result)
|
||||
@ -818,7 +832,7 @@ local function handleOutgoingDial()
|
||||
if waitResult == 1 then
|
||||
local response = state.lastReceivedMessage
|
||||
state.lastReceivedMessage = nil
|
||||
if response == "IRIS_OPEN" then
|
||||
if response == "IRIS_OPEN" or response == "GDO_IRIS_OPEN" then
|
||||
display.showPasswordResult(true)
|
||||
utils.log("Password accepted - iris opened")
|
||||
sleep(1)
|
||||
@ -831,11 +845,13 @@ local function handleOutgoingDial()
|
||||
end
|
||||
end
|
||||
|
||||
-- Re-check iris state
|
||||
-- Re-check iris state after password/GDO attempt
|
||||
if transceiver then
|
||||
remoteIrisState = transceiver.checkConnectedShielding()
|
||||
utils.log("Re-checked remote iris state: " .. tostring(remoteIrisState))
|
||||
if not remoteIrisState or remoteIrisState == 0 then
|
||||
connectionSafe = true
|
||||
utils.log("Remote iris confirmed open")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -865,12 +881,16 @@ local function handleOutgoingDial()
|
||||
|
||||
-- Only open local iris if connection is safe
|
||||
if connectionSafe and config.irisEnabled then
|
||||
utils.log("Connection safe - opening local iris")
|
||||
-- Wait 2 seconds to avoid voiding the iris
|
||||
sleep(2)
|
||||
utils.openIris()
|
||||
display.showConnected(state.destAddressname, state.destAddress)
|
||||
elseif connectionSafe then
|
||||
utils.log("Connection safe - no iris to open")
|
||||
display.showConnected(state.destAddressname, state.destAddress)
|
||||
else
|
||||
utils.log("Connection NOT safe - iris remains closed")
|
||||
end
|
||||
|
||||
if (gate.isStargateConnected() == true) then
|
||||
|
||||
Reference in New Issue
Block a user