MattWise
-
Posts
18 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by MattWise
-
-
Is there a way to pull out the current airport and active runway for an aircraft?
-
Here is what I am doing:
Dim PHeading As Long Dim MagVar As Long Dim dwResult As Long Call FSUIPC_Read(&H580, 4, VarPtr(PHeading), dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Read(&H2A0, 2, VarPtr(MagVar), dwResult) Call FSUIPC_Process(dwResult) MagVar = MagVar * 360 / 65536 Plane_heading = PHeading Plane_heading = (Plane_heading / 65536 / 65536 * 360) - MagVar
The Plane Heading is returning .312 while at 340. The MagVar is returning 20.
If I do the final math I get -19.68761
Any ideas?
-
Did anyone get this working. I am doing this:
Call FSUIPC_WriteS(&H3380, 1, "Test", dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Write(&H32FA, 2, 1, dwResult) Call FSUIPC_Process(dwResult)
And VB is crashing on me.
-
So your telling me to drop the decimal infront of .312? If that is the case the how come AP is so close with 339.9?
-
Thanks that helped a lot. I just pulled out the decimal value that was held in the offset. Then converted the decimal to binary as YankeeFan said and it works great. Thanks!
-
When I do that, I still get a return of .312
-
YankeeFan can you give me an example of your code. I am having the same problem. If YankeeFan is no longer on the form can someone give me an example. I can't figure out how to declear the variables. I see they are a S16 int but I don't know how to declear that in VB6. Thanks.
-
Ok here is what I am doing. I am using :
Public Function Plane_heading() As Single Dim x As Long Dim dwResult As Long Call FSUIPC_Read(&H580, 4, VarPtr(x), dwResult) Call FSUIPC_Process(dwResult) Plane_heading = x / 65536 / 65536 * 360 End Function
I get a return of .312
If I do this:
Dim Vcount as long,MY_Heading as Single If FSUIPC_Read(&H580, 4, VarPtr(Vcount), dwResult) Then If FSUIPC_Process(dwResult) Then MY_HEADING = CSng(Vcount * 360#) / (65536# * 65536#) End If End If Text1.Text = MY_HEADING
I get .312 my plane gyro compass is reading 340 whiskey is reading 340
But if I get the Auto Pilot heading I am doing this:
Dim APHeading As Long Dim Convert As Single Call FSUIPC_Read(&H7CC, 4, VarPtr(APHeading), dwResult) Call FSUIPC_Process(dwResult) Convert = (APHeading * 360) / 65536 Me.Caption = Convert
I get a return of 339.9 I can round. Thats not big deal.
Can someone help me with the plane heading.
-
LukeK I did what you suggested and it didn't work either. I still got .312
Any ideas?
-
I wasn't aware that I had to get the magnetic variation
-
-
JD when I do this
Public Function Plane_heading() As Single Dim X As Long Dim dwResult As Long Call FSUIPC_Read(&H580, 4, VarPtr(X), dwResult) Call FSUIPC_Process(dwResult) Plane_heading = X / 65536 / 65536 * 360 Form1.Caption = Plane_heading End Function
I get .312 any ideas?
-
If I do what you suggest jd I get 0.3125862
-
The # in VB just like writing 360.0
Now if I go with your example
Heading = ((Heading / 65536) * 360.0) / 65536
It just returns a number that I simple can not work with. i.e. 4.94065645841247E-323
I am sure that some out there has done this in VB...
-
If I do this:
Dim Heading As Double Call FSUIPC_Read(&H580, 4, VarPtr(Heading), dwResult) Call FSUIPC_Process(dwResult) Heading = ((Heading / 65536) * 360#) / 65536 Form1.Caption = Heading
It returns 0
If I do this:
Dim x As Long Dim dwResult As Long Call FSUIPC_Read(&H580, 4, VarPtr(x), dwResult) Call FSUIPC_Process(dwResult) Plane_heading = x / 65536 / 65536 * 360
It returns 0
I've have been writing in VB for 5 years now, so this type of math is not new to me. But I just can not figure out what I am doing wrong.
-
I am looking at the documentation. I am reading in the correct offset.
Dim Heading As Long Call FSUIPC_Read(&H580, 4, VarPtr(Heading), dwResult) Call FSUIPC_Process(dwResult) Heading = Heading *360 / (65536*65536) Form1.Caption = Heading
When I do this all I get are overflow errors. I have also tried declearing Heading as Currency which doesn't work either.
-
Does anyone have code to return the heading of an aircraft. I have been digging threw this forum with no luck at all.
Thanks,
Matt
Offset 32FA
in FSUIPC Support Pete Dowson Modules
Posted
I am using the FSUIPC DLL and VB.NET to display messages in Flight Sim. I can get the message to display fine, but it stays there. I am writing data to offset 32FA, but the message still says there. Here is my code:
Any ideas to why it is doing this?