Alejandro Lobo-Guerrero C Posted November 3, 2006 Report Posted November 3, 2006 Another question I program with vb6, I need to obtain the heading of the aircraft, I am using the variable 580 but I have an error as for the grades. This is the way like I obtain the data and process, I show in a Label. Dim dwresult As LongDim Heading As Long If FSUIPC_Read(&H580, 4, VarPtr(Heading), dwresult) Then If FSUIPC_Process(dwresult) Then HeadingProces = Heading * 360# / (65536# * 65536#) If Sgn(HeadingProces) > 0 Then Label1.Caption = "RUMBO: " & Round(Val(HeadingProces)) ElseIf Sgn(HeadingProces) < 0 Then Label1.Caption = "RUMBO: " & Round(Val(360 - Abs(HeadingProces))) End If Else Label1.Caption = "Processing: " & ResultText(dwresult) End If Else Label1.Caption = "Reading: " & ResultText(dwresult) End If A thousand thanks for all. :wink:
Pete Dowson Posted November 3, 2006 Report Posted November 3, 2006 I program with vb6, I need to obtain the heading of the aircraft, I am using the variable 580 but I have an error as for the grades. What error? Sorry, I don't understand what you are asking. Regards Pete
Alejandro Lobo-Guerrero C Posted November 3, 2006 Author Report Posted November 3, 2006 Pete The error is that the variable gives me information that doesn't correspond to the current direction of the airplane, if in the simulator the airplane has heading 200, in the program the variable 580 send me a heading of 240 until with more differs among the FS and the variable obtained through FSUIPC. :? Thanks, :wink:
Pete Dowson Posted November 3, 2006 Report Posted November 3, 2006 The error is that the variable gives me information that doesn't correspond to the current direction of the airplane, if in the simulator the airplane has heading 200, in the program the variable 580 send me a heading of 240 until with more differs among the FS and the variable obtained through FSUIPC. :? Are you comparing TRUE direction with MAGNETIC direction by any chance? Please take the Magnetic Variation into account. If you still think it is wrong, show more figures for comparison so I can see, but also state where you are in the world. In some places the MagVar is small, other places it is very large. Even in Seattle, for example, it is about 20 degrees. Even better, please try using FSInterrogate, part of the SDK and deliberately provided for exactly this sort of assistance. view the heading there AND the magnetic variation in offset 02A0. There's also a lot of logging and monitoring facilities in FSUIPC for you to use, to find out what you are doing wrong. Please take a look at those. Regards Pete
jd Posted November 3, 2006 Report Posted November 3, 2006 do it the math this way x / 65536 / 65536 * 360
Pete Dowson Posted November 3, 2006 Report Posted November 3, 2006 do it the math this wayx / 65536 / 65536 * 360 Why's that, John? Guess I'll never understand VB! ;-) Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now