diff --git a/main.lua b/main.lua index 15406a8..ebb2472 100644 --- a/main.lua +++ b/main.lua @@ -396,7 +396,7 @@ end function PollThrottle() for _, v in pairs(Throttles) do if v.name and v.side then - v.input = peripheral.call(v.name, "getAnalogInput("..v.side..")") + v.input = peripheral.wrap(v.name).getAnalogInput(v.side) end end end @@ -753,96 +753,5 @@ function Main() end end --- Display functions for monitors -function displayInstrumentPanel(monitor, sensorData) - if not monitor or not monitor.peripheral then return end - - local m = monitor.peripheral - m.clear() - m.setCursorPos(1, 1) - - -- Simple instrument panel display - m.write("Caero Attitude Control") - m.setCursorPos(1, 2) - m.write("----------------------") - - if sensorData then - m.setCursorPos(1, 3) - m.write("Pitch: " .. string.format("%.2f", sensorData.gimbal.pitch or 0)) - m.setCursorPos(1, 4) - m.write("Roll: " .. string.format("%.2f", sensorData.gimbal.roll or 0)) - m.setCursorPos(1, 5) - m.write("Yaw: " .. string.format("%.2f", sensorData.navTable.heading or 0)) - m.setCursorPos(1, 6) - m.write("Velocity: " .. string.format("%.2f", sensorData.velocity or 0)) - m.setCursorPos(1, 7) - m.write("Altitude: " .. string.format("%.2f", sensorData.altitude or 0)) - else - m.setCursorPos(1, 3) - m.write("Pitch: 0.00") - m.setCursorPos(1, 4) - m.write("Roll: 0.00") - m.setCursorPos(1, 5) - m.write("Yaw: 0.00") - m.setCursorPos(1, 6) - m.write("Velocity: 0.00") - m.setCursorPos(1, 7) - m.write("Altitude: 0.00") - end - - -- Display autopilot status - local autopilotStatus = Config.Autopilot.AutopilotEngaged and "ON" or "OFF" - m.setCursorPos(1, 9) - m.write("Autopilot: " .. autopilotStatus) -end - -function displayAutopilotControls(monitor, sensorData) - if not monitor or not monitor.peripheral then return end - - local m = monitor.peripheral - m.clear() - m.setCursorPos(1, 1) - - -- Simple autopilot control panel - m.write("Autopilot Controls") - m.setCursorPos(1, 2) - m.write("------------------") - m.setCursorPos(1, 3) - m.write("Engage: [ ]") - m.setCursorPos(1, 4) - m.write("Speed: [0.0]") - m.setCursorPos(1, 5) - m.write("Heading: [0.0]") - m.setCursorPos(1, 6) - m.setCursorPos(1, 7) - m.write("Manual: [ ]") - m.setCursorPos(1, 8) - m.write("Mode: Auto") -end - -function collectSensorData() - local data = {} - - -- Collect gimbal data - data.gimbal = { - pitch = 0, - roll = 0 - } - - -- Collect navigation table data - data.navTable = { - heading = 0, - hasTarget = false - } - - -- Collect altitude data - data.altitude = 0 - - -- Collect velocity data - data.velocity = 0 - - return data -end - -- Run the main function when the script starts Main()