fix ThrottleInit (1)
This commit is contained in:
55
main.lua
55
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()
|
||||
|
||||
Reference in New Issue
Block a user