Syl20 Posted March 25, 2017 Report Share Posted March 25, 2017 (edited) 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 March 25, 2017 by Syl20 Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 (edited) 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 March 25, 2017 by jfjoubert Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 Maybe I should have asked before... what are you using to interface your Arduino with the sim? Do you run FlyWithLua? Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 (edited) I am using ArdSim right now. I haven't tried FlyWithLua yet. Edited March 25, 2017 by Syl20 Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 Unfortunately I haven't used ArdSim yet... are your rotary encoders etc. visible as buttons inside the x-plane Joystick & Equipment menu? Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 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? Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 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... Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 Yes I have tried "C1 ixeg/733/radios/radios_com1_left_khz 1+" also but nothing happens. Hmmm, I am running out of idea... Anyway, thanks for your time jfjoubert, I appreciate :-) Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 No wait, it is working :-))))) I will check what I did wrong the first time. Thanks again jfjoubert Quote Link to comment Share on other sites More sharing options...
mmerelles Posted March 25, 2017 Report Share Posted March 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
mmerelles Posted March 25, 2017 Report Share Posted March 25, 2017 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. 1 Quote Link to comment Share on other sites More sharing options...
Syl20 Posted March 25, 2017 Author Report Share Posted March 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
jfjoubert Posted March 25, 2017 Report Share Posted March 25, 2017 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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.