MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
Newlands
Posts: 10
First off, I'm completely new to all this. I have 3D printed a yoke, assembled it with 2 x 10k pots, bought my first ever Arduino, connected it up and plugged it in to a Win11 box running X Plane 11. After days of experimenting I have managed at last to get it to work - but only just. The problem seems to be that the pot/arduino combination is outputting -1023 to +1-23, and X plane wants 16383, so I am getting only a tiny amount of yoke movement in the sim.
In the InputConfigWizard I have the following:
Action Type: FSUIP
Use Preset: (left blank)
Offset: 0x0BB2, Value type: Int, Size in bytes: 2, Mask: 0xFFFF (this is for the elevators, the ailerons are the same except for the offset is 0x0BB6).

And next is what I think the problem is - in the Set Value option I have just put an @, which I think means 'Just read the value from the potentiometer and stick it in the sim'.
I know I need to adjust this by a factor of around 16 (ie 16383/1023),, but I have absolutely no idea how to do this, have zero understanding of the syntax and no clue about the K codes to refer to elevators and ailerons. I think the Set Value has to account not only for the 16x factor, but also allow for a range of -16383 to +16383.

I would really appreciate some help from someone who has some experience of the syntax. In return, and assuming that a solution is possible, I can assemble a proper illustrated summary of all that I've done, from the thingiverse files through to the setup and implementation, which could be posted on here for others if they need it.

(Ref: https://github.com/MobiFlight/MobiFlight-Connector/wiki/MSFS2020-RPN-Tips-and-Tricks has been extremely useful, especially section 4, but as I said I just don't understand the syntax.)
2022-03-04 23:09
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6007
Supporter
Hi

You badly mix up 2 systems.... Thats why your struggle....

"MSFS2020 RPN Tips and Tricks" (The linked Guide at the end) is as the name said for FS2020 and it is RPN a typ of programming logic, we use within the WASM Interface where we talk to FS2020.

This is NOT the Syntax and Code we use within Mobiflight itself ( Transform and Compare) Here we use NCALC.
https://github.com/ncalc/ncalc/wiki

The Syntax is easy.... Whatever i not see the raw Values so i can not directly help!

iconNewlands:

The problem seems to be that the pot/arduino combination is outputting -1023 to +1-23, and X plane wants 16383, so I am getting only a tiny amount of yoke movement in the sim.
....
I think the Set Value has to account not only for the 16x factor, but also allow for a range of -16383 to +16383.


I hope this is a typo issue.... Value normaly should be 0-1024 .... 1-23 make no sense .... And also i never see a Poti that give -1024 to +1024 in MF.

Whatever.... All can be done with math.

if Value is 0-1024 Syntax @*16 to have 0-16383 ..... Syntax @*32-16383 to have -16383 to +16383
If Value is -1024 to + 1024 .... Syntax @*16 result in -16383 to +16383 ..... @*16+16383 give 0-32767. And @*8+8192 is 0-16383
[Last edited by pizman82, 2022-03-05 00:09]
Good Luck !
2022-03-05 00:02
Avatar
Newlands
Posts: 10
So, a couple of stupid errors along with a fundamental misunderstanding.
The 1-23 was a typo, and of course the potentiometer only reads 0 to 1023.
Of course, in practice the elevator pot actually gives an output of 13 to 1022, and the aileron pot is restricted in travel, giving an output of 210 to 786.

I’ll have a further look later this morning and see if I can improve the range of travel I get in the sim.
2022-03-05 08:52
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6007
Supporter
It is also possible to recalc those Hardware related Poti Values. ( Cheap Potis often have a Deadzone on the both ends. )

iconQuote:

Your Poti e.g. shows 13 to 1022



Again simpel Math:
At first @-13 to get a Value that starts regulary at Zero.
In case 1022-13=1009 our "Range is now a little smaller. So our @*16 would no longer work cause on the upper End there would be a dead area.

16383/1009 = 16.2379

So finally to convert your Encoder into a 0-16383 Value is (@-13)*16.2379
IMPORTANT for the Syntax:
1. Here you need the Braket... Without it would Multiply 13 with 16.2379 and subtract the result from @
2. Use a POINT "." not a Decimal in float Values within the syntax.....
Decimal is a breaker for functions like if(a,b,c) .... Numbers are 1.234
Good Luck !
2022-03-05 12:35
Avatar
Newlands
Posts: 10
That’s excellent, thank you very much. I managed to get it working much better this morning with a simple @*32-16383, (which obviously ignores the actual difference in the potentiometer range). Using the method you show above - ie doing the simple math to correct for the pot range first before writing the expression into the field in Mobiflight - makes it very understandable (especially for someone a bit challenged in this area like me!!). I will now be able to amend the code to make it fit the yoke setup more precisely.

Many thanks for all the help. I will put together a full description of the yoke assembly and all the associated hardware and post it on here in due course in case anyone else is interested.
2022-03-05 17:05
Avatar
Newlands
Posts: 10
Just for the sake of rounding off this post, the values I used successfully are as follows:
For the elevator, the potentiometer min and max figures are 13 to 1022 (cf 0 to 1023), giving a range of 1009.
For the Action Type 'FSUIPC- Offset' the entry in the Set Value field is:
(@-13)*32.47-16383

(32.47 is 2 x 16383/1009).
For the ailerons, the potentiometer range is limited to 201 min, 900 max, giving a range of 699, and a ratio of 699/16383=23.44
So the expression used in the Set Value field is:
(@-201)*46.88-16383
2022-03-05 20:52
Avatar
Newlands
Posts: 10
For anyone like me who is new to flight sims and Mobiflight, I have written up my experience of prototyping a yoke. Definitely not for all you experts out there, but it might help one or two newbies.
I originally set out to copy the Thingiverse design exactly - it used a length of pvc pipe which I couldn't match exactly so it had to be modified - I used 20mm pvc overflow pipe which is common in the UK. I also redesigned the yoke handles and changed the design to use a slide pot for the elevator control. So the finished prototype is a mix-and-match.
The 3D printer files for the original yoke were from a contributor called 'dvilardi' on Thingiverse https://www.thingiverse.com/thing:4855469
My modified 3D printer files are in a public Dropbox folder https://www.dropbox.com/home/Public/3D%20Printer%20files, along with a pdf file with info on the build and screenshots of the MF configuration (I’ve set the folder to public, but you might need a Dropbox account of your own to access the page)

EDIT - Just put the files on Google Drive - https://drive.google.com/drive/folders/1lS5mzTnpqKrZSTGrUH9V1TA2NfuFx6_S?usp=sharing - let me know if there are any problems
[Last edited by Newlands, 2022-03-08 12:24]
2022-03-07 23:27
Avatar
kjoussen
From: Hamburg, Germany
Posts: 171
iconNewlands:

I’ve set the folder to public, but you might need a Dropbox account of your own to access the page)



Could you share the files alternatively on Google-Drive ore OneDrive? There external visitors do not need an accountm the access-link itself is sufficant.

Kai
2022-03-08 10:25
Avatar
Newlands
Posts: 10
iconkjoussen:

iconNewlands:

I’ve set the folder to public, but you might need a Dropbox account of your own to access the page)



Could you share the files alternatively on Google-Drive ore OneDrive? There external visitors do not need an accountm the access-link itself is sufficant.

Kai



Done (I think!) - https://drive.google.com/drive/folders/1lS5mzTnpqKrZSTGrUH9V1TA2NfuFx6_S?usp=sharing
2022-03-08 12:23
Avatar
kjoussen
From: Hamburg, Germany
Posts: 171
2022-03-08 15:09
Avatar
Radim
Posts: 1
Hello folks,

I have maybe dumb question. What dataref are you using for yoke please?

We tried sim/joystick/yoke_pitch_ratio and it is not working well. Dataref value is changing always to 0 when there are no data from MF. For example, you have yoke pushed forward, you hold it in such position. And value and yoke.on screen is returning back. Also during pulling or pushing, in between of MF data sending, screen yoke is jumping from requested position to 0 quickly. Very small improvement could be achieved by highest analog pin sensitivity, but it is not a.solution.


Any idea how to force xplane to keep the ast received dataref value for yoke please?

Thank you in advance!
2023-05-15 23:43
icon