Jump to content

Radio panel COM1/2 & DataRef / Command


Syl20
 Share

Recommended Posts

Hej Guys,

I have some troubles with radio frequencies modification from my cockpit driven using Arduino.

If I use for example the command "sim/radios/actv_com1_coarse_up" then it works fine, but it modifies the active com1. I want to be able to modify the same side as where my encoder is situated, even if it's not the active side.

If I use for example the dataref "ixeg/733/radios/radios_com1_right_mhz" and send a value between 0-19 then nothing happens. It seems to be the correct way to do this but, could this dataref be read only?

 

The only solution I see right now, is to test which side is active and use either "sim/radios/actv_com1_coarse_up" or "sim/radios/stby_com1_coarse_up" in order to update the correct side. But I wonder if I am missing something here!

 

Has anyone had this issue?

Which Command/DataRef are you using for this?

 

Thanks in advance for your feedback

Cheers

Syl20

 

Edited by Syl20
Link to comment
Share on other sites

19 hours ago, Syl20 said:

Hej Guys,

I have some troubles with radio frequencies modification from my cockpit driven using Arduino.

If I use for example the command "sim/radios/actv_com1_coarse_up" then it works fine, but it modifies the active com1. I want to be able to modify the same side as where my encoder is situated, even if it's not the active side.

If I use for example the dataref "ixeg/733/radios/radios_com1_right_mhz" and send a value between 0-19 then nothing happens. It seems to be the correct way to do this but, could this dataref be read only?

 

The only solution I see right now, is to test which side is active and use either "sim/radios/actv_com1_coarse_up" or "sim/radios/stby_com1_coarse_up" in order to update the correct side. But I wonder if I am missing something here!

 

Has anyone had this issue?

Which Command/DataRef are you using for this?

 

Thanks in advance for your feedback

Cheers

Syl20

 

Hi Syl20,

I just had a quick look and here are my findings: (I don't have any Arduino hardware so I'm simply using FlyWithLua with my Saitek Yoke to do the tests.)

First of all you have to keep in mind that the "ixeg/733/radios/radios_com1_left_khz" etc. are not standard datarefs, they are custom manipulator datarefs. So you cannot "write" a value to them. You "code" them as a command which can then be mapped via the Joystick & Equipment - Buttons: Adv menu and then using the "custom cmnds from plugins" option.

I have just done a test in FlyWithLua and I'm able to increase and decrease the mhz and khz of both com radios, active and inactive without having to know which one is currently active.

For Com1 left mhz : Use "ixeg/733/radios/radios_com1_left_mhz" as a command where you increase the value by 1 every time the command is executed.
For Com1 left khz : Use "ixeg/733/radios/radios_com1_left_khz" as a command where you increase the value by 1 every time the command is executed.
For Com1 right mhz : Use "ixeg/733/radios/radios_com1_right_mhz" as a command where you increase the value by 1 every time the command is executed.
For Com1 right khz : Use "ixeg/733/radios/radios_com1_right_khz" as a command where you increase the value by 1 every time the command is executed.
Then you do the same for all 4 above but decrease the value by 1 every time.

Then do the same as above for Com2 if needed.

Let me know if you would like to see some code or if you have any other questions.

Regards,
Jean

Edited by jfjoubert
Link to comment
Share on other sites

Hello jfjoubert,

"For Com1 left mhz : Use "ixeg/733/radios/radios_com1_left_mhz" as a command where you increase the value by 1 every time the command is executed."

Ok, but I cannot see how I can tell X-Plane to increase or decrease by one if I use this as a command as I cannot pass any value.

 

Link to comment
Share on other sites

No, I use Ethernet between X-Plane and ArdSim so my cockpit only has UDP to communicate.

Nothing appears as joystick & equipment.

I am also pretty sure that these manipulators "ixeg/733/radios/radios_com1_left_mhz" are the way to go, but I am missing something that I cannot put my finger on right now...

 

Can you see, in FlyWithLua, what is sent to X-Plane other that the command "ixeg/733/radios/radios_com1_left_mhz"? There must be something telling X-Plane if it is an increase or a decrease of the frequency?

Link to comment
Share on other sites

I just had a quick look at the ArdSim interface...

Have you tried using the "datarefs for custom input configuration" as explained on this page http://svglobe.com/ardsim/ardsim_input.html ?

So I would code something like this in the config file...

C1 ixeg/733/radios/radios_com1_left_khz 1+
C2 ixeg/733/radios/radios_com1_left_mhz 1+
C3 ixeg/733/radios/radios_com1_right_khz 1+
C4 ixeg/733/radios/radios_com1_right_mhz 1+
C5 ixeg/733/radios/radios_com1_left_khz 1-
C6 ixeg/733/radios/radios_com1_left_mhz 1-
C7 ixeg/733/radios/radios_com1_right_khz 1-
C8 ixeg/733/radios/radios_com1_right_mhz 1-

In your Arduino code you'll call SimInput(3) for example to increment com1 right khz or SimInput(8) to decrease com1 right mhz whenever your encoder turns.

As to the values being sent by FlyWithLua... as far as I know the commands in FlyWithLua is simply mapped to the custom dataref manipulators which will actually turn the virtual dials in the cockpit. The IXEG code behind the scenes will then set the actual radio frequencies... it is similar to you using the mouse to manipulate the dials. But this is just my guess... I'm no expert on this whatsoever.

Let me know if this works...

Link to comment
Share on other sites

Guys all those you were discussing above such us 'ixeg/733/radios/radios_com1_left_mhz' are datarefs not custom commands.

 

Your software interface (flywithlua, Ardsim or whatever you use) are required to write a +1 to increase to mimic rotating right  and -1 to go backwards rotate left.

Link to comment
Share on other sites

9 minutes ago, Syl20 said:

No wait, it is working :-)))))

I will check what I did wrong the first time.

Thanks again jfjoubert

You're welcome...

2 minutes ago, mmerelles said:

Guys all those you were discussing above such us 'ixeg/733/radios/radios_com1_left_mhz' are datarefs not custom commands.

 

Your software interface (flywithlua, Ardsim or whatever you use) are required to write a +1 to increase to mimic rotating right  and -1 to go backwards rotate left.

Yes, I know that... but you still need to map it as a custom command to be able to bind it to a joystick button etc. Can be a bit confusing at times... Thanks for your input.

Link to comment
Share on other sites

I found out why it didn't work:

It is something related to ArdSim plugin/interface

if I use XPCmnd("ixeg/733/radios/radios_com1_right_khz 1+"); from Arduino, it doesn't work.

If I use a custom command in the in_1.cfg file like C190 ixeg/733/radios/radios_com1_right_khz 1+ and call it from arduino with SimInput(190); then it works.

Link to comment
Share on other sites

1 minute ago, Syl20 said:

if I use XPCmnd("ixeg/733/radios/radios_com1_right_khz 1+"); from Arduino, it doesn't work.

This will not work ever because this is to map a custom command. Custom commands are actions they do not accept any parameter.

 

1 minute ago, Syl20 said:

If I use a custom command in the in_1.cfg file like C190 ixeg/733/radios/radios_com1_right_khz 1+ and call it from arduino with SimInput(190); then it works.

This works because you are actually declaring as a dataref and sending a +1 value to whatever the memory position is holding.

  • Upvote 1
Link to comment
Share on other sites

Thanks for the information mmerelles

I know that there is a difference between DataRef and Command.

But in this case, I must admit that this is not very clear to me yet.

I tried to write a value to the DataRef with XPDref ("ixeg/733/radios/radios_com1_right_mhz", counter); it didn't work. (counter was a value between 0 and 19)

If I use a custom command in the in_1.cfg file like C190 ixeg/733/radios/radios_com1_right_khz 1+ and call it from arduino with SimInput(190); then it works.

So why does one work and not the other?

I can see that sending a value between 0-19 doesn't tell X-Plane which way to turn the knob while +1/-1 does.

Link to comment
Share on other sites

I think it is because the  "ixeg/733/radios/radios_com1_right_mhz" is a manipulator dataref, so you have to take the current value of the dataref and either add or subtract 1 for the dial to turn. There isn't really any meaningful value contained in this dataref... it goes from 0 to 19 but it's just an arbitrary value.

You might be able to use the following as well...
XPDref("ixeg/733/radios/radios_com1_right_mhz", GetData(190) + 1) 

The GetData(190) will retrieve the current value of the #190 dataref from your config file.

Theoretically it should do the same as the SimInput(190) solution... (I'm once again just guessing) ;)

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...