why u no open local iris ;-;
This commit is contained in:
18
handlers.lua
18
handlers.lua
@ -74,29 +74,21 @@ function handlers.handlePasswordInput()
|
|||||||
local event = { os.pullEvent() }
|
local event = { os.pullEvent() }
|
||||||
local eventType = event[1]
|
local eventType = event[1]
|
||||||
|
|
||||||
utils.log("DEBUG: Password handler received event: " .. tostring(eventType))
|
|
||||||
|
|
||||||
-- Handle GDO events
|
-- Handle GDO events
|
||||||
if eventType == "transceiver_transmission_received" then
|
if eventType == "transceiver_transmission_received" then
|
||||||
-- Pass to GDO handler
|
-- Pass to GDO handler
|
||||||
utils.log("DEBUG: Processing GDO transmission in password handler")
|
|
||||||
handlers.handleGDOTransmission(table.unpack(event))
|
handlers.handleGDOTransmission(table.unpack(event))
|
||||||
-- Continue loop to check iris state
|
-- Continue loop to check iris state
|
||||||
elseif eventType == "stargate_message_received" then
|
elseif eventType == "stargate_message_received" then
|
||||||
-- Pass to message handler
|
-- Pass to message handler
|
||||||
handlers.handleMessage(table.unpack(event))
|
handlers.handleMessage(table.unpack(event))
|
||||||
utils.log("DEBUG: Message in password handler: " .. tostring(state.lastReceivedMessage))
|
|
||||||
-- Check if iris opened (via password or GDO)
|
-- Check if iris opened (via password or GDO)
|
||||||
if state.lastReceivedMessage == "IRIS_OPEN" or state.lastReceivedMessage == "GDO_IRIS_OPEN" then
|
if state.lastReceivedMessage == "IRIS_OPEN" or state.lastReceivedMessage == "GDO_IRIS_OPEN" then
|
||||||
utils.log("Received iris open confirmation: " .. state.lastReceivedMessage)
|
utils.debug("Password handler: Received " .. state.lastReceivedMessage)
|
||||||
state.lastReceivedMessage = nil
|
state.lastReceivedMessage = nil
|
||||||
utils.log("DEBUG: Setting enteringPassword to false")
|
|
||||||
state.enteringPassword = false
|
state.enteringPassword = false
|
||||||
utils.log("DEBUG: state.enteringPassword is now: " .. tostring(state.enteringPassword))
|
utils.debug("Password handler: About to return IRIS_OPENED")
|
||||||
utils.log("DEBUG: About to return IRIS_OPENED from password handler")
|
return "IRIS_OPENED"
|
||||||
local returnValue = "IRIS_OPENED"
|
|
||||||
utils.log("DEBUG: Return value set to: " .. returnValue)
|
|
||||||
return returnValue
|
|
||||||
end
|
end
|
||||||
elseif eventType == "monitor_touch" then
|
elseif eventType == "monitor_touch" then
|
||||||
local x, y = event[3], event[4]
|
local x, y = event[3], event[4]
|
||||||
@ -133,16 +125,12 @@ function handlers.handlePasswordInput()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.log("DEBUG: Exited password entry loop")
|
|
||||||
|
|
||||||
-- If we got here with a password, send it
|
-- If we got here with a password, send it
|
||||||
if password ~= "" then
|
if password ~= "" then
|
||||||
utils.sendPasswordAttempt(password)
|
utils.sendPasswordAttempt(password)
|
||||||
utils.log("DEBUG: Returning password: " .. password)
|
|
||||||
return password
|
return password
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.log("DEBUG: Returning nil from password handler")
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
22
startup.lua
22
startup.lua
@ -253,7 +253,10 @@ local function GetGDOTransmission()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function HandlePasswordEntry()
|
local function HandlePasswordEntry()
|
||||||
return handlers.handlePasswordInput()
|
utils.debug("HandlePasswordEntry: Calling handlers.handlePasswordInput()")
|
||||||
|
local result = handlers.handlePasswordInput()
|
||||||
|
utils.debug("HandlePasswordEntry: handlers.handlePasswordInput() returned: " .. tostring(result))
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local function HandleIncomingPasswordRequest(password)
|
local function HandleIncomingPasswordRequest(password)
|
||||||
@ -744,9 +747,6 @@ local function handleOutgoingDial()
|
|||||||
local message = state.lastReceivedMessage
|
local message = state.lastReceivedMessage
|
||||||
state.lastReceivedMessage = nil
|
state.lastReceivedMessage = nil
|
||||||
|
|
||||||
-- DEBUG: Print all messages received
|
|
||||||
print("DEBUG: Message received: " .. tostring(message))
|
|
||||||
utils.log("DEBUG: Message received: " .. tostring(message))
|
|
||||||
utils.debug("Received: " .. tostring(message))
|
utils.debug("Received: " .. tostring(message))
|
||||||
|
|
||||||
if message and message:sub(1, 6) == "SGCS_V" then
|
if message and message:sub(1, 6) == "SGCS_V" then
|
||||||
@ -772,18 +772,13 @@ local function handleOutgoingDial()
|
|||||||
else
|
else
|
||||||
-- Timeout - if we got a version message, assume no password required
|
-- Timeout - if we got a version message, assume no password required
|
||||||
if state.remoteHasComputer and (os.clock() - lastMessageTime) > 0.5 then
|
if state.remoteHasComputer and (os.clock() - lastMessageTime) > 0.5 then
|
||||||
print("DEBUG: Breaking - got version, no password request after 0.5s")
|
|
||||||
break -- No more messages coming
|
break -- No more messages coming
|
||||||
elseif not state.remoteHasComputer and (os.clock() - startTime) > 1 then
|
elseif not state.remoteHasComputer and (os.clock() - startTime) > 1 then
|
||||||
print("DEBUG: Breaking - no version message after 1s")
|
|
||||||
break -- No computer at remote gate
|
break -- No computer at remote gate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print("DEBUG: Message collection complete. remoteHasComputer=" ..
|
|
||||||
tostring(state.remoteHasComputer) .. ", remotePasswordRequired=" .. tostring(state.remotePasswordRequired))
|
|
||||||
|
|
||||||
-- Check if remote iris is closed using transceiver
|
-- Check if remote iris is closed using transceiver
|
||||||
local remoteIrisState = nil
|
local remoteIrisState = nil
|
||||||
if transceiver then
|
if transceiver then
|
||||||
@ -811,15 +806,19 @@ local function handleOutgoingDial()
|
|||||||
|
|
||||||
local result = HandlePasswordEntry()
|
local result = HandlePasswordEntry()
|
||||||
|
|
||||||
utils.log("DEBUG: HandlePasswordEntry returned: " .. tostring(result))
|
utils.debug("HandlePasswordEntry returned: " .. tostring(result))
|
||||||
|
utils.debug("Type of result: " .. type(result))
|
||||||
|
utils.debug("result == 'IRIS_OPENED': " .. tostring(result == "IRIS_OPENED"))
|
||||||
|
|
||||||
-- Check if iris opened during password entry (via GDO)
|
-- Check if iris opened during password entry (via GDO)
|
||||||
if result == "IRIS_OPENED" then
|
if result == "IRIS_OPENED" then
|
||||||
|
utils.debug("Setting connectionSafe=true after IRIS_OPENED")
|
||||||
utils.log("Iris opened during password entry (via GDO or message)")
|
utils.log("Iris opened during password entry (via GDO or message)")
|
||||||
connectionSafe = true
|
connectionSafe = true
|
||||||
-- Show success message briefly
|
-- Show success message briefly
|
||||||
display.showPasswordResult(true)
|
display.showPasswordResult(true)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
utils.debug("After success display, connectionSafe=" .. tostring(connectionSafe))
|
||||||
elseif result then
|
elseif result then
|
||||||
-- Password was entered, send it
|
-- Password was entered, send it
|
||||||
utils.debug("Sent: IRIS_PASSWORD:" .. result)
|
utils.debug("Sent: IRIS_PASSWORD:" .. result)
|
||||||
@ -850,10 +849,8 @@ local function handleOutgoingDial()
|
|||||||
-- Re-check iris state after password/GDO attempt
|
-- Re-check iris state after password/GDO attempt
|
||||||
if transceiver then
|
if transceiver then
|
||||||
remoteIrisState = transceiver.checkConnectedShielding()
|
remoteIrisState = transceiver.checkConnectedShielding()
|
||||||
utils.log("Re-checked remote iris state: " .. tostring(remoteIrisState))
|
|
||||||
if not remoteIrisState or remoteIrisState == 0 then
|
if not remoteIrisState or remoteIrisState == 0 then
|
||||||
connectionSafe = true
|
connectionSafe = true
|
||||||
utils.log("Remote iris confirmed open")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -889,6 +886,7 @@ local function handleOutgoingDial()
|
|||||||
|
|
||||||
-- Only open local iris if connection is safe
|
-- Only open local iris if connection is safe
|
||||||
if connectionSafe and config.irisEnabled then
|
if connectionSafe and config.irisEnabled then
|
||||||
|
utils.debug("Opening local iris NOW")
|
||||||
utils.log("Connection safe - opening local iris")
|
utils.log("Connection safe - opening local iris")
|
||||||
-- Wait 2 seconds to avoid voiding the iris
|
-- Wait 2 seconds to avoid voiding the iris
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
|||||||
@ -26,7 +26,7 @@ function utils.log(message)
|
|||||||
local logEntry = "[" .. timestamp .. "] " .. message
|
local logEntry = "[" .. timestamp .. "] " .. message
|
||||||
|
|
||||||
-- Write to console
|
-- Write to console
|
||||||
print(logEntry)
|
-- print(logEntry) -- TEMPORARILY DISABLED
|
||||||
|
|
||||||
-- Write to file
|
-- Write to file
|
||||||
local file = fs.open(config.logFile, "a")
|
local file = fs.open(config.logFile, "a")
|
||||||
|
|||||||
Reference in New Issue
Block a user