MobiFlight-Connector
MobiFlight-Connector copied to clipboard
Output driven analog input to Xplane can't handle float
Describe the bug Reported by a user in the forum
Hi! I'm newbie to Mobiflight, please explane what i'm doing wrong, or maybe i've found a bug? )
My test setup Inputs: analog input (range 321-791) action type variable (MyVar), value @ Outputs: Mobiflight Variable( Type=Number, Name=MyVar) Modifiers:
- Interpolation input 321 maps to 0 input 791 maps to 100
- Tranformation
expression:
$/100 (Also tried $*0.01)Display: Type=Input Action OnChange Action type: X-Plane Dataref = sim/cockpit2/engine/actuators/throttle_ratio_all Value=@
Test setting works well - input value 450 gives result 0.28 also "output Value" column shows correct value but x-plane throttle stay idle until value reached 1.00, then throttle goes to max.
To debug packets sent to x-plane i run WireShark, and: in UDP packet DREF contains Value: 0 if transform is disabled - value sent to X-plane is correct (same as Output shows) p.s. tested also with latest beta release (10.0.2.2)
Steps To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior Analog input to Xplane can send float values
Actual behavior Float range between 0 and 1 is sent as 0.
Details
- MobiFlight Version: 10.0.2.2
- FlightSim: [e.g. MSFS2020]
- AddOn: [e.g. Default Aircraft]
Additional context None
If add /100 to a dataref value in Display section of output settings, value sent to x-plane correctly
I have now found the same bug with MSFS2020 Fenix A320. So the bug is not sim specific. If I send into the RPN input action an integer and divide by 100 in the RPN statement, then it works. Sending a calibrated float value does not work.
@JaimeLeon2 can you try:
$f/100
and remember: the current value comes from @ for input actions, also if they are used in output configs.
@JaimeLeon2 can you try:
$f/100and remember: the current value comes from @ for input actions, also if they are used in output configs.
I tried $f/100. That results in ncalc error.
The $/100 results in a float correctly.
The issue is in transferring this value into the @ placeholder in the display tab.
Mobiflight only writes an integer value there.
Workaround is to skip the transform and put the division in the RPN statement like
relates to #1832