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

    Negative Vertical Speed 030C offset

    You've declared the offset as an unsigned integer. That's why you are not getting negative values. private Offset<uint> verticalspeed = new Offset<uint>(0x02C8); My code again: private Offset<int> verticalSpeed = new Offset<int>(0x02C8); // 4-byte offset - Signed integer  That will fix it. Paul
  2. Paul Henty

    Negative Vertical Speed 030C offset

    You can post in the main support forum here: https://forum.simflight.com/forum/30-fsuipc-support-pete-dowson-modules/ BUT: There would be no point if my Example Application shows the correct value. Please try that first. If that works then your code is wrong, not FSUIPC. If you post the relevant parts of your code here I can check it very quickly. I can't help much without seeing the code. Paul
  3. Paul Henty

    Negative Vertical Speed 030C offset

    The code I posted works fine with FSUIPC4. I've test both 02C8 and 030C. Are you using the code above unchanged? If not, I'll need to see your offset declaration and the code where you read, convert and display the value. You should also try running the Example Code application and going to the form called "BC003: Reading and Using Offsets" under the Basic Concepts node. If this shows large values instead of negatives then you'll need to contact Pete in the main forum as something is wrong with your FSUIPC. Paul
  4. Paul Henty

    Negative Vertical Speed 030C offset

    The code below is taken from the 'Example Code' solution. It works fine for vertical speed (02C8). You can download this from the website: http://fsuipc.paulhenty.com/#downloads private Offset<int> verticalSpeed = new Offset<int>(0x02C8); // 4-byte offset - Signed integer protected override void timerMain_Tick(object sender, EventArgs e) { // Call Process() to get the data from FSUIPC FSUIPCConnection.Process(); // -------------------- // VERTICAL SPEED // -------------------- // FSUIPC Documentation says this offset is 4 bytes, signed (int) and holds the speed as metres/second * 256 // We need to convert back to metres/second by / 256 // Offset is 'int' so cast to double for conversion. double verticalSpeedMPS = (double)this.verticalSpeed.Value / 256d; // If you want to display as feet/minute a further conversion is required: double verticalSpeedFPM = verticalSpeedMPS * 60d * 3.28084d; // Display one of these on the form (this time rounded to 0dp) // this.txtVerticalSpeed.Text = verticalSpeedMPS.ToString("F0"); this.txtVerticalSpeed.Text = verticalSpeedFPM.ToString("F0"); } 030C is a copy of this offset, but it's not updated on the ground. It should work exactly the same as 02C8. Just change the offset in the declaration. Paul
  5. Paul Henty

    Simple offset extraction to Arduino

    Hi Emerson, The chkAvionicsMaster_CheckedChanged method is for reacting to when the user ticks the checkbox on the screen. I think what you want is to react to the things changing inside the flight sim. Your code should therefore go inside the Timer_Tick(). After the Process() call you can text the current value of the master avionics switch. You can then turn your light on or off. Something like the code below: (The code is placed after the existing line to update the on-screen checkbox): I don't know what you need to send to the serial port but I assume you do... // 2. Master Avionics this.chkAvionicsMaster.Checked = avionicsMaster.Value > 0; if (serialPort1.IsOpen) { if (avionicsMaster.Value > 0) { // Master switch is ON. Send command to turn on the light serialPort1.WriteLine("1"); } else { // Master switch is OFF. Send command to turn off the light serialPort1.WriteLine("0"); } } Note that this timer runs 20 times per second. If it's a problem sending data to the serial port that often then you'll need a variable to remember the last value of the Avionics Master switch. If the current value is the same as the last then you don't need to resend the same command to the serial port. For the landing gear you need to declare the offsets to read the gear position (See Offsets 0x0BEC, 0x0BF0 and 0x0BF4). Then in the timer, check the values and determine if the gear is up, down or in transit. Then send the commands to your serial port to turn the lights on/off. Paul
  6. Paul Henty

    How to get accurate G-force? VB.NET

    You're searching through the entire list, overwriting the results for each one. So you end up with the results for the last item every time. This might work if you only have one airport in range, but if there are more it won't work. You need to do something like this: ' Find Closest Airport that doesn't start with X Dim closestAiport As FsAirport = airports.Find(Function(ap) Not ap.ICAO.StartsWith("X")) ' Test if this is the Dept or Arrival Noairportlbl.Text = "Not in any airport" If (closestAiport IsNot Nothing) Then If closestAiport.ICAO = getDeptICAO Then Noairportlbl.Text = "" GreenText1.Value = "You are at your departure location!" GreenText2.Value = 10 ElseIf closestAiport.ICAO = getArrivalICAO Then Noairportlbl.Text = "" GreenText1.Value = "You are at your destination location!" GreenText2.Value = 10 End If End If Paul
  7. Paul Henty

    How can i track number of passengers ?

    Yes you can use offsets 0x3380 and 0x32FA. See the offsets documentation for details, but in summary: Declare an offset for 3380 (string with length 128) Declare an offset for 32FA (Short) It's important they are in this order. 3380 must be declared first. Mark them both as write only and put them in their own group (e.g. SendText). When you want to write text: set the text in 3380. Set 32FA depending on how to want the text displayed (see the docs). Process the "SendText" group. Paul
  8. Paul Henty

    How to get accurate G-force? VB.NET

    Okay but the fake XWSS airport is still in index 0. If you use index 1 for other airports it won't work. That's why you need to search through the array to get the first ICAO that doesn't start with X. Paul
  9. Paul Henty

    How can i track number of passengers ?

    FSX and P3D do not simulate passengers. If you have GSX and want to track GSX passengers then I think there are L:Vars you can access. I don't have GSX so you'll need to ask in their support forums. Or they may have an SDK you can download. Paul
  10. Paul Henty

    How to get accurate G-force? VB.NET

    Is your plane at Singapore Changi airport? Do you have third-party scenery (add-on) for that airport? If 'yes' then It looks like the scenery developer has put a fake airport in. Is there anything at index 1? airports(1).ToString() If that has the correct airport then you'll need to go through each runway in the array and look for the first one that doesn't begin with an X. Paul
  11. Paul Henty

    How to get accurate G-force? VB.NET

    Yes. Just use the code in DB003_FindingAirportsInRange. Ask for airports within 5km airports.InRangeOfKilometres(5). If you get any back and the aircraft is on the ground then you can assume that the player is at that airport. Paul
  12. Paul Henty

    How to get accurate G-force? VB.NET

    Hi, This is fairly easy if you're using version 3.x of my DLL. Have a look at the Example Code application, under "Airports Database", form "DB003_FindingAirportsInRange". If you don't have the Example Code application you can download it from the website: http://fsuipc.paulhenty.com/#downloads You can amend this example easily to find if an airport close enough so that the player is 'at' the airport. For example within 5km. (And check if the player is on the ground). Paul
  13. Paul Henty

    Issue with the weather services

    Hi Ruediger, The first thing to try is to increase the timeout for weather reading. In the Sample Projects I set them to 2000ms. (See Code Below). Try increasing this to something like 10 seconds. If it works you'll be able to see how much time it takes for the weather to be read. I only have FSX. Maybe P3D takes a bit longer to provide weather to FSUIPC. Paul private void btnGetWeatherAtAirport_Click(object sender, EventArgs e) { // Using a try catch block as the service will time out if the weather station is not active // This could be because the IACO is not valid, or it is out of range and therefore inactive WeatherServices ws = FSUIPCConnection.WeatherServices; // The time out can be changed. Here it's set to 2 seconds. This is usually enough time for weather data to be returned. ws.LocationReadTimeout = 2000; // <<<<<<<<<< TRY SETTING A LONGER TIMEOUT try { FsWeather weather = ws.GetWeatherAtLocation(this.txtICAO.Text.ToUpper()); displayWeather(weather); } catch (Exception ex) { MessageBox.Show(ex.Message, "FSUIPC Examples", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
  14. It's difficult to see what's happening when I don't have the complete code. At the moment I suspect that the sim rate is being written more often than you want. You can confirm this by using the logging in FSUIPC. If you enable the logging for 'IPC Writes' and send the log to the console you will be able to see when the sim rate is being written. We can find out for sure if the sim rate is being 'spammed' (sent over and over again), or if it just gets written once when your program calls SetSimRate(). Thanks, Paul
  15. types.Add("simrate"); Does 'types' ever get cleared, or does 'simrate' ever get taken out of types? 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.