make airmanager instrument
This commit is contained in:
1 parent
9b2c46c776
commit
8aa3f2599d
8 files changed
+236
-387
No files matched your search
-44
@@ -1,44 +0,0 @@
|
|||||||
-- How to add Buttons:
|
|
||||||
-- https://siminnovations.com/wiki/index.php?title=Hw_button_add
|
|
||||||
-- hw_button_add(hw_id, pressed_callback, released_callback)
|
|
||||||
|
|
||||||
-- How to select the arduino:
|
|
||||||
-- https://siminnovations.com/wiki/index.php?title=Hardware_id_list
|
|
||||||
-- ARDUINO_MEGA2560_B_D0
|
|
||||||
|
|
||||||
-- How to add Rotary Encoders:
|
|
||||||
-- https://siminnovations.com/wiki/index.php?title=Rotary_encoder_connection_tutorial
|
|
||||||
-- https://siminnovations.com/wiki/index.php?title=Hw_dial_add
|
|
||||||
-- hw_dial_add(hw_id_a, hw_id_b, callback)
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_COMSWAP_Push")
|
|
||||||
fs2020_event("H:AS430_NAVSWAP_Push")
|
|
||||||
|
|
||||||
fs2020_event("TOGGLE_GPS_DRIVES_NAV1")
|
|
||||||
fs2020_event("H:AS430_OBS_Push")
|
|
||||||
fs2020_event("H:AS430_MSG_Push")
|
|
||||||
fs2020_event("H:AS430_FPL_Push")
|
|
||||||
fs2020_event("H:AS430_PROC_Push")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_RNG_Dezoom")
|
|
||||||
fs2020_event("H:AS430_RNG_Zoom")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_DirectTo_Push")
|
|
||||||
fs2020_event("H:AS430_MENU_Push")
|
|
||||||
fs2020_event("H:AS430_CLR_Push_Long")
|
|
||||||
fs2020_event("H:AS430_CLR_Push")
|
|
||||||
fs2020_event("H:AS430_ENT_Push")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_LeftLargeKnob_Right")
|
|
||||||
fs2020_event("H:AS430_LeftLargeKnob_Left")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Right")
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Left")
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Push")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_RightLargeKnob_Right")
|
|
||||||
fs2020_event("H:AS430_RightLargeKnob_Left")
|
|
||||||
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Right")
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Left")
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Push")
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><pluginstrument><aircraft>Generic</aircraft><type>GNS430 Hardware</type><uuid>3e534a19-1714-4150-b1ec-4f760390ceec</uuid><author>Christopher Costa Hardt</author><description></description><compatibleFSX>false</compatibleFSX><compatibleP3D>false</compatibleP3D><compatibleXPL>false</compatibleXPL><compatibleFS2>false</compatibleFS2><compatibleFS2020>true</compatibleFS2020><version>1</version><configVersion>1</configVersion><pluginInterfaceVersion>100</pluginInterfaceVersion><prefWidth>0</prefWidth><prefHeight>0</prefHeight><source>PERSONAL</source><platforms><platform>WINDOWS</platform><platform>LINUX</platform><platform>RASPBERRY_PI</platform><platform>ANDROID</platform><platform>MAC</platform></platforms><tiers><tier>HOME_USE_STANDARD</tier></tiers></pluginstrument>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
-- How to add Buttons:
|
||||||
|
-- https://siminnovations.com/wiki/index.php?title=Hw_button_add
|
||||||
|
-- hw_button_add(hw_id, pressed_callback, released_callback)
|
||||||
|
function log(buttonName, config)
|
||||||
|
print(buttonName)
|
||||||
|
print("default hw id: " .. arduino .. config.pin)
|
||||||
|
print("event: " .. config.event)
|
||||||
|
print("- - - - - - - - - - -")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add button with one event (press)
|
||||||
|
function assign(buttonName, config)
|
||||||
|
local defaultHardwareId = arduino .. config.pin
|
||||||
|
hw_id = user_prop_add_hardware_id("Button " .. tostring(buttonName), defaultHardwareId, tostring(buttonName))
|
||||||
|
hw_button_add(tostring(hw_id), function()
|
||||||
|
event(config.event)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add button with two events (press/release)
|
||||||
|
function assignClr(buttonName, config)
|
||||||
|
local defaultHardwareId = arduino .. config.pin
|
||||||
|
hw_id = user_prop_add_hardware_id("Button " .. tostring(buttonName), defaultHardwareId, tostring(buttonName))
|
||||||
|
|
||||||
|
hw_button_add(tostring(hw_id), function()
|
||||||
|
timer_clear = timer_start(2000, function()
|
||||||
|
event(config.event2)
|
||||||
|
end)
|
||||||
|
end, function()
|
||||||
|
timer_stop(timer_clear)
|
||||||
|
event(config.event)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function setupButtons()
|
||||||
|
for buttonName, config in pairs(buttons) do
|
||||||
|
log(buttonName, config)
|
||||||
|
if (buttonName == "CLR") then
|
||||||
|
assignClr(buttonName, config)
|
||||||
|
else
|
||||||
|
assign(buttonName, config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
function logEncoder(knobName, config)
|
||||||
|
print(knobName)
|
||||||
|
print("default hw id A: " .. arduino .. config.pinA)
|
||||||
|
print("default hw id B: " .. arduino .. config.pinB)
|
||||||
|
print("event: " .. config.event)
|
||||||
|
print("- - - - - - - - - - -")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- assign a string to a integer of encoder direction (0,1)
|
||||||
|
function leftRight(direction)
|
||||||
|
return direction == 1 and "_Right" or "_Left"
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_acceleration = 3
|
||||||
|
local default_debounce = 4
|
||||||
|
|
||||||
|
-- How to add Rotary Encoders:
|
||||||
|
-- https://siminnovations.com/wiki/index.php?title=Rotary_encoder_connection_tutorial
|
||||||
|
-- https://siminnovations.com/wiki/index.php?title=Hw_dial_add
|
||||||
|
-- hw_dial_add(hw_id_a, hw_id_b, callback)
|
||||||
|
function encoder(knobName, config)
|
||||||
|
|
||||||
|
type = "TYPE_1_DETENT_PER_PULSE"
|
||||||
|
|
||||||
|
local defaultPinA = arduino .. config.pinA
|
||||||
|
local hw_id_pin_a = user_prop_add_hardware_id("Encoder " .. knobName .. " pin A", defaultPinA, knobName .. " pin A")
|
||||||
|
|
||||||
|
local defaultPinB = arduino .. config.pinB
|
||||||
|
local hw_id_pin_b = user_prop_add_hardware_id("Encoder " .. knobName .. " pin B", defaultPinB, knobName .. " pin B")
|
||||||
|
|
||||||
|
hw_dial_add(
|
||||||
|
tostring(hw_id_pin_a),
|
||||||
|
tostring(hw_id_pin_b), type, default_acceleration, default_debounce, function(direction)
|
||||||
|
event(config.event .. leftRight(direction))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function setupEncoders()
|
||||||
|
-- Run the four encoders through the assignment function
|
||||||
|
for knobName, config in pairs(knobs) do
|
||||||
|
logEncoder(knobName, config)
|
||||||
|
encoder(knobName, config)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
arduino = "ARDUINO_MEGA2560_B_"
|
||||||
|
|
||||||
|
function getHardwareId(pin)
|
||||||
|
arduinoChannel = "B" -- <== Change Arduino Channel here (assigned in air manager setup -> Home -> Flash)
|
||||||
|
return "ARDUINO_MEGA2560_" .. arduinoChannel .. "_" .. pin
|
||||||
|
end
|
||||||
|
|
||||||
|
function event(id)
|
||||||
|
print(id)
|
||||||
|
fs2020_event(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
buttons = {
|
||||||
|
-- Left side Buttons
|
||||||
|
COMSWAP = {
|
||||||
|
pin = "D2",
|
||||||
|
event = "H:AS430_COMSWAP_Push"
|
||||||
|
},
|
||||||
|
NAVSWAP = {
|
||||||
|
pin = "D3",
|
||||||
|
event = "H:AS430_NAVSWAP_Push"
|
||||||
|
},
|
||||||
|
-- Lower Buttons
|
||||||
|
CDI = {
|
||||||
|
pin = "D4",
|
||||||
|
event = "TOGGLE_GPS_DRIVES_NAV1"
|
||||||
|
},
|
||||||
|
OBS = {
|
||||||
|
pin = "D5",
|
||||||
|
event = "H:AS430_OBS_Push"
|
||||||
|
},
|
||||||
|
MSG = {
|
||||||
|
pin = "D6",
|
||||||
|
event = "H:AS430_MSG_Push"
|
||||||
|
},
|
||||||
|
FPL = {
|
||||||
|
pin = "D7",
|
||||||
|
event = "H:AS430_FPL_Push"
|
||||||
|
},
|
||||||
|
PROC = {
|
||||||
|
pin = "D8",
|
||||||
|
event = "H:AS430_PROC_Push"
|
||||||
|
},
|
||||||
|
-- Right Side Buttons
|
||||||
|
DCT = {
|
||||||
|
pin = "D9",
|
||||||
|
event = "H:AS430_DirectTo_Push"
|
||||||
|
},
|
||||||
|
MENU = {
|
||||||
|
pin = "D10",
|
||||||
|
event = "H:AS430_MENU_Push"
|
||||||
|
},
|
||||||
|
CLR = {
|
||||||
|
pin = "D11",
|
||||||
|
event = "H:AS430_CLR_Push",
|
||||||
|
event2 = "H:AS430_CLR_Push_Long"
|
||||||
|
},
|
||||||
|
ENT = {
|
||||||
|
pin = "D12",
|
||||||
|
event = "H:AS430_ENT_Push"
|
||||||
|
},
|
||||||
|
-- Zoom Buttons
|
||||||
|
ZOOM = {
|
||||||
|
pin = "D13",
|
||||||
|
event = "H:AS430_RNG_Zoom"
|
||||||
|
},
|
||||||
|
DEZOOM = {
|
||||||
|
pin = "D14",
|
||||||
|
event = "H:AS430_RNG_Dezoom"
|
||||||
|
},
|
||||||
|
-- Knob Push Buttons
|
||||||
|
CVPUSH = {
|
||||||
|
pin = "D15",
|
||||||
|
event = "H:AS430_LeftSmallKnob_Push"
|
||||||
|
},
|
||||||
|
CRSRPUSH = {
|
||||||
|
pin = "D16",
|
||||||
|
event = "H:AS430_RightSmallKnob_Push"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
knobs = {
|
||||||
|
CVBig = {
|
||||||
|
pinA = "D17",
|
||||||
|
pinB = "D18",
|
||||||
|
event = "H:AS430_LeftLargeKnob"
|
||||||
|
},
|
||||||
|
CVSmall = {
|
||||||
|
pinA = "D19",
|
||||||
|
pinB = "D20",
|
||||||
|
event = "H:AS430_LeftSmallKnob"
|
||||||
|
},
|
||||||
|
CRSRBig = {
|
||||||
|
pinA = "D21",
|
||||||
|
pinB = "D22",
|
||||||
|
event = "H:AS430_RightLargeKnob"
|
||||||
|
},
|
||||||
|
CRSRSmall = {
|
||||||
|
pinA = "D23",
|
||||||
|
pinB = "D24",
|
||||||
|
event = "H:AS430_RightSmallKnob"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- run the setup
|
||||||
|
setupButtons()
|
||||||
|
setupEncoders()
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
@@ -1,343 +0,0 @@
|
|||||||
-- Garmin GNS430 overlay for X-Plane --
|
|
||||||
-- Message Raspberry Pi and tablet
|
|
||||||
if instrument_prop("PLATFORM") == "RASPBERRY_PI" or instrument_prop("PLATFORM") == "ANDROID" or instrument_prop("PLATFORM") == "IPAD" then
|
|
||||||
canvas_add(195, 40, 437, 239, function()
|
|
||||||
_rect(0,0,437,239)
|
|
||||||
_fill("black")
|
|
||||||
end)
|
|
||||||
canv_message = canvas_add(195, 40, 437, 239, function()
|
|
||||||
_rect(0,0,437,239)
|
|
||||||
_fill("blue")
|
|
||||||
_txt("THIS X-PLANE 11 AND FS2020 GPS OVERLAY", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 60)
|
|
||||||
_txt("WORKS ON THE DESKTOP ONLY", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 90)
|
|
||||||
_txt("BUTTONS AND DIALS STILL WORK", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 120)
|
|
||||||
_txt("CLICK HERE TO HIDE THIS MESSAGE", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 150)
|
|
||||||
end)
|
|
||||||
butn_hide = button_add(nil, nil, 195, 40, 437, 239, function()
|
|
||||||
visible(canv_message, false)
|
|
||||||
visible(butn_hide, false)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
-- Message desktop
|
|
||||||
pers_msg_read = persist_add("msg_read", false)
|
|
||||||
if (instrument_prop("PLATFORM") == "WINDOWS" or instrument_prop("PLATFORM") == "MAC" or instrument_prop("PLATFORM") == "LINUX") and not persist_get(pers_msg_read) then
|
|
||||||
canv_message = canvas_add(195, 40, 437, 239, function()
|
|
||||||
_rect(0,0,437,239)
|
|
||||||
_fill("blue")
|
|
||||||
_txt("THIS IS AN OVERLAY ONLY", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 60)
|
|
||||||
_txt("IT REQUIRES THE FLIGHTSIM GPS POP OUT", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 90)
|
|
||||||
_txt("SEE OUR WIKI FOR MORE INFORMATION", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 120)
|
|
||||||
_txt("CLICK HERE TO HIDE THIS MESSAGE", "font:roboto_bold.ttf; size:26; color: white; halign:center;", 218, 150)
|
|
||||||
end)
|
|
||||||
butn_hide = button_add(nil, nil, 195, 40, 437, 239, function()
|
|
||||||
visible(canv_message, false)
|
|
||||||
visible(butn_hide, false)
|
|
||||||
persist_put(pers_msg_read, true)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
img_add_fullscreen("Garmin_430_2d.png")
|
|
||||||
|
|
||||||
gps_no = user_prop_add_enum("Selected GPS unit","GPS 1,GPS 2","GPS 2","Select GPS Unit to control")
|
|
||||||
rxp_ctrl = user_prop_add_enum("Type","Default,Reality XP","Default","For X-Plane select default or Reality XP")
|
|
||||||
local g_unit = fif(user_prop_get(gps_no)=="GPS 1", 1, 2)
|
|
||||||
local g_unit_fsx = fif(user_prop_get(gps_no)=="GPS 1", 0, 8)
|
|
||||||
local g_ctrl = fif(user_prop_get(rxp_ctrl)=="Default", 1, 2)
|
|
||||||
|
|
||||||
--volume dials
|
|
||||||
pwr_knob = dial_add("pwr_off.png", 50,36,38,38,function (position)
|
|
||||||
if position == 1 then
|
|
||||||
fsx_event("GPS_POWER_BUTTON", 4 + g_unit_fsx)
|
|
||||||
elseif position == -1 then
|
|
||||||
fsx_event("GPS_POWER_BUTTON", 2 + g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
vvol_knob = dial_add("vvol.png", 50,109,38,38,function (position)
|
|
||||||
if position == 1 then
|
|
||||||
fsx_event("GPS_ACTIVATE_BUTTON", 4 + g_unit_fsx)
|
|
||||||
elseif position == -1 then
|
|
||||||
fsx_event("GPS_ACTIVATE_BUTTON", 2 + g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Buttons --
|
|
||||||
button_com = button_add(nil, nil, 55,41,28,28,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_cvol")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/PWR_PUSH_" .. g_unit)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_vlc = button_add(nil, nil, 55,114,28,28,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_vvol")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/VOL_PUSH_" .. g_unit)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_swc = button_add(nil, nil, 135,50,38,60,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_com_ff")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/CFLP_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_COMSWAP_Push")
|
|
||||||
|
|
||||||
if g_unit_fsx == 0 then
|
|
||||||
fsx_event("COM_STBY_RADIO_SWAP")
|
|
||||||
elseif g_unit_fsx == 8 then
|
|
||||||
fsx_event("COM2_RADIO_SWAP")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_swn = button_add(nil, nil, 135,133,38,60,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_nav_ff")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/VFLP_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_NAVSWAP_Push")
|
|
||||||
|
|
||||||
if g_unit_fsx == 0 then
|
|
||||||
fsx_event("NAV1_RADIO_SWAP")
|
|
||||||
elseif g_unit_fsx == 8 then
|
|
||||||
fsx_event("NAV2_RADIO_SWAP")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_cdi = button_add(nil, nil, 204,290,58,34,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_cdi")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/CDI_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("TOGGLE_GPS_DRIVES_NAV1")
|
|
||||||
fsx_event("GPS_NEAREST_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_obs = button_add(nil, nil, 295,290,58,34,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_obs")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/OBS_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_OBS_Push")
|
|
||||||
fsx_event("GPS_OBS_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_msg = button_add(nil, nil, 384,290,58,34,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_msg")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/MSG_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_MSG_Push")
|
|
||||||
fsx_event("GPS_MSG_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_fpl = button_add(nil, nil, 476,290,58,34,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_fpl")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/FPL_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_FPL_Push")
|
|
||||||
fsx_event("GPS_FLIGHTPLAN_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_prc = button_add(nil, nil, 565,290,58,34,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_proc")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/PROC_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_PROC_Push")
|
|
||||||
fsx_event("GPS_PROCEDURE_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_rup = button_add(nil, nil, 653,30,64,40,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_zoom_out")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/RUP_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RNG_Dezoom")
|
|
||||||
fsx_event("GPS_ZOOMOUT_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_rdn = button_add(nil, nil, 717,30,64,40,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_zoom_in")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/RDN_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RNG_Zoom")
|
|
||||||
fsx_event("GPS_ZOOMIN_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_dir = button_add(nil, nil, 652,80,58,38,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_direct")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/DTO_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_DirectTo_Push")
|
|
||||||
fsx_event("GPS_DIRECTTO_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
button_men = button_add(nil, nil, 725,80,58,38,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_menu")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/MNU_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_MENU_Push")
|
|
||||||
fsx_event("GPS_MENU_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
function callback_clr_down()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_clr", 1)
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/CLR_" .. g_unit, 1)
|
|
||||||
end
|
|
||||||
timer_clear = timer_start(2000, function()
|
|
||||||
fs2020_event("H:AS430_CLR_Push_Long")
|
|
||||||
fsx_event("GPS_CLEAR_ALL_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
function callback_clr_up()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_clr", 0)
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/CLR_" .. g_unit, 0)
|
|
||||||
end
|
|
||||||
if timer_running(timer_clear) then
|
|
||||||
timer_stop(timer_clear)
|
|
||||||
fs2020_event("H:AS430_CLR_Push")
|
|
||||||
fsx_event("GPS_CLEAR_BUTTON", g_unit_fsx)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
button_clr = button_add(nil, nil, 652,130,58,38,callback_clr_down,callback_clr_up)
|
|
||||||
|
|
||||||
button_ent = button_add(nil, nil, 725,130,58,38,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_ent")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/ENT_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_ENT_Push")
|
|
||||||
fsx_event("GPS_ENTER_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Dial PUSH C/V
|
|
||||||
dial_cv_big = dial_add(nil, 2,200,130,130,function(direction)
|
|
||||||
if direction == 1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_coarse_up")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/COM_OUTR_CW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_LeftLargeKnob_Right")
|
|
||||||
fsx_event("GPS_BUTTON2", g_unit_fsx)
|
|
||||||
elseif direction == -1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_coarse_down")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/COM_OUTR_CCW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_LeftLargeKnob_Left")
|
|
||||||
fsx_event("GPS_BUTTON3", g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
dial_cv_sml = dial_add(nil, 28,228,78,78,function(direction)
|
|
||||||
if direction == 1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_fine_up")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/COM_INNR_CW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Right")
|
|
||||||
fsx_event("GPS_BUTTON4", g_unit_fsx)
|
|
||||||
elseif direction == -1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_fine_down")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/COM_INNR_CCW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Left")
|
|
||||||
fsx_event("GPS_BUTTON5", g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
mouse_setting(dial_cv_sml, "CURSOR_LEFT", "ctr_cursor_ccw.png")
|
|
||||||
mouse_setting(dial_cv_sml, "CURSOR_RIGHT", "ctr_cursor_cw.png")
|
|
||||||
|
|
||||||
button_pcv = button_add(nil, nil, 47,247,40,40,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_nav_com_tog")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/COM_PUSH_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_LeftSmallKnob_Push")
|
|
||||||
fsx_event("GPS_BUTTON1", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Dial PUSH CRSR
|
|
||||||
dial_cr_big = dial_add(nil, 668,196,130,130,function(direction)
|
|
||||||
if direction == 1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_chapter_up")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/GPS_OUTR_CW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RightLargeKnob_Right")
|
|
||||||
fsx_event("GPS_GROUP_KNOB_INC", g_unit_fsx)
|
|
||||||
elseif direction == -1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_chapter_dn")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/GPS_OUTR_CCW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RightLargeKnob_Left")
|
|
||||||
fsx_event("GPS_GROUP_KNOB_DEC", g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
dial_cr_sml = dial_add(nil, 694,224,78,78,function(direction)
|
|
||||||
if direction == 1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_page_up")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/GPS_INNR_CW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Right")
|
|
||||||
fsx_event("GPS_PAGE_KNOB_INC", g_unit_fsx)
|
|
||||||
elseif direction == -1 then
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_page_dn")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/GPS_INNR_CCW_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Left")
|
|
||||||
fsx_event("GPS_PAGE_KNOB_DEC", g_unit_fsx)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
mouse_setting(dial_cr_sml, "CURSOR_LEFT", "ctr_cursor_ccw.png")
|
|
||||||
mouse_setting(dial_cr_sml, "CURSOR_RIGHT", "ctr_cursor_cw.png")
|
|
||||||
|
|
||||||
button_pcr = button_add(nil, nil, 713,243,40,40,function()
|
|
||||||
if g_ctrl == 1 then
|
|
||||||
xpl_command("sim/GPS/g430n" .. g_unit .. "_cursor")
|
|
||||||
else
|
|
||||||
xpl_command("RXP/GNS/GPS_PUSH_" .. g_unit)
|
|
||||||
end
|
|
||||||
fs2020_event("H:AS430_RightSmallKnob_Push")
|
|
||||||
fsx_event("GPS_CURSOR_BUTTON", g_unit_fsx)
|
|
||||||
end)
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# 1. Create new temporary instrument
|
||||||
|
In Air Manager, navigate to the `create/edit` tab.
|
||||||
|
|
||||||
|
1. Click `New+` to create a new instument. Details don't matter as we delete this again later.
|
||||||
|
2. Select the new Instrument in the list.
|
||||||
|
3. Click "Folder" in the menu and find the folder `OPEN_DIRECTORY`. <br>
|
||||||
|
This is where insturments are installed. <br>
|
||||||
|
Pin it to the favorites in Explorer for easy access.
|
||||||
|
4. You can delete the test instrument.
|
||||||
|
|
||||||
|
# 2. Install the GNS430 Instrument
|
||||||
|
1. Download this repository
|
||||||
|
2. move the gns430-hardware folder into `OPEN_DIRECTORY``
|
||||||
|
3. The Instrument is now installed.
|
||||||
|
|
||||||
|
# 3. Use the Instrument in a Panel
|
||||||
|
1. In AirManager, go to the `home` tab.
|
||||||
|
2. Select the panel in the list on the left.
|
||||||
|
3. Click `Instument+`in the Ribbon Menu.
|
||||||
|
4. Find `GNS430 Hardware` and add it.
|
||||||
|
5. Open the instrument list by click the triangle next to the panel in the list.
|
||||||
|
6. Select `Generic - GNS430 Hardware`
|
||||||
|
7. Scroll down to user properties and select the pins to which the cables were soldered.
|
||||||
|
8. Have fun.
|
||||||
|
|
||||||
|
# Hints
|
||||||
|
## Arduino Channels
|
||||||
|
Arduinos have assigned channels. This channel is selected whe flashing the arduino (Flash Menu).
|
||||||
|
In Step #3, Channel 0 Corresponds to Channel A, 1 to B, 2 to C, and so forth.
|
||||||
|
|
||||||
|
## Available Pins
|
||||||
|
Do not use Pins D0 and D1, as they are used for serial communication between airmanager and the arduino.
|
||||||
|
You can use Pins D2 and upwards.
|
||||||
|
|
||||||
|
## Default assignment
|
||||||
|
The Buttons and Encoders have a default assignment, which is loaded when adding the instrument.
|
||||||
|
Changes to the selection are stored until the instrument is removed from the panel.
|
||||||
|
It will reset to the default when the instrument is added again.
|
||||||
|
|
||||||
Reference in new issue
Block a user