Skip to content

Commit

Permalink
Use GPS altitude in Ownship when pressure altitude not available.
Browse files Browse the repository at this point in the history
Temporary.
  • Loading branch information
cyoung committed Sep 24, 2015
1 parent 84fb44f commit 3c50cd5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main/gen_gdl90.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,17 @@ func makeOwnshipReport() bool {
msg[10] = tmp[2] // Longitude.

// This is **PRESSURE ALTITUDE**
alt := uint16(0xFFF) // 0xFFF "invalid altitude."
//FIXME: Temporarily removing "invalid altitude" when pressure altitude not available - using GPS altitude instead.
// alt := uint16(0xFFF) // 0xFFF "invalid altitude."

var alt uint16
if isTempPressValid() {
alt = uint16(mySituation.pressure_alt)
alt = (alt + 1000) / 25
} else {
alt = uint16(mySituation.alt) //FIXME: This should not be here.
}
alt = (alt + 1000) / 25

alt = alt & 0xFFF // Should fit in 12 bits.

msg[11] = byte((alt & 0xFF0) >> 4) // Altitude.
Expand Down

0 comments on commit 3c50cd5

Please sign in to comment.