Jump to content
The simFlight Network Forums

jd

Members
  • Posts

    82
  • Joined

  • Last visited

About jd

  • Birthday 01/01/1970

Contact Methods

  • Website URL
    http://www.jdtllc.com

Profile Information

  • Location
    Atlanta, GA, USA

jd's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. do it the math this way x / 65536 / 65536 * 360
  2. you have to do some conversions here is my routine to set the plane at the proper lat/long/alt Public Function set_plane(lat As Single, lon As Single, alt As Single, hdg As Single) As Boolean Dim x As Long Dim dwresult As Long x = FTOM(CLng(alt)) Call FSUIPC_Write(&H574, 4, VarPtr(x), dwresult) x = lat * 10001750 / 90 Call FSUIPC_Write(&H564, 4, VarPtr(x), dwresult) x = lon * 65536 * 65536 / 360 Call FSUIPC_Write(&H56C, 4, VarPtr(x), dwresult) x = hdg * 65536 * 65536 / 360 Call FSUIPC_Write(&H580, 4, VarPtr(x), dwresult) Call FSUIPC_Process(dwresult)
  3. Call FSUIPC_WriteS(&H8001&, Len(fsuipckey), fsuipckey, dwResult) ' Call FSUIPC_Process(dwResult) where fsuipckey is a string containing the key (no spaces), concatenated with a null jd
  4. for the ai aircraft, that data is in the tcas tables. check the documentation for specifics jd
  5. my vb does unsigned arithmetic :-)
  6. you're probably overflowing the magvar variable i use MagVar = MagVar / 65536 * 360 what is the real magnetic variation where you're at? i'm betting that it is really -20, which will yield a number slightly higher than 360 so you will need a routine to take a heading that is larger than 360, and normalize it to a number between 0 and 359 jd
  7. Function norm360(h As Long) As Long If h > 360 Then norm360 = h - 360 ElseIf h = 0 Then norm360 = 360 ElseIf h < 0 Then norm360 = h + 360 Else norm360 = h End If End Function
  8. here is my code snippet Public Function Plane_heading() As Single ' degrees Plane's magnetic heading. Dim x As Long Dim dwResult As Long Call FSUIPC_Read(&H580, 4, VarPtr(x), dwResult) Call FSUIPC_Process(dwResult) Plane_heading = norm360((x / 65536 / 65536 * 360) - magvar) end function you may have to adjust for the magnetic variation, which is what magvar is (another function, to get the current magnetic variation) norm360 is a normalize function, which brings all heading to a range of 1-360 degrees
  9. twenty degree magnetic variation would put you within 1 degree of the number you gave me jd
  10. and what was the magnetic variation? jd
  11. what was your plane heading?
  12. i don't know what to say. this is the function i have used in radar contact since v3. it works, because i'm constantly checking the plane heading.. 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
  13. it's vb6, and the code has worked that way from v3.x through v4.x without a problem.
  14. 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
×
×
  • 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.