Jump to content

Interfacing the CDU


frumpy
 Share

Recommended Posts

Hi guys,

as the title says, I am trying to do some interfacing. Using the dataref tool, I found that pressing a button within X-Plane sets the dataref from 0 to 1, releasing the button sets it back to 0. I can manually change the value of the dataref and this is working fine. However, when trying to do the same thing in LUA, I'll get several characters displayed on the CDU (like "AAAAA" instead of "A").

I see some people already interfaced the CDU for their private sim or as commercial software, but I wonder how this was done?

Example code, which prints "BBBB" one second after clicking the "B" button:
 

function b_pressed()                
    xpl_dataref_write ("ixeg/733/FMC/cdu1_B", "FLOAT", 1)
        timer_start(1000,timer_b)
end

function timer_b()
       xpl_dataref_write ("ixeg/733/FMC/cdu1_B", "FLOAT", 0)
        sound_play(clicksound)
    print ("B pressed")
end

 

Can anyone help?

Link to comment
Share on other sites

I'm using Air Manager for interfacing.

The default value of ...733/CDU/key_x is "-1". Clicking with the mouse within XP sets the dataref to "1", releasing it to "0" - while the CDU prints the character. I found  sending just a "0" to the dataref via AM does a keypress, but with several characters. So there is no need to reset the dataref, setting a value of "0" to "0" is handled like a keypress.

Sending "0" twice does the same as sending it once. It shows 2-5 characters, not reliably reproduceable.

ixegcdu.jpg

Edited by frumpy
Link to comment
Share on other sites

I had a quick look with FlyWithLua...

When you set the dataref to "0" you will get a single click, so there is no need to set it to "1" and then back to "0". I reliably get only one key press using this method. So in theory what you're doing should work.

I assume that it's the way Air Manager handles things... maybe you should also post this question on the Air Manager support forum and see if someone can assist you.

 

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...