Results 1 to 3 of 3

Thread: CompassHeading D3 Winsock API call

  1. #1
    Variable Bitrate
    Join Date
    Jan 2005
    Location
    UK
    Posts
    265

    CompassHeading D3 Winsock API call

    When I call D3Request|CompassHeading using Ninja's D3 winsock API I always get a zero value back for the heading. Can anyone tell me why?

    Thanks,
    Ric.

  2. #2
    Map Monkey Creator Ninja Monkey's Avatar
    Join Date
    Aug 2003
    Location
    Warrington, UK
    Posts
    1,012
    Yep, that's not right

    For now you can retrieve it yourself by getting the latest RMC data (GetNMEA|RMC) and using this code

    Code:
    Private Function GetBearing(strRMC) As Double
    
    Dim sArray() As String
    
    Dim RMC_CMG       ' Course Made Good, True
    Dim RMC_MagVarNo  ' Magnetic variation
    Dim RMC_MagVarDir ' Magnetic directon
    Dim RMC_Bearing
    
    If InStr(1, strRMC, "$GPRMC") Then
        sArray = Split(Mid(strRMC, InStr(1, strRMC, "$GPRMC"), InStr(1, strRMC, vbCr)), ",")
        If UBound(sArray) >= 11 Then
            RMC_CMG = sArray(8)
            RMC_MagVarNo = sArray(10)
            RMC_MagVarDir = Left(sArray(11), 1)
    
            If RMC_MagVarDir = "E" Then
                RMC_Bearing = RMC_CMG - RMC_MagVarNo
                If RMC_Bearing < 0 Then RMC_Bearing = RMC_Bearing + 360
            ElseIf RMC_MagVarDir = "W" Then
                RMC_Bearing = RMC_CMG + RMC_MagVarNo
                If RMC_Bearing >= 360 Then RMC_Bearing = RMC_Bearing - 360
            Else
                RMC_Bearing = RMC_CMG
            End If
        End If
    End If
    
    GetBearing = Round(RMC_Bearing, 0)
    
    End Function
    Destinator 3 For PC! - http://www.map-monkey.co.uk/

  3. #3
    Variable Bitrate
    Join Date
    Jan 2005
    Location
    UK
    Posts
    265
    Thanks for the info. I'll give it a go tonight.

    Ric.

Similar Threads

  1. BASIC Stamp question
    By Banderon in forum General Hardware Discussion
    Replies: 18
    Last Post: 05-07-2004, 09:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •