Jump to content

help with clickable buttons


Recommended Posts

Hello,

 

I have started building virtual cockpit for MIG 21. This is my first build and I have thoroughly read all the info from this forum.

However, I have problem mapping some cockpit functionality to rotary encoder and pots.

Let's take MIG 21 RADIO CHANNEL wheel for example. There is no keyboard command for that button - no radio channel + nor radio channel - command. This command is pure clickable button.

 

I have examined default.lua, devices.lua, commands.lua and clickabledata.lua.

What I have found is this in clickabledata.lua

 

elements["PNT_211"] = multiposition_switch(LOCALIZE("Radio Channel"),devices.RADIO, device_commands.RadioChannel, 211, 20, 0.05, true)

This tells me few things:

 

  1. it has 20 positions (0-19)
  2. increment is 0.05
  3. it is inverted

So, position 0 has value 0.05, position 2 has value 0.1 position 3 0.15 etc...

 

 

Now I come to the problem, how can I connect this to the rotary encoder or pot ?

 

 

I know I can map it to the rotary switch and assign each rotarry button value - something like this

 

{combos={{key='JOY_BTN1'}},pressed=device_commands.RadioChannel,cockpit_device_id=devices.RADIO,value_pressed=0.05,name='RADIO CHANNEL #1 ',category='RADIO'},
{combos={{key='JOY_BTN2'}},pressed=device_commands.RadioChannel,cockpit_device_id=devices.RADIO,value_pressed=0.10,name='RADIO CHANNEL #2 ',category='RADIO'},

however there are two problems with this solution

 

  1. it is really clumsy
  2. there are 20 positions so I would end up with single pole - double platter rotary with 24 switch positions which would eat almost whole single BBI-32

The other solution is to write my peace of software and couple it with export.lua. So my software keeps track of current clickable button position (count) and send appropriate absolute value by calling performclickableaction.

 

 

I really don't find any logical reasoning for making things so complicated. Therefore I doubt that I have explored this problem from the right angle. Can you please share your knowledge with me and give me any clue how this can be done or how is this done in DCS ?

 

 

many thanks

Mirko

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...