Jump to content

Turn co-ordinators backwards?


Mark Hurst

Recommended Posts

I have edited the code. Although I'm not really sure if the ball swings too far, or not. It's difficult to align it with P3D. The ball in the B58 tends to roll to one side and then slowly roll back, even if the side slip is still present. You'll see in the code that the sideslip gets multiplied with -1 for FSX, when you change this -1, you'll notice that the side slip indication will change. If you want to, you can tweak it a bit. Please let me know if you did, and what the outcome was, then I can update the instruments in the 'store'.

Thanks!

Link to comment
Share on other sites

Hi Ralph. Ah, I figured out where the code is (logic.lua - I hope I am looking at the right thing). I tried multiplying the slip x value by -1 as you suggest (this is in the C152 gauge) and it works. I can't comment on the nuances of the action, at the moment I'm just running everything on my hoplessly-not-setup-for-FSX desktop PC!

 

I like that that you can edit the gauge code in a Lua file but I will need to read about how this connects to FSX and how the code knows whether it is being called from FSX or X-plane.

MarkH

 

C0TtlQd.jpg

Link to comment
Share on other sites

Did you access the logic.lua from the Create/Edit tab?

 

I'll try to explain how it works with some code snippets:

function new_ball_deflection(slip)
slip = var_cap(slip, -7.1, 7.1)
slip_rad = math.rad(slip * 2.6)

x = (0 * math.cos(slip_rad)) - (292 * math.sin(slip_rad))
y = (0 * math.sin(slip_rad)) + (292 * math.cos(slip_rad))

   img_move(img_ball, x + 220,y + 28,nil,nil)
end

This is the code for moving the ball, which was originally designed for X-Plane. It's quite some code because the ball is just the ball, but it moves in a slight circular path, so that's why all the sinus and co-sinus stuff is necessary.

X-Plane data is directly send to this function with this dataref:

 

xpl_dataref_subscribe("sim/cockpit2/gauges/indicators/slip_deg", "FLOAT", new_ball_deflection)

 

For FSX and P3D the data is the direct opposite from X-Plane data, so you will need to multiply it with -1. For FSX and P3D the function to convert the data looks like this:

function new_ball_deflection_FSX(slip)

new_ball_deflection(slip * -1)

end

This data is then send to the X-Plane function (which we discussed above) by calling that X-Plane function in this FSX / P3D function. I hope you still get it :)

 

The FSX / P3D data comes from this variable, X-Plane calls them datarefs, FSX / P3D call them variables:

fsx_variable_subscribe("INCIDENCE BETA", "Degrees", new_ball_deflection_FSX)

The data from this FSX / P3D variable is send to the FSX function, and from the FSX function to the X-Plane function.

 

 

The instruments just shows whatever data it receives, if it comes from X-Plane or FSX / P3D doesn't matter. As you probably saw in Air Manager, you have to select which simulator software you are running. This was added because some instruments did this:

 

X-Plane running: data from X-Plane, lets say '50'

FSX not running: no data from FSX so '0'

Instrument: Last data received '0', so displays '0'

 

To prevent this, we had to add the simulator software selection.

 

It probably all sounds difficult, but I have no programming background and I generally don't have problems creating instruments. You'll get used to it :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...