Announcement

Collapse
No announcement yet.

CompassHeading D3 Winsock API call

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
    EZSync - http://www.richmet.com/ezsync

  • #2
    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/

    Comment


    • #3
      Thanks for the info. I'll give it a go tonight.

      Ric.
      EZSync - http://www.richmet.com/ezsync

      Comment

      Working...
      X