From 0068db5a51488ce4d99c40f36c068caf00a61888 Mon Sep 17 00:00:00 2001 From: MUSTARDTIGER FPV <122312693+MUSTARDTIGERFPV@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:46:53 -0800 Subject: [PATCH] Improve/Fix SBS-1 ADS-B Parsing (#3218) * Fix ADSB: heading, speed & callsign, fix unit conv * Add Squawk codes to SBS-1 decode --- ExtLibs/Utilities/adsb.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ExtLibs/Utilities/adsb.cs b/ExtLibs/Utilities/adsb.cs index b672bd19e1..9b48d8264c 100644 --- a/ExtLibs/Utilities/adsb.cs +++ b/ExtLibs/Utilities/adsb.cs @@ -812,6 +812,13 @@ public static void ReadMessage(Stream st1) } catch { } + ushort squawk = 0; + try + { + squawk = ushort.Parse(strArray[17]); // Squawk transponder code + } + catch { } + bool is_on_ground = strArray[21] != "0";//Boolean. Flag to indicate ground squat switch is active. if (Planes[hex_ident] == null) @@ -823,7 +830,15 @@ public static void ReadMessage(Stream st1) continue; if (UpdatePlanePosition != null && plane != null) - UpdatePlanePosition(null, new PointLatLngAltHdg(lat, lon, altitude / 3.048, (float)plane.heading, -1 , hex_ident, DateTime.Now)); + { + double METERS_PER_FOOT = 3.28; + PointLatLngAltHdg plln = new PointLatLngAltHdg(lat, lon, altitude / METERS_PER_FOOT, (float)plane.heading, plane.ground_speed, hex_ident, DateTime.Now) + { + CallSign = plane.CallSign, + Squawk = squawk + }; + UpdatePlanePosition(null, plln); + } } else if (strArray[1] == "4") {