Skip to content

Commit

Permalink
Merge pull request #46 from terminal2/improve-bds-60-decoding-irs-bar…
Browse files Browse the repository at this point in the history
…o-diff

Allow greater diff between baro and IRS ROCD
  • Loading branch information
Douglasdc3 committed Oct 9, 2022
2 parents 05a1e9b + 08a42c8 commit ec3d0c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/aero/t2s/modes/decoder/df/bds/Bds60.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public Bds60(short[] data) {
}

if (statusBaroRocd && statusIrsRocd) {
if (Math.abs(irsRocd - baroRocd) > 700) {
if (Math.abs(irsRocd - baroRocd) > 1500) {
invalidate();
return;
}
Expand Down
31 changes: 29 additions & 2 deletions src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public void test_bds60() throws UnknownDownlinkFormatException {
}

@Test
public void test() throws UnknownDownlinkFormatException {
// DownlinkFormat df = testMessage("5D4CA64");
public void test_df_20_bds_40_a48e35() throws UnknownDownlinkFormatException {
DownlinkFormat df = testMessage("A00006A1E3A71D30AA014672C8DF");

assertInstanceOf(DF20.class, df);
Expand All @@ -66,6 +65,34 @@ public void test() throws UnknownDownlinkFormatException {
assertTrue(bds.isAutopilotAltitudeHold());
}


@Test
public void test_df20_bds60_800736() throws UnknownDownlinkFormatException {
DownlinkFormat df = testMessage("A0001A1FA439F534BF07FFDE1ECC");

assertInstanceOf(DF20.class, df);
DF20 df20 = (DF20) df;
assertEquals("A48E35", df.getIcao());
assertEquals(51000, df20.getAltitude().getAltitude());

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

Bds40 bds = (Bds40) df20.getBds();
assertTrue(bds.isStatusTargetSource());
assertEquals(SelectedAltitudeSource.MCP, bds.getSelectedAltitudeSource());
assertTrue(bds.isStatusMcp());
assertEquals(51008, bds.getSelectedAltitude());
assertTrue(bds.isStatusFms());
assertEquals(51008, bds.getFmsAltitude());
assertTrue(bds.isStatusBaro());
assertEquals(1013.3, bds.getBaro(), 0.1);
assertTrue(bds.isStatusMcpMode());
assertFalse(bds.isAutopilotApproach());
assertFalse(bds.isAutopilotVnav());
assertTrue(bds.isAutopilotAltitudeHold());
}

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

Expand Down

0 comments on commit ec3d0c1

Please sign in to comment.