diff --git a/main/flarm.go b/main/flarm.go index 8618f7280..7c4563519 100644 --- a/main/flarm.go +++ b/main/flarm.go @@ -382,7 +382,9 @@ func processAprsData(aprsData string) { // set altitude ti.Alt = int32(data.Altitude) - ti.AltIsGNSS = true + ti.Alt = ti.Alt - int32(mySituation.GPSGeoidSep) // fix geoid sep + ti.Alt = ti.Alt - int32(mySituation.GPSAltitudeMSL) + int32(mySituation.BaroPressureAltitude) // calc traffic's baro alt + ti.AltIsGNSS = false ti.Last_alt = stratuxClock.Time // set vertical speed diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index b63f48191..d691e34c5 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -440,10 +440,10 @@ func makeOwnshipGeometricAltitudeReport() bool { } msg := make([]byte, 5) // See p.28. - msg[0] = 0x0B // Message type "Ownship Geo Alt". - alt := int16(mySituation.GPSAltitudeMSL / 5) // GPS Altitude, encoded to 16-bit int using 5-foot resolution - msg[1] = byte(alt >> 8) // Altitude. - msg[2] = byte(alt & 0x00FF) // Altitude. + msg[0] = 0x0B // Message type "Ownship Geo Alt". + alt := int16(mySituation.GPSHeightAboveEllipsoid / 5) // GPS Altitude, encoded to 16-bit int using 5-foot resolution + msg[1] = byte(alt >> 8) // Altitude. + msg[2] = byte(alt & 0x00FF) // Altitude. //TODO: "Figure of Merit". 0x7FFF "Not available". msg[3] = 0x00 @@ -671,7 +671,7 @@ func makeFFIDMessage() []byte { } copy(msg[19:], devLongName) - msg[38] = 0x01 // Capabilities mask. MSL altitude for Ownship Geometric report. + msg[38] = 0x00 // Capabilities mask. Altitude above the WGS84 ellipsoid for Ownship Geometric report. return prepareMessage(msg) }