Manual iris control

This commit is contained in:
2026-01-01 23:47:11 -05:00
parent 0906603e58
commit 49c3eea4d2
2 changed files with 41 additions and 3 deletions

View File

@ -194,9 +194,10 @@ function display.showIncoming(addressName, addressString, allowed, reason)
mon.setCursorPos(1, 7)
mon.write(addressString)
end
end
function display.showEntity(entityType, entityName, allowed)
display.drawIrisStatus()
endfunction
display.showEntity(entityType, entityName, allowed)
mon.setTextScale(1)
mon.setCursorPos(1, 10)
mon.write("Type: " .. entityType)

View File

@ -98,6 +98,41 @@ function handlers.handlePasswordInput()
end
---------------------------------------------
-- IRIS STATUS CLICK HANDLER (Toggle)
---------------------------------------------
function handlers.handleIrisToggle(eventType, side, x, y)
-- Only process if not entering password (password handler has higher priority)
if state.enteringPassword then
return nil
end
-- Only process if iris is enabled
if not config.irisEnabled then
return nil
end
-- Check if clicking on iris status area (bottom-left corner where "IRIS: STATUS" appears)
-- The iris status is at position (1, 19) and extends roughly 15-20 characters
if y == 19 and x >= 1 and x <= 20 then
local irisState = utils.getIrisState()
-- Toggle based on current state
if irisState == "OPEN" then
utils.closeIris()
display.drawIrisStatus()
return "iris_closed"
elseif irisState == "CLOSED" then
utils.openIris()
display.drawIrisStatus()
return "iris_opened"
end
-- If MOVING or NO IRIS, do nothing
end
return nil -- Not an iris status click
end ---------------------------------------------
-- DISCONNECT BUTTON HANDLER
---------------------------------------------
@ -169,6 +204,7 @@ end
function handlers.handleMessage(eventType, side, message)
state.lastReceivedMessage = message
utils.debug("Message Received: " .. message)
return "message_received"
end
@ -200,8 +236,9 @@ function handlers.setupConnectionHandlers()
-- Clear any existing handlers
events.clearHandlers()
-- Register all handlers with their priorities
events.registerHandler("monitor_touch", handlers.handleIrisToggle, events.PRIORITY.DISCONNECT_BUTTON) -- Same priority as disconnect
events.registerHandler("monitor_touch", handlers.handleDisconnectButton, events.PRIORITY.DISCONNECT_BUTTON)
events.registerHandler("monitor_touch", handlers.handleDefaultClick, events.PRIORITY.DEFAULT) -- Lowest priority - returns coordinates
events.registerHandler("monitor_touch", handlers.handleDefaultClick, events.PRIORITY.DEFAULT) -- Lowest priority - returns coordinates
events.registerHandler("stargate_incoming_wormhole", handlers.handleActivation, events.PRIORITY.ACTIVATION)
events.registerHandler("stargate_reconstructing_entity", handlers.handleEntityRead, events.PRIORITY.ENTITY_READ)
events.registerHandler("stargate_disconnected", handlers.handleDisconnect, events.PRIORITY.DISCONNECT_CHECK)