Jump to content
The simFlight Network Forums

Paul Henty

  • Content Count

  • Joined

  • Last visited

  • Days Won


Paul Henty last won the day on November 14 2018

Paul Henty had the most liked content!

Community Reputation

49 Excellent


About Paul Henty

  • Rank
    Advanced Member
  • Birthday 01/01/1970

Profile Information

  • Gender
  • Location
    Gloucestershire, UK

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Paul Henty


    Hi Ruediger, Your code works okay for me. Make sure you've got the latest DLL (3.1.11). Does it work using different airports in the hashset? or does it break with any? Paul
  2. Paul Henty

    Payload services query

    Hi Gerard, Version 3.1.11 is now available. This fixes the rounding problems in the payload services for Kgs. In my testing it's much better. On the Cessna 172, changing between 100% fuel and 25% fuel, the empty weight would change by ~1kg. Now it's only 0.08kg. I can't get it perfect as FSUIPC gives the fuel tank levels in volume not weight. So there is always going to be some small rounding error going from gallons to lbs. Paul
  3. Paul Henty

    Event Handler Issue

    I'm not really sure what's causing this then. I would put some messages (Debug.WriteLine) in your code to see the timing and the order in which your methods and events are being called. That might give you a clue as to what's going wrong. Generally, it sounds like UDPConnection.UDPDataReceived is being fired too quickly and FSUIPC/FSX just can't keep up with the requests to change the transponder code. Paul
  4. Paul Henty

    Payload services query

    Hi Gerard, Yes, I think I can see why. The empty weight is calculated by subtracting the total fuel and payload from the Gross Weight. All of the weight values are stored in lbs. To get kg they need converting. At the moment that conversion is done for every fuel tank and payload station. This means the small conversion errors for each tank/payload station will add up to something noticeable. I'm not sure why I did that, but in the next few days I will improve this by just converting once at the end. This should improve things. I'll let you know when a new Beta version is ready for your to test. I think this is just down to the time taken for the payload data to arrive at the sim. The DLL sends the data to FSUIPC, which then has to prepare SimConnect calls and pass the data to the sim. Once the sim receives these it has to change the active payload values. This is all going to take a bit of time, so reading the value back too soon won't be accurate. I would think it's unnecessary anyway. If you're just trying to check that your values have been written properly, then it's reasonable to add the delay to give all the steps time to complete. Paul
  5. Paul Henty

    Event Handler Issue

    Hi Robert, It's a bit difficult to tell from the code you've posted. One thing I'm not clear on is where the process() is happening. I would expect it to be in SetTransponder() after the value is set. If your process() call is elsewhere (like on a separate timer loop) then it's probably that the UDPDataReceived event is firing faster than the Process() calls. So it's going something like this: FSUIPC_TransponderCode.Value = 1 Process() FSUIPC_TransponderCode.Value = 2 FSUIPC_TransponderCode.Value = 3 FSUIPC_TransponderCode.Value = 4 Process() In that case you would only see 1 and 4 set in the sim, Do you mean the local variable (FSUIPC_TransponderCode.Value)? That will just hold a copy of whatever you've set it to locally. Or do you mean you've done a Process() call to get the current value back from FSUIPC? Paul
  6. Paul Henty


    Here's the required code in VB with your control names... Dim airports As FsAirportCollection = FSUIPCConnection.AirportsDatabase.Airports ' 1. Get the airport from the database using the ICAO code... Dim airport As FsAirport = airports(Me.txtICAO.Text.ToUpper()) ' 2, Get the selected helipad ID from the combo box Dim helipadID As String = Me.cbxHeli.Text ' 3. Try to get the helipad using the ID Dim helipad As FsHelipad = airport.Helipads(helipadID) ' 4. Make sure we got one back... If (helipad IsNot Nothing) Then ' 5. Pass this to MoveAircraft FSUIPCConnection.MoveAircraft(helipad, True) ' move aircraft To helipad And leave paused. ' Or call the helper method on the helipad... ' helipad.MoveAircraftHere(true) ' move aircraft to helipad And leave paused. End If That should work. You can use the same process with runways and gates. Paul
  7. Paul Henty


    Hi Padraig, The easiest way is to get the FsHelipad object for the required helipad. You can either call the MoveAircraftHere() method on that helipad, or pass the helipad directly to FSUIPCConnection.MoveAircraft(). How you get the FsHelipad object depends on how you've populated the combo box. If you've just filled the combo box with the text IDs then you need something like the following code: // 1. Get the airport from the database using the ICAO code... FsAirport airport = FSUIPCConnection.AirportsDatabase["EGLL"]; // 2, Get the selected helipad ID from the combo box string helipadID = this.cbxHelipads.Text; // 3. Check it exists at this airport if (airport.Helipads.Contains(helipadID) { // 4. It does, so get the FsHelipad object using the ID FsHelipad helipad = airport.Helipads[helipadID]; // 5. Pass this to MoveAircraft FSUIPCConnection.MoveAircraft(helipad, true); // move aircraft to helipad and leave paused. // OR call the helper method on the helipad... // helipad.MoveAircraftHere(true); // move aircraft to helipad and leave paused. } If you've populated the combo boxes directly with the FsHelipadCollection then you need to get the fsHelipad from the combo box. Something like this... // 1, Get the selected helipad from the combo box if (this.cbxHelipads.SelectedItem != null) { FsHelipad helipad = (FsHelipad)this.cbxHelipads.SelectedItem; // 2. Pass this to MoveAircraft FSUIPCConnection.MoveAircraft(helipad, true); // move aircraft to helipad and leave paused. // OR call the helper method on the helipad... // helipad.MoveAircraftHere(true); // move aircraft to helipad and leave paused. } If none of that helps, please show me the code that populates one of your combo boxes and I can give you the exact code. Paul
  8. Hi Frazer, Yes the change in behaviour is because of the code revision in 3.1.6 Beta. Write-only offsets now write every time, regardless of whether they have been changed or not. So it's not ideal to put them in a group with read/write offsets. I had to change this because for some offsets you need to set the same value as before. The DLL didn't see this as a change in value so the offset didn't get written the second time. There were also problems if you wanted to write a 0 as the first value. Because the initial value is 0 you couldn't write a 0 as the first value. If the pushback is starting then there must be a process() before the value is set to 3. It's writing the initial 0 value now. With 3.1.5 it wouldn't do that. There are two things you can do: 1. Make sure that group is not processed before the value 3 is set. 2. Put the pushback control in its own group and only process() it when you want pushback to start/stop. I recommend 2. With option 1 it will work but you're always going to be writing the pushback control value. While FSUIPC will probably be okay with that (it probably ignores the value if it's the same as the current pushback status) it's just a waste of a write. Paul
  9. Paul Henty

    FSUIPC Connection

    The DLL thinks the connection is still open because you're not doing any process() calls. Because of the way FSUIPC works, the DLL can only know that P3D has been closed by trying to talk to it. During a process(), if the sim is not answering then the DLL knows the 'connection' is lost. Only then will the IsOpen flag be set to false. Unless you call Process() there is no attempted communication with P3D. If you need a good starting point for an application with the automatic connection handling already written, please check out the FSUIPC application templates available on the website... http://fsuipc.paulhenty.com/#downloads Even if you don't use them as templates, you can see the best way handle the connection and main program loop by looking at the code. Paul
  10. Paul Henty

    FSUIPC Connection

    Looks like you forgot to paste the code in. Paul
  11. It would be best for you to repost your question in Pete's main support forum: https://forum.simflight.com/forum/30-fsuipc-support-pete-dowson-modules/ This is a sub-forum about using FSUIPC with .NET programming languages. Pete might not see your post here and I don't know enough about LUA to answer your question here. Paul
  12. Hi Robert, As Pete mentioned, with this old-style C# SDK you make multiple calls to Read(), then Process(), then multiple Get()s to get the values. The key is the 'token' value which is assigned during the Read() and then used to by the Get() to return the correct value. So to give you a real example... // Declare 'tokens' int tasToken; int iasToken; int verticalSpeedToken; // Declare variables to hold the incomming values int tasValue; int iasValue int verticalSpeedValue; // Variable to check is everything was okay int dwResult; // Stack all your reads first (writes can also be stacked) // Tokens will be assigned a value by the Read() method. fsuipc.FSUIPC_Read(0x02B8, 4, ref tasToken, ref dwResult); fsuipc.FSUIPC_Read(0x02BC, 4, ref iasToken, ref dwResult); fsuipc.FSUIPC_Read(0x02C8, 4, ref verticalSpeedToken, ref dwResult); // Single process will get all the stacked offsets fsuipc.FSUIPC_Process(ref dwResult); // Get the values fsuipc.FSUIPC_Get(ref tasToken, ref tasValue); fsuipc.FSUIPC_Get(ref iasToken, ref iasValue); fsuipc.FSUIPC_Get(ref verticalSpeedToken, ref verticalSpeedValue); // 'Value' variables are now filled. double tasKnots = (double)tasValue / 128d; // ... etc It's not pretty, which is why I wrote my DLL. I think the original C interface is cleaner than this. The 'Tokens' seem to be unique to the old C# and VB.NET SDKs because those languages don't have the concept of 'pointers' like C. Paul
  13. Hi Agoston, The solution depends on how A2A have coded the aircraft. If it's using the standard FS facilities then you should be able to find the info in one of the offsets. For example, if it's tuning the NAV2 radio in the background you could check the DME2 distance (0x0C33), the DME2 Lat/Lon (0x0834 & 0x0838), or maybe the VOR2 Lat/Lon (0x0858 & 0x0860). There a few other such offsets near those so have a look at the offsets list. If it's not setting the NAV2 or NAV1 radio then FSUIPC won't be able to help. In that case you'll need to ask A2A if you can get access to any of the information (e.g. Via LVARS or some other method). If you can at least get hold of the frequency you have tuned then you can query a database of NAVAIDS (with Frequency and Lat/Lon) if you can find one. Unfortunately neither FSUIPC nor my DLL can help with such a database. If you manage to get the location of the tuned NAVAID you can use FsLatLon class to calculate the distance. Paul
  14. Paul Henty

    CameraSetRelative6DOF with VB.net

    Hi Ruediger. Sample code below showing the declarations. Tested on FSX Steam Edition. ' CameraSetRelative6DOF offsets. 0x86A0 MUST be declared last Dim Camera_H As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86B4, True) ' Heading Dim Camera_B As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86B0, True) ' Bank Dim Camera_P As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86AC, True) ' Pitch Dim Camera_Z As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86A8, True) ' Z Dim Camera_Y As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86A4, True) ' Y Dim Camera_X As Offset(Of Single) = New Offset(Of Single)("SetCamera", &H86A0, True) ' X Private Sub btn6DOF_Click(sender As Object, e As EventArgs) Handles btn6DOF.Click ' Values can be set in any order ' Example: Centre Camera but look out of Left Window Camera_X.Value = 0 Camera_Y.Value = 0 Camera_Z.Value = 0 Camera_P.Value = 0 Camera_B.Value = 0 Camera_H.Value = -90.0 ' Heading -90 degrees relative to the cockpit (Left Window) FSUIPCConnection.Process("SetCamera") End Sub Paul
  15. Paul Henty

    Read L:Var

    It's the one that goes in the Sim. In the Modules folder. (Backup or rename your current one in case you need to go back). Paul

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.