Skip to content

Instantly share code, notes, and snippets.

@tyrelsouza
Last active September 20, 2019 01:45
Show Gist options
  • Save tyrelsouza/3b038df56b73cba8d9e320c93ddeb086 to your computer and use it in GitHub Desktop.
Save tyrelsouza/3b038df56b73cba8d9e320c93ddeb086 to your computer and use it in GitHub Desktop.
-- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');
COM = "g430n1"
TANK = "lft"
grid = {}
grid[192] = function (direction) -- [1, 1]
lmc_xpl_command("sim/flight_controls/flaps_up")
end
grid[49] = function (direction) -- [1, 2]
lmc_xpl_command("sim/fuel/fuel_pumps_tog")
end
grid[50] = function (direction) -- [1, 3]
lmc_xpl_command("sim/lights/landing_lights_toggle")
end
grid[51] = function (direction) -- [1, 4]
lmc_xpl_command("sim/lights/strobe_lights_toggle")
end
grid[52] = function (direction) -- [1, 5]
lmc_xpl_command("sim/lights/nav_lights_toggle")
end
grid[55] = function (direction) -- [1, 8]
lmc_xpl_command_end('sim/engines/engage_starters')
end
grid[56] = function (direction) -- [2, 1]
lmc_xpl_command("sim/flight_controls/flaps_down")
end
grid[57] = function (direction) -- [2, 2]
-- Toggle TANK
if (TANK == "lft") then
TANK = "rgt"
else
TANK = "lft"
end
lmc_xpl_text(TANK)
lmc_xpl_command("sim/fuel/fuel_selector_" .. TANK)
end
grid[221] = function (direction) -- [4, 1]
lmc_xpl_command("sim/GPS/".. COM .. "_nav_com_tog")
end
grid[74] = function (direction) -- [5, 1]
lmc_xpl_command("sim/GPS/".. COM .. "_com_ff")
end
grid[75] = function (direction) -- [5, 2]
lmc_xpl_command("sim/GPS/".. COM .. "_coarse_down")
end
grid[76] = function (direction) -- [5, 3]
lmc_xpl_command("sim/GPS/".. COM .. "_coarse_up")
end
grid[186] = function (direction) -- [5, 4]
lmc_xpl_command("sim/GPS/".. COM .. "_page_dn")
end
grid[90] = function (direction) -- [5, 5]
lmc_xpl_command("sim/GPS/".. COM .. "_page_up")
end
grid[88] = function (direction) -- [5, 6]
lmc_xpl_command("sim/GPS/".. COM .. "_direct")
end
grid[112] = function (direction) -- [6, 1]
lmc_xpl_command("sim/GPS/".. COM .. "_nav_ff")
end
grid[113] = function (direction) -- [6, 2]
lmc_xpl_command("sim/GPS/".. COM .. "_fine_down")
end
grid[114] = function (direction) -- [6, 3]
lmc_xpl_command("sim/GPS/".. COM .. "_fine_up")
end
grid[115] = function (direction) -- [6, 4]
lmc_xpl_command("sim/GPS/".. COM .. "_chapter_dn")
end
grid[116] = function (direction) -- [6, 5]
lmc_xpl_command("sim/GPS/".. COM .. "_chapter_up")
end
grid[117] = function (direction) -- [6, 6]
lmc_xpl_command("sim/GPS/".. COM .. "_ent")
end
-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
print(button)
if (direction == 1) then
if button == 55 then
lmc_xpl_command_begin('sim/engines/engage_starters')
return
end
end
if direction == 0 then
grid[button](direction)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment