[hamradio-commits] [dump1090] 117/389: Change the message length decision

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Wed Nov 5 00:19:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

mernisse-guest pushed a commit to branch master
in repository dump1090.

commit 7cf79580a419021d3df6e57c48ded38789a08ff3
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Sun Apr 28 20:53:30 2013 +0100

    Change the message length decision
    
    Assume that DF0-DF15 are all short 56 bit messages
    Assume that DF16-DF31 are all long 112 bit messages
    
    This helps us error detect and error recover for bits in the first byte
---
 dump1090.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/dump1090.c b/dump1090.c
index 5d02c62..6937f13 100644
--- a/dump1090.c
+++ b/dump1090.c
@@ -1125,16 +1125,15 @@ uint32_t modesChecksum(unsigned char *msg, int bits) {
     }
     return crc; // 24 bit checksum.
 }
-
-/* Given the Downlink Format (DF) of the message, return the message length
- * in bits. */
+//
+// Given the Downlink Format (DF) of the message, return the message length in bits.
+//
+// All known DF's 16 or greater are long. All known DF's 15 or less are short. 
+// There are lots of unused codes in both category, so we can assume ICAO will stick to 
+// these rules, meaning that the most significant bit of the DF indicates the length.
+//
 int modesMessageLenByType(int type) {
-    if (type == 16 || type == 17 ||
-        type == 19 || type == 20 ||
-        type == 21)
-        return MODES_LONG_MSG_BITS;
-    else
-        return MODES_SHORT_MSG_BITS;
+    return (type & 0x10) ? MODES_LONG_MSG_BITS : MODES_SHORT_MSG_BITS ;
 }
 
 /* Try to fix single bit errors using the checksum. On success modifies

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git



More information about the pkg-hamradio-commits mailing list