Skip to content

Commit f87ebbd

Browse files
committed
Do not check turn angle when aircraft is not turning
1 parent 5fea2a4 commit f87ebbd

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/main/java/aero/t2s/modes/decoder/df/bds/Bds50.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public Bds50(short[] data) {
208208
// Formula from SkyBrary TurnRate (1) = (TAS / 10) => Roll Angle
209209
// Which we can rewrite to Roll Angle * 10 * Turn Rate = TAS
210210
// When TAS is not known we can use GS instead allow for bigger margin
211-
if (statusTrackAngle && statusRollAngle) {
211+
if (statusTrackAngle && statusRollAngle && trackAngleRate != 0) {
212212
double expectedTAS = Math.abs(rollAngle * 10d * (trackAngleRate / 3d));
213213
if (statusTas) {
214214
if (Math.abs(expectedTAS - tas) > 50) {

src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,30 @@ public void test_df21_bds40_4CA6F8() throws UnknownDownlinkFormatException {
264264
assertFalse(bds.isAutopilotAltitudeHold());
265265
}
266266

267+
@Test
268+
public void test_df21_bds50_485209() throws UnknownDownlinkFormatException {
269+
DownlinkFormat df = testMessage("A000093BFFF16B276004997B748F");
270+
271+
assertInstanceOf(DF20.class, df);
272+
DF20 df20 = (DF20) df;
273+
assertEquals("485209", df.getIcao()); // Military / corrupt transponder
274+
assertEquals(14075, df20.getAltitude().getAltitude());
275+
276+
assertTrue(df20.isValid());
277+
assertInstanceOf(Bds50.class, df20.getBds());
278+
279+
Bds50 bds = (Bds50) df20.getBds();
280+
assertTrue(bds.isStatusGs());
281+
assertEquals(314, bds.getGs(), 0.1);
282+
assertTrue(bds.isStatusTas());
283+
assertEquals(306, bds.getTas(), 0.1);
284+
assertTrue(bds.isStatusRollAngle());
285+
assertEquals(-0.1, bds.getRollAngle(), 0.1);
286+
assertTrue(bds.isStatusTrueAngleRate());
287+
assertEquals(0, bds.getTrackAngleRate(), 0.1);
288+
assertTrue(bds.isStatusTrackAngle());
289+
assertEquals(31.8, bds.getTrueTrack(), 0.1);
290+
}
267291

268292

269293
private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException {

0 commit comments

Comments
 (0)