X Plane 10 Writing DataRefs Question

Status
Not open for further replies.

phxflyer

Member
I am trying to use a teensy 2.0 to modify weather variables as sort of an instructor console.

I seem to be having trouble with this dataref, specifically.

/sim/weather/wind_speed_kt[0] int 660+ yes kts >= 0 The wind speed in knots.

In the communications window it seems like it is writing to /sim/weather/wind_speed_kt (which is not the same and NOT writable) and the value is not changing.

In other words it seems to be ignoring the braces..

in setup I am defining it as

windSpeed = XPlaneRef("sim/weather/wind_speed_kt[0]");

A couple of notes.......

I can change the sim/weather/wind_speed_kt[0] value in the dataref editor and get the desired effect.

I have modifed a different dataref (via the teensy to test communications) "/sim/weather/visibility_reported_m" and get the desired affect.

It seems to be ignoring the [0] in the teensy to pc communications

any ideas?
 
You could dig into the Teensy-side USB code and the X-plane side plugin code, if you *really* want to investigate this. But since it's worked on other uses for arrays, that will probably prove fruitless.

First, I'd try to find some other array variable to access, just to test if Teensy & the plugin really are working (they probably are... none of this stuff has changed for a very long time).

If you can get it to write to other array-based datarefs, then probably best to start asking on xplane forums about this particular dataref. It may simply be ignoring or overwriting your changes. But that's really a question for whoever knows the code publishing the dataref. Their first questions is likely to be whether Teensy really works, so best to confirm that with another array dataref first.
 
Thanks for the reply Paul

The communication is definitely working with other datarefs, I will try some other array based datarefs this weekend to see what happens.

Thanks
 
You could dig into the Teensy-side USB code and the X-plane side plugin code, if you *really* want to investigate this. But since it's worked on other uses for arrays, that will probably prove fruitless.

First, I'd try to find some other array variable to access, just to test if Teensy & the plugin really are working (they probably are... none of this stuff has changed for a very long time).

If you can get it to write to other array-based datarefs, then probably best to start asking on xplane forums about this particular dataref. It may simply be ignoring or overwriting your changes. But that's really a question for whoever knows the code publishing the dataref. Their first questions is likely to be whether Teensy really works, so best to confirm that with another array dataref first.


Still trying to work this out...

From what I have learned "sim/weather/wind_speed_kt[0]" and "sim/weather/wind_speed_kt[1]" ARE NOT actual array variables, but are just poorly named regular variables..

I think teensy is trying to treat them like arrays (as I would) and that is why it doesn't work.

Question? if there a way to force a write from the teensy, akin to using a "print" statement that contains all the data xplane expects to modify a dataref, for example "sim/weather/wind_speed_kt[1]=10" (not using variable)

It would make the coding on the teensy more complicated, but might work if it's not filtered out by the x-plane side plugin.
 
UPDATE!!


Got it working!!

The solution was to add a second array value to the dataref "sim/weather/wind_speed_kt[0]" should be written as "sim/weather/wind_speed_kt[0][0]"

I'm guessing the plug-in strips out the one of the [0]'s and leave the other one untouched!!

works like a charm now!!


 
Status
Not open for further replies.
Back
Top