Jump to content
The simFlight Network Forums

Error of heading variable (&H580) VB6


Recommended Posts

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 Long

Dim 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:

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.