Jump to content
The simFlight Network Forums

frankwas

Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    London

frankwas's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello Paul I have only started writing. Thank you so much for your input. Whatever makes it easier and more effecient is what I'm after. I will let you know if I get stuck. Thanks again F
  2. I got it!!! I had a look at the FSUIPC.cs file and noticed a function there that accepts a int32 parameter. Tested it and it worked. Thanks for the help. F
  3. Thanks for getting back so quickly. It works because it is an exact copy from the C# example in your FSUIPC SDK folder, apart from the offset and value of course. Here is the example code from the C# solution: // Set latitude result = fsuipc.FSUIPC_Write(0x0564, 4454206, ref token, ref dwResult); result = fsuipc.FSUIPC_Write(0x0560, 901120000, ref token, ref dwResult); I'm also not sure wat ref token is as I have not used it and is not required for my pusposes. All other methods work well and I'm able to extract data perfectly. That number is from this equation: (30000 / 3.28084) * 65536.0. You're right, maybe someone with C# knowledge could help. It is true in the reasoning that it could be an issues with an address, but when that value is explicitly passed as in the examples, it works because it 'converts' to a byte of 32bit length and writes the value to the correct offset. My issue is that I can't put a variable in the write function because that function can only accept a byte and a byte is too small for the value that needs to be passed.
  4. Hi All Firstly, thanks Pete for the awesome module of FSUIPC that you have written and documented so well. I am, however, stuck on something. I have been struggeling for days to get this to work but to no avail. I am trying to write the AP Altitude value into offset 07D4. From the numerous examples for C#, the values written are inserted statically. So for writing 30000, I used your provided calculations and got to the 32bit value of 599261164.8236427, rounded off to 599261165. When I put this into the write function it works like a charm and updates the AP altitude to 30000 as expected. However, I can't get it to accept a variable. What I've tried so far is to convert the double variable to a byte array and then write each of the 4 bytes seperately to each offset, i.e. alt[0] for offset 07D4, alt[1] for offset 07D5, etc. That didnt work. When I try to assign the double to a byte, it gives me an overflow error (which I expected) cause the value is way too large for a byte. How do I get around this? I would really appreciate any help on this. Here is a code snippet: double apaltset; byte temp2; byte[] temp3; apaltset = (30000 / 3.28084) * 65536.0; apaltset = Math.Round(apaltset); temp3 = BitConverter.GetBytes(apaltset); temp2 = (byte) apaltset //value too large for byte //result = fsuipc.FSUIPC_Write(0x07D4, 599261164, ref token, ref dwResult); //this works result = fsuipc.FSUIPC_Write(0x07D4, temp3, ref token, ref dwResult); //doesn't except a byte[] result = fsuipc.FSUIPC_Process(ref dwResult); Regards, Francois
  5. Hi Pete I was away for a couple of days. I will look into it and see what I can do. Thanks for the help. I will reply soon.
  6. Thanks for the help Pete I changed the code as you recommended. However, for some reason I am getting a tiny value (10^-301)? A_GroundSpeed is a real. I tested it with a double and extended. I don't know what I am doing wrong. Also, if I don't have the @ in front of the variable, it does not take it. It gives me a compiler error [Error] MainForm.pas(194): Incompatible types: 'Extended' and 'Pointer'. Thanks in advance for your help.
  7. Sorry, I was looking at the incorrect value. Here is an example for how I have been extracting and using the values. I am sure there is a much better way of doing it, but I don't know how. Read: FSUIPC_Read($02B4, 4, @groundSpeedAR, dwResult); After processing: A_GroundSpeed := (((groundSpeedAR[1] + (groundSpeedAR[2]*256) + (groundSpeedAR[3]*256*256) + (groundSpeedAR[4]*256*256*256)))); A_GroundSpeed := (A_GroundSpeed*3600/65536/1852)*3.6; This method has consistently given me accurate readings (I always check with FSInterrogate). What would be a better way to assign the byte array to the double variable? The above is of course a 4 byte array wheras the segment at 2E98 is 8 bytes. I would like to read the values that change as the AP flies. I got the 2E98 address as well as others from another post on the forum that someone asked for getting force feedback to work. I hope this makes sense. Thanks Francois
  8. Thanks for the prompt response Pete. Do I just add all these values in order to get the result then?
  9. Hi Pete and all! Just firstly want to thank you for FSUIPC!! It has opened up a whole new and exciting chapter in my life of programming and electronics! I have gotten stuck at one point. I have managed to read all the values that I wanted and converted them correctly. However, I cannot for the life of me get the correct value of any of the deflection values for elevator, aileron, etc. My difficulty is trying to convert the value to a double. It might sound elementary but I just can't get it right. I am using delphi 7. I would really appreciate your and anyone else's help on this matter. Regards, Francois
×
×
  • Create New...

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.