Jump to content

Recommended Posts

Posted

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?

Posted

What happens if you mouse click the CDU button and hold the mouse down for 1 second? I would expect the same result.

You probably need to "release" the CDU button by writing the 0 after a shorter interval.

This will probably need to be 1 frame.

 

I don't know how you would do that in FWL script.

Posted (edited)

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
Posted

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

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...
  • Recently Browsing   0 members

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