Skip to content

Commit eed5e2c

Browse files
committed
Fixed ADS-R VelocityOverGroundMsg
Fixed method name getHeading -> getTrueTrackAngle() to align with ADS-B message. Fixed condition where vertical rate is not available.
1 parent 8f65003 commit eed5e2c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/de/serosystems/lib1090/msgs/adsr/VelocityOverGroundMsg.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ public VelocityOverGroundMsg(ExtendedSquitter squitter) throws BadFormatExceptio
110110

111111
vertical_source = (msg[4]&0x10)>0;
112112
vertical_rate_down = (msg[4]&0x08)>0;
113-
vertical_rate = (short) ((((msg[4]&0x07)<<6 | (msg[5]>>>2)&0x3F)-1)<<6);
113+
int raw_vr = ((msg[4]&0x07)<<6 | (msg[5]>>>2)&0x3F);
114+
if (raw_vr == 0) {
115+
vertical_rate_info_available = false;
116+
} else {
117+
vertical_rate = (short) ((raw_vr-1)<<6);
118+
}
114119

115120
geo_minus_baro = msg[6]&0x7F;
116121
if (geo_minus_baro == 0) geo_minus_baro_available = false;
@@ -228,7 +233,7 @@ public Integer getGeoMinusBaro() {
228233
* @return heading in decimal degrees ([0, 360]) clockwise from geographic north or null if information is not available.
229234
* The latter can also be checked with {@link #hasVelocityInfo()}.
230235
*/
231-
public Double getHeading() {
236+
public Double getTrueTrackAngle() {
232237
if (!velocity_info_available) return null;
233238
double angle = Math.toDegrees(Math.atan2(
234239
-this.getEastToWestVelocity(),

0 commit comments

Comments
 (0)