From 7026f1975a535bdea1fa09a2b4f4538b687d5735 Mon Sep 17 00:00:00 2001 From: cyoung Date: Thu, 31 Jan 2019 10:32:35 -0500 Subject: [PATCH] AUXSV parsing for UAT message types 1,2,5,6. Calculate GnssDiffFromBaroAlt. #721. --- main/traffic.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/main/traffic.go b/main/traffic.go index 974117bc..bb7c2205 100644 --- a/main/traffic.go +++ b/main/traffic.go @@ -687,6 +687,26 @@ func parseDownlinkReport(s string, signalLevel int) { // Dimensions of vehicle - skip. } + if msg_type == 1 || msg_type == 2 || msg_type == 5 || msg_type == 6 { + // Read AUXSV. + raw_alt := (int32(frame[29]) << 4) | ((int32(frame[30]) & 0xf0) >> 4) + if raw_alt != 0 { + alt := ((raw_alt - 1) * 25) - 1000 + if ti.AltIsGNSS { + // Current ti.Alt is GNSS. Swap it for the AUXSV alt, which is baro. + baro_alt := ti.Alt + ti.Alt = alt + alt = baro_alt + ti.AltIsGNSS = false + } + + ti.GnssDiffFromBaroAlt = alt - ti.Alt + ti.Last_GnssDiff = stratuxClock.Time + ti.Last_GnssDiffAlt = ti.Alt + + } + } + ti.Track = track ti.Speed = speed ti.Vvel = vvel