MobiFlight-Connector icon indicating copy to clipboard operation
MobiFlight-Connector copied to clipboard

Output driven analog input to Xplane can't handle float

Open JaimeLeon2 opened this issue 1 year ago • 5 comments
trafficstars

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:

  1. Interpolation input 321 maps to 0 input 791 maps to 100
  2. 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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. 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

JaimeLeon2 avatar Jan 07 '24 15:01 JaimeLeon2

If add /100 to a dataref value in Display section of output settings, value sent to x-plane correctly

mraliec avatar Jan 07 '24 21:01 mraliec

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 avatar Jan 11 '24 16:01 JaimeLeon2

@JaimeLeon2 can you try:

$f/100

and remember: the current value comes from @ for input actions, also if they are used in output configs.

DocMoebiuz avatar Feb 02 '24 08:02 DocMoebiuz

@JaimeLeon2 can you try:

$f/100

and 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. image

JaimeLeon2 avatar Aug 10 '24 01:08 JaimeLeon2

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 image

JaimeLeon2 avatar Aug 10 '24 01:08 JaimeLeon2

relates to #1832

DocMoebiuz avatar Sep 03 '25 11:09 DocMoebiuz