0 votes
asked by (12 points)
Hi,

Should it be possible to call the XPLMCommandOnce command multiple times within one flight loop callback?

Specifically, I'm sending commands "sim/autopilot/heading_up" and "sim/autopilot/heading_down" to change the heading.
It is connected to a rotary encoder, which can generate way more events then X-plane is running frames.
That is the reason that I'm calling the XPLMCommandOnce multiple times within one callback.

I would expect that when one "sim/autopilot/heading_up" command does about 1 degree, calling it 5 times should do 5 degrees, but it doesn't seem to be the case.

Am I doing something wrong?

Corjan

1 Answer

0 votes
answered by (22 points)
No, you can only call the XPLMCommandOnce once per flightloop. But if you have a rotary encoder you should be able to read it in a separate thread that runs faster the the flightloop and every flightloop you have the tics and the direction (plus or minus) of the encoder since the last flightloop callback. Just add the number of tics to sim/cockpit2/autopilot/heading_dial_deg_mag_pilot and you are done. This is how we do it in our A320 FCU but not just in a separate thread but a separate computer. Well, its just an Arduino connected to the network, but its very fast and it handles all the other switches, dials and leds too.

Cheers, HellG

Welcome to X-Plane Q&A, where you can ask support questions and get answers from members of the community.

This site is for X-Plane support questions only. Please search for existing answers before posting your question. Off-topic questions will be locked.

If you’re new, you’ll need to register before asking your first question.

If your question is answered, click on the check mark to select the best response.

Categories

...