Implemented autopilot.lua
This commit is contained in:
parent
fd0202536c
commit
37f3683ceb
@ -1,19 +1,12 @@
|
|||||||
local strings = require './lib/strings'
|
local strings = require './lib/strings'
|
||||||
|
|
||||||
-- Autopilot master
|
|
||||||
-- Autopilot altitude
|
|
||||||
-- Autopilot approach
|
|
||||||
-- Autopilot backcourse
|
|
||||||
-- Autopilot heading
|
|
||||||
-- Autopilot nav
|
|
||||||
|
|
||||||
|
local function RegisterAutopilotFunction(functionUid, functionDisplayName, variableName)
|
||||||
-- Autopilot airspeed
|
|
||||||
RegisterFunction(
|
RegisterFunction(
|
||||||
{
|
{
|
||||||
uid = 'autoPilotAirspeed',
|
uid = functionUid,
|
||||||
category = strings.Category.FSX.AutoPilot,
|
category = strings.Category.FSX.AutoPilot,
|
||||||
displayName = 'Autopilot airspeed',
|
displayName = functionDisplayName,
|
||||||
states = {
|
states = {
|
||||||
notAvailable = { displayName = 'Not available', default = LEDColor.Off, order = 1 },
|
notAvailable = { displayName = 'Not available', default = LEDColor.Off, order = 1 },
|
||||||
on = { displayName = 'On', default = LEDColor.Green, order = 2 },
|
on = { displayName = 'On', default = LEDColor.Green, order = 2 },
|
||||||
@ -26,11 +19,11 @@ RegisterFunction(
|
|||||||
OnSimConnect(context,
|
OnSimConnect(context,
|
||||||
{
|
{
|
||||||
autoPilotAvailable = { variable = 'AUTOPILOT AVAILABLE', type = SimConnectDataType.Bool },
|
autoPilotAvailable = { variable = 'AUTOPILOT AVAILABLE', type = SimConnectDataType.Bool },
|
||||||
autoPilotAirspeed = { variable = 'AUTOPILOT AIRSPEED HOLD', type = SimConnectDataType.Bool }
|
autoPilotState = { variable = variableName, type = SimConnectDataType.Bool }
|
||||||
},
|
},
|
||||||
function(context, data)
|
function(context, data)
|
||||||
if data.autoPilotAvailable then
|
if data.autoPilotAvailable then
|
||||||
if data.autoPilotAirspeed then
|
if data.autoPilotState then
|
||||||
SetState(context, 'on')
|
SetState(context, 'on')
|
||||||
else
|
else
|
||||||
SetState(context, 'off')
|
SetState(context, 'off')
|
||||||
@ -41,3 +34,12 @@ RegisterFunction(
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterAutopilotFunction('autoPilotMaster', 'Autopilot master', 'AUTOPILOT MASTER')
|
||||||
|
RegisterAutopilotFunction('autoPilotHeading', 'Autopilot heading', 'AUTOPILOT HEADING LOCK')
|
||||||
|
RegisterAutopilotFunction('autoPilotApproach', 'Autopilot approach', 'AUTOPILOT APPROACH HOLD')
|
||||||
|
RegisterAutopilotFunction('autoPilotBackcourse', 'Autopilot backcourse', 'AUTOPILOT BACKCOURSE HOLD')
|
||||||
|
RegisterAutopilotFunction('autoPilotAltitude', 'Autopilot heading', 'AUTOPILOT ALTITUDE LOCK')
|
||||||
|
RegisterAutopilotFunction('autoPilotNav', 'Autopilot nav', 'AUTOPILOT NAV1 LOCK')
|
||||||
|
RegisterAutopilotFunction('autoPilotAirspeed', 'Autopilot airspeed', 'AUTOPILOT AIRSPEED HOLD')
|
||||||
|
Loading…
Reference in New Issue
Block a user