Skip to content

Commit

Permalink
Allow BDS 50 roll angle up to 50 degrees
Browse files Browse the repository at this point in the history
Other libraries use a similar value. This reduces number of undecodable message, but it will increase false positives in multi matches.
  • Loading branch information
Douglasdc3 committed Oct 10, 2022
1 parent 88c1c56 commit 68d6bc1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/aero/t2s/modes/decoder/df/bds/Bds50.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public Bds50(short[] data) {
return;
}
if (statusRollAngle) {
if (Math.abs(rollAngle) > 32) {
if (Math.abs(rollAngle) > 50) {
invalidate();
rollAngle = 0;
return;
Expand Down
26 changes: 26 additions & 0 deletions src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,32 @@ public void test_df21_bds60_406ECD() throws UnknownDownlinkFormatException {
assertEquals(104.7, bds.getMagneticHeading(), 0.1);
}


@Test
public void test_df21_bds50_406ECD() throws UnknownDownlinkFormatException {
DownlinkFormat df = testMessage("A0000333E17987192250004423EC");

assertInstanceOf(DF20.class, df);
DF20 df20 = (DF20) df;
assertEquals("44CD73", df.getIcao()); // Military / corrupt transponder
assertEquals(4275, df20.getAltitude().getAltitude());

assertTrue(df20.isValid());
assertInstanceOf(Bds50.class, df20.getBds());

Bds50 bds = (Bds50) df20.getBds();
assertTrue(bds.isStatusGs());
assertEquals(200, bds.getGs(), 0.1);
assertFalse(bds.isStatusTas());
assertEquals(0, bds.getTas(), 0.1);
assertTrue(bds.isStatusRollAngle());
assertEquals(-43, bds.getRollAngle(), 0.1);
assertTrue(bds.isStatusTrueAngleRate());
assertEquals(2.3, bds.getTrackAngleRate(), 0.1);
assertTrue(bds.isStatusTrackAngle());
assertEquals(214.2, bds.getTrueTrack(), 0.1);
}

private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException {
Decoder decoder = new Decoder(new HashMap<>(), 50, 2, ModeSDatabase.createDatabase());

Expand Down

0 comments on commit 68d6bc1

Please sign in to comment.