diff --git a/main.lua b/main.lua index f28f25d..3ae5aad 100644 --- a/main.lua +++ b/main.lua @@ -117,6 +117,21 @@ Config.Autopilot = { AutopilotDesiredHeading = nil } +Throttles = { + ForeThrottle = { + name = nil, + side = nil + }, + AftThrottle = { + name = nil, + side = nil + }, + DownThrottle = { + name = nil, + side = nil + } +} + function ThrottleInit() local sides = { "top", @@ -171,6 +186,46 @@ function ThrottleInit() end end end + + print("\nIdentifying aft throttle") + print("\nPlease change the input signal for the throttle") + + local initialStates = getRelayStates() + + while true do + local currentStates = getRelayStates() + + for pname, currentState in pairs(currentStates) do + local initialState = initialStates[pname] + for k, v in pairs(currentState) do + if initialState[k] ~= v then + Throttles.AftThrottleThrottle.name = pname + Throttles.AftThrottle.side = k + return + end + end + end + end + + print("\nIdentifying down throttle") + print("\nPlease change the input signal for the throttle") + + local initialStates = getRelayStates() + + while true do + local currentStates = getRelayStates() + + for pname, currentState in pairs(currentStates) do + local initialState = initialStates[pname] + for k, v in pairs(currentState) do + if initialState[k] ~= v then + Throttles.DownThrottle.name = pname + Throttles.DownThrottle.side = k + return + end + end + end + end end function PropellerInit() @@ -759,4 +814,4 @@ function Main() end -- Run the main function when the script starts -Main() \ No newline at end of file +Main()