maybe I fixed it

This commit is contained in:
2026-01-02 01:10:34 -05:00
parent 049a712780
commit e1af4945c1

View File

@ -697,98 +697,67 @@ local function handleOutgoingDial()
end
end
-- Check if remote iris is closed using transceiver
local remoteIrisState = nil
if transceiver then
remoteIrisState = transceiver.checkConnectedShielding()
end
local connectionSafe = false
if remoteIrisState and remoteIrisState > 0 then
-- Remote iris is closed (partially or fully) - UNSAFE
-- If remote computer requested a password, show the prompt
if state.remotePasswordRequired then
utils.log("Password required by remote gate")
-- Close local iris to protect travelers
if config.irisEnabled then
utils.closeIris()
end
if remoteIrisState == 100 then
utils.log("WARNING: Remote iris is fully closed!")
else
utils.log("WARNING: Remote iris is " .. remoteIrisState .. "% closed!")
end
local result = HandlePasswordEntry()
-- If password is required and remote has computer, show prompt now
if state.remotePasswordRequired and remoteIrisState == 100 then
utils.log("Showing password prompt for remote gate")
-- Check if iris opened during password entry (via GDO)
if result == "IRIS_OPENED" then
connectionSafe = true
display.showPasswordResult(true)
sleep(1)
elseif result then
-- Password was entered, send it
utils.debug("Sent: IRIS_PASSWORD:" .. result)
local result = HandlePasswordEntry()
-- Check if iris opened during password entry (via GDO)
if result == "IRIS_OPENED" then
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)
-- Wait for response
local function WaitForResponse()
sleep(3) -- Wait up to 3 seconds for response
return nil
end
local waitResult = parallel.waitForAny(GetMessage, WaitForResponse)
if waitResult == 1 then
local response = state.lastReceivedMessage
state.lastReceivedMessage = nil
if response == "IRIS_OPEN" or response == "GDO_IRIS_OPEN" then
display.showPasswordResult(true)
utils.log("Password accepted - iris opened")
sleep(1)
connectionSafe = true
elseif response == "IRIS_DENIED" then
display.showPasswordResult(false)
utils.log("Password rejected")
sleep(2)
end
end
-- Wait for response
local function WaitForResponse()
sleep(3)
return nil
end
-- Re-check iris state after password/GDO attempt
if transceiver then
remoteIrisState = transceiver.checkConnectedShielding()
if not remoteIrisState or remoteIrisState == 0 then
local waitResult = parallel.waitForAny(GetMessage, WaitForResponse)
if waitResult == 1 then
local response = state.lastReceivedMessage
state.lastReceivedMessage = nil
if response == "IRIS_OPEN" or response == "GDO_IRIS_OPEN" then
display.showPasswordResult(true)
utils.log("Password accepted - iris opened")
sleep(1)
connectionSafe = true
elseif response == "IRIS_DENIED" then
display.showPasswordResult(false)
utils.log("Password rejected")
sleep(2)
end
end
end
-- Show warning screen if iris still closed
if not connectionSafe and remoteIrisState and remoteIrisState > 0 then
utils.log("DEBUG: connectionSafe=" ..
tostring(connectionSafe) .. ", remoteIrisState=" .. tostring(remoteIrisState))
-- If still not safe, show warning
if not connectionSafe then
mon.setBackgroundColor(colors.red)
mon.clear()
mon.setTextScale(1)
mon.setCursorPos(6, 5)
mon.write("REMOTE IRIS")
mon.setCursorPos(8, 7)
if remoteIrisState == 100 then
mon.write("CLOSED!")
else
mon.write(remoteIrisState .. "% CLOSED")
end
mon.write("CLOSED!")
mon.setCursorPos(3, 10)
mon.write("Connection unsafe")
display.drawIrisStatus()
display.drawDisconnectButton()
end
else
-- Remote iris is open or no iris present
utils.log("DEBUG: Remote iris is open or no iris present")
-- No password required - connection is safe
connectionSafe = true
end