Skip to content

Commit

Permalink
ADSB AVR Callsign and Ground Speed
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBorensteinNOAA authored and meee1 committed Sep 12, 2023
1 parent 6d32dae commit 65cf830
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ExtLibs/Utilities/adsb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;


namespace MissionPlanner.Utilities
{
public class adsb
Expand Down Expand Up @@ -760,19 +761,21 @@ public static void ReadMessage(Stream st1)
{
PointLatLngAltHdg plla = new PointLatLngAltHdg(plane.plla());
plla.Heading = (float)plane.heading;
if (plane.CallSign != null) plla.CallSign = plane.CallSign;
plla.Speed = (float)plane.ground_speed;
if (plla.Lat == 0 && plla.Lng == 0)
continue;
if (UpdatePlanePosition != null && plla != null)
UpdatePlanePosition(null, plla);
//Console.WriteLine(plane.pllalocal(plane.llaeven));
Console.WriteLine(plane.ID + " " + plla);
Console.WriteLine("AVR ADSB: " + plane.ID + " " + plla + " CS: " + plla.CallSign);
}
}
}
else if ((by == 'M' || by == 'S' || by == 'A' || by == 'I' || by == 'C') && !binary) // msg clk sta air id sel
{
string line = ((char)by) +ReadLine(st1);

//Console.WriteLine("ADSB: " + line);
if (line.StartsWith("MSG"))
{
string[] strArray = line.Split(new char[] { ',' });
Expand Down Expand Up @@ -1068,6 +1071,9 @@ public static Plane ReadMessage(string avrline)
}

adsbmess.Ident = builder.ToString();

((Plane)Planes[adsbmess.AA.ToString("X5")]).CallSign = adsbmess.Ident;

//Console.WriteLine("Ident " + builder.ToString());
}
else if (adsbmess.DF == 17 && adsbmess.TypeCode == 0x13) // velocity
Expand Down Expand Up @@ -1105,10 +1111,12 @@ public static Plane ReadMessage(string avrline)
nsvel *= -1;

double cog = (Math.Atan2(ewvel, nsvel) * (180 / Math.PI));
double _gs = Math.Sqrt(ewvel * ewvel + nsvel * nsvel) ;

Console.WriteLine("vel " + ewvel + " " + nsvel + " " + cog);
Console.WriteLine("vel " + ewvel + " " + nsvel + " " + cog + " gs " + _gs);

((Plane)Planes[adsbmess.AA.ToString("X5")]).heading = (cog + 360) % 360;
((Plane)Planes[adsbmess.AA.ToString("X5")]).ground_speed = (int) _gs;

break;
}
Expand Down

0 comments on commit 65cf830

Please sign in to comment.