Search the Community
Showing results for tags 'open cockpits'.
Found 1 result
-
Hello All For some time now I have been using LINDA with my Saitek switch panel, Yoke & VRInsite MCP . Great tool, thank you Guenseli. But eventually I thought that it was time to add more buttons and switches. I decided to buy an Open Cockpits i/p, o/p board and build it myself, having had some experience with electronics and software, no problems except that I soldered all the diodes the wrong way round. Everything working ok, programmed most of the switches and lights with SIOC to operate via FSUIPC. But,as I a fly several different types of aircraft and it's not easy to detect in SIOC the aircraft currently in use. So, I used LINDA to write a bit to a user byte in FSUIC which I could then detect in SIOC. Each user.lua sets a different bit (Boeing, Airbus, default, ..etc). That was a bit better. But programming in SIOC is so... time consuming I though there has to be a better way. So more study and research. I thought to write LUA code to be run by FSUIPC. I looked at writing my own app and running it in LUA/FSUIPC but then I thought much of the code is already available in LINDA actions.lua but I don't want to touch that. After much trial and error and searching I found the lib-user.lua Just what I need. I don't need to write my own routines everything is available from here. So what now happens. All that SIOC does is operate one of the virtual joystick buttons in FSUIPC , e.g. # SIOC code Var 0994, name JoyStick1, Link FSUIPC_OUT, Offset $3340, Length 4 // Joystick address Var 0169, name SetJoyBtn, Link SUBRUTINE { IF &BtnSet = 1 { &JoyStick1 = SETBIT &BtnNumber } ELSE { &JoyStick1 = CLEARBIT &BtnNumber } } -- one variable for each button Var 0170, name PBtn1, Link IOCARD_SW, Device 3, Input 8, Type I { &BtnSet = &PBtn1 &BtnNumber = 1 CALL &SetJoyBtn } Var 0171, name PBtn2, Link IOCARD_SW, Device 3, Input 6, Type I { &BtnSet = &PBtn2 &BtnNumber = 2 CALL &SetJoyBtn } Var 0172, name PBtn3, Link IOCARD_SW, Device 3, Input 7, Type I { &BtnSet = &PBtn3 &BtnNumber = 3 CALL &SetJoyBtn } These button events are caught by LINDA in lib-user.lua # LINDA lib-user.lua code function handleButtons(joynum, button, downup) -- call handler VButton_handler (joynum, button, downup) -- this fuction is in the user.lua of each airplane -- or you can handle each event separtely (globaly) here. if button == 0 then end if button == 1 then end if button == 2 then end if button == 3 then end if button == 4 then end -- etc end -- function -- events for virtual joystick buttons event.button(64,0,3,"handleButtons") event.button(64,1,3,"handleButtons") event.button(64,2,3,"handleButtons") event.button(64,3,3,"handleButtons") event.button(64,4,3,"handleButtons") event.button(64,5,3,"handleButtons") -- etc and sent to the button handler which is in LINDA user.lua # LINDA user.lua function VButton_handler (joyNo,btnNo,downUp) -- switch case would be nice here -- only joy stick 64 -- FSUIPC is from 0 .. 31, Linda 1.. 32 if btnNo == 0 then VButton_1 (downUp) elseif btnNo == 1 then VButton_2 (downUp) elseif btnNo == 2 then VButton_3 (downUp) elseif btnNo == 3 then VButton_4 (downUp) elseif btnNo == 4 then VButton_5 (downUp) elseif btnNo == 5 then VButton_6 (downUp) end -- etc end -- end VButton_handler This means that each aircraft in LINDA has its own set of actions for the aircraft currently in use and has full access to all the LINDA code. BINGO!!! Also all the user.lua code can be edited in LINDA editor. lib-user.lua should not need to be changed except for generic actions. I put the default settings in the templates/users/user.lua for any new aircraft. At the moment all my encoders are working ok, but I think I might try write something to be able to control them better in lua. What would be 'icing on the cake', if it was possible to assign functions to the virtual joystick buttons from the LINDA interface, but I realize that that is not quite as simple as I first thought. :wub: My thanks to Guenseli and Peter Dowson for there dedication and great support. Hope that this will be of use to others A very happy Carliolian
- 6 replies
-
- open cockpits
- linda
-
(and 1 more)
Tagged with: