better traffic altitude computation for flarm targets, fixes flarm altitude in web radar

pull/827/merge^2
Adrian Batzill 2019-07-16 12:35:22 +01:00
rodzic 04d62bfb62
commit 5b5859a522
2 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -106,10 +106,10 @@ func makeFlarmPFLAAString(ti TrafficInfo) (msg string, valid bool) {
//}
altf := mySituation.BaroPressureAltitude
if !isTempPressValid() { // if no pressure altitude available, use GPS altitude
if !isTempPressValid() && isGPSValid() { // if no pressure altitude available, use GPS altitude
altf = mySituation.GPSAltitudeMSL
}
if ti.AltIsGNSS {
if ti.AltIsGNSS && isGPSValid() {
// Altitude coming from OGN. We set the geoid separation to 0 in the OGN config, so OGN reports ellipsoid alt - we need to compare to that
altf = mySituation.GPSHeightAboveEllipsoid
}

Wyświetl plik

@ -389,8 +389,16 @@ func processAprsData(aprsData string) {
ti.Last_source = TRAFFIC_SOURCE_FLARM
// set altitude
ti.Alt = int32(data.Altitude)
ti.AltIsGNSS = true
// To keep the rest of the system as simple as possible, we want to work with barometric altitude everywhere.
// To do so, we use our own known geoid separation and pressure difference to compute the expected barometric altitude of the traffic.
if isGPSValid() && isTempPressValid() {
ti.Alt = int32(float32(data.Altitude) - mySituation.GPSHeightAboveEllipsoid + mySituation.BaroPressureAltitude)
} else {
ti.Alt = int32(data.Altitude)
ti.AltIsGNSS = true
}
ti.Last_alt = stratuxClock.Time
// set vertical speed