Mark Hurst Posted December 7, 2014 Share Posted December 7, 2014 I notice that both version of the turn co-ordinator seem to work backwards. (That's the C152 and the generic one.) Anyone else out there notice this? MarkH Link to comment Share on other sites More sharing options...
LNRalph Posted December 7, 2014 Share Posted December 7, 2014 Hi Mark, I'll have a look tomorrow. Maybe I didn't do the conversion for FSX and P3D right. Link to comment Share on other sites More sharing options...
LNRalph Posted December 8, 2014 Share Posted December 8, 2014 Seems alright? http://i1013.photobucket.com/albums/af251/AirRietveld/turn_zps12b9f43e.png Link to comment Share on other sites More sharing options...
Mark Hurst Posted December 8, 2014 Author Share Posted December 8, 2014 Can you check what the ball does - for me it works backwards. Sorry for not being specific enough. MarkH Link to comment Share on other sites More sharing options...
LNRalph Posted December 8, 2014 Share Posted December 8, 2014 Ah yes, the trim ball could be working backwards. I'll edit the code, and upload the edited version this week together with some other instruments. Thanks for noticing! Link to comment Share on other sites More sharing options...
LNRalph Posted December 8, 2014 Share Posted December 8, 2014 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 More sharing options...
Mark Hurst Posted December 8, 2014 Author Share Posted December 8, 2014 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 Link to comment Share on other sites More sharing options...
LNRalph Posted December 9, 2014 Share Posted December 9, 2014 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 More sharing options...
Mark Hurst Posted December 9, 2014 Author Share Posted December 9, 2014 fsx_variable_subscribe("INCIDENCE BETA", "Degrees", new_ball_deflection_FSX) Ah yes, now I see how it works. It looks like a great way to do it and it is giving me all kinds of ideas. Can you invoke other programs from the Lua code? MarkH Link to comment Share on other sites More sharing options...
LNRalph Posted December 10, 2014 Share Posted December 10, 2014 You can invoke FSX and P3D data, which in it's turn invokes other software. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.