1. Included(but modified) "TripleUse.lua" works.
2. Made new lua for TrackIR-One button click for "CENTER", two for "PAUSE". Also wanted to automatically turn on "PRECISION".
3. TripleUse(for Panels 2,3,4) works fine, must be error in sending keypresses.
4. Bottom of FSUIPC4.ini looks like:
[Auto]
1=Lua 1But_F12-F11
2=Lua 1But_Panel-2-3-4
3=Lua SynAxis
5. 1But_F12-F11.lua looks like:
-- TrackIR Control
-- 1st, Turn "Precision Control ON" ipc.keypress(F10)
-- Making a single button give two separate uses: -- The multiple use is obtained by a simple method: -- A short press and release (like a mouse click) -- A double short press and release (like a double click)
-- Single short press = F12 (TrackIR Center) -- Two short presses = F11 (TrackIR Pause)
-- Yoke, Right Side Red Button
joy = 2 btn = 1 interval = 500 -- 1/2 second press, gap, press limits
-- Function to time the button being pressed or left released -- Allow only up to "interval" till decide no change local function timebutton(test) while true do time2 = ipc.elapsedtime() if (time2 - time1) > interval then return false end if ipc.testbutton(joy, btn) == test then time1 = time2 return true end ipc.sleep(20) end end
function buttonpress(j, b, du) -- Cancel event so we don't get called again for double press event.cancel("buttonpress") -- Note time button was pressed time1 = ipc.elapsedtime()
-- First press / release counts: see if there's another if timebutton(true) then -- got another press in time, look for release if timebutton(false) then -- this was a double press, send "Instrument/Panel #2" ipc.keypress(F11) end else -- This was a single press, send "Instrument/Panel #1" ipc.keypress(F12) end
-- Restore cancelled event event.button(joy, btn, 1, "buttonpress") end
-- Enable event on button being pressed (only) event.button(joy, btn, 1, "buttonpress")
Thx In Advance
~ Matt