diff --git a/main.lua b/main.lua index 26502b6..a02ba79 100644 --- a/main.lua +++ b/main.lua @@ -55,10 +55,60 @@ TransmissionTypes = { Config = {} Config.ConfigPath = "/caero-attitude-control/config/config.txt" --- Monitor Configuration +-- Monitor Configuration +Config.Monitors = {} Config.Monitors.InstrumentPanelMonitor = nil Config.Monitors.AutopilotControlMonitor = nil +function identifyMonitor(monitorType) + -- Find all available monitors + local availableMonitors = peripheral.find("monitor") + + if not availableMonitors or #availableMonitors == 0 then + print("No monitors found on the network.") + return nil + end + + print("Available monitors:") + for i, name in ipairs(availableMonitors) do + local monitor = peripheral.wrap(name) + if monitor then + local width, height = monitor.getSize() + print(i .. ". " .. name .. " (" .. width .. "x" .. height .. ")") + end + end + + print("\nPlease select the monitor you want to use for " .. monitorType .. " (enter number):") + + -- Simple input handling for demonstration + local input = read() + local choice = tonumber(input) + + if not choice or choice < 1 or choice > #availableMonitors then + print("Invalid selection.") + return nil + end + + local selectedMonitorName = availableMonitors[choice] + local selectedMonitor = peripheral.wrap(selectedMonitorName) + + print("Selected monitor: " .. selectedMonitorName) + + -- Return monitor details as a table + return { + name = selectedMonitorName, + peripheral = selectedMonitor + } +end + +function assignMonitor(monitorType, monitorData) + if monitorType == "instrument_panel" then + Config.Monitors.InstrumentPanelMonitor = monitorData + elseif monitorType == "autopilot_control" then + Config.Monitors.AutopilotControlMonitor = monitorData + end +end + -- Autopilot Config.Autopilot = { AutopilotEngaged = false,