maybe I fixed it
This commit is contained in:
47
startup.lua
47
startup.lua
@ -697,37 +697,22 @@ 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
|
||||
|
||||
-- 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")
|
||||
|
||||
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
|
||||
@ -736,7 +721,7 @@ local function handleOutgoingDial()
|
||||
|
||||
-- Wait for response
|
||||
local function WaitForResponse()
|
||||
sleep(3) -- Wait up to 3 seconds for response
|
||||
sleep(3)
|
||||
return nil
|
||||
end
|
||||
|
||||
@ -757,38 +742,22 @@ local function handleOutgoingDial()
|
||||
end
|
||||
end
|
||||
|
||||
-- Re-check iris state after password/GDO attempt
|
||||
if transceiver then
|
||||
remoteIrisState = transceiver.checkConnectedShielding()
|
||||
if not remoteIrisState or remoteIrisState == 0 then
|
||||
connectionSafe = true
|
||||
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.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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user