[hamradio-commits] [dump1090] 156/389: Update ModeA/C to ModeS

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Wed Nov 5 00:19:50 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 d0469061fffbc679b9d16cb00a846b924a6ebb90
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Sat May 11 15:02:34 2013 +0100

    Update ModeA/C to ModeS
    
    Update the ModeA/C to Mode S comparison routine to use bFlags.
---
 dump1090.c | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/dump1090.c b/dump1090.c
index 67db2da..fe11be4 100644
--- a/dump1090.c
+++ b/dump1090.c
@@ -2344,27 +2344,33 @@ void interactiveUpdateAircraftModeA(struct aircraft *a) {
     while(b) {
         if ((b->modeACflags & MODEAC_MSG_FLAG) == 0) {// skip any fudged ICAO records 
 
-            // First check for Mode-A <=> Mode-S Squawk matches
-            if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk
-                b->modeAcount   = a->messages;
-                b->modeACflags |= MODEAC_MSG_MODEA_HIT;
-                a->modeACflags |= MODEAC_MSG_MODEA_HIT;
-                if ( (b->modeAcount > 0) && 
-                   ( (b->modeCcount > 1) 
-                  || (a->modeACflags & MODEAC_MSG_MODEA_ONLY)) ) // Allow Mode-A only matches if this Mode-A is invalid Mode-C
-                    {a->modeACflags |= MODEAC_MSG_MODES_HIT;}    // flag this ModeA/C probably belongs to a known Mode S                    
+            // If both (a) and (b) have valid squawks...
+            if ((a->bFlags & b->bFlags) & MODES_ACFLAGS_SQUAWK_VALID) {
+                // ...check for Mode-A == Mode-S Squawk matches
+                if (a->modeA == b->modeA) { // If a 'real' Mode-S ICAO exists using this Mode-A Squawk
+                    b->modeAcount   = a->messages;
+                    b->modeACflags |= MODEAC_MSG_MODEA_HIT;
+                    a->modeACflags |= MODEAC_MSG_MODEA_HIT;
+                    if ( (b->modeAcount > 0) && 
+                       ( (b->modeCcount > 1) 
+                      || (a->modeACflags & MODEAC_MSG_MODEA_ONLY)) ) // Allow Mode-A only matches if this Mode-A is invalid Mode-C
+                        {a->modeACflags |= MODEAC_MSG_MODES_HIT;}    // flag this ModeA/C probably belongs to a known Mode S                    
+                }
             } 
 
-            // Next check for Mode-C <=> Mode-S Altitude matches
-            if (  (a->modeC     == b->modeC    )     // If a 'real' Mode-S ICAO exists at this Mode-C Altitude
-               || (a->modeC     == b->modeC + 1)     //          or this Mode-C - 100 ft
-               || (a->modeC + 1 == b->modeC    ) ) { //          or this Mode-C + 100 ft
-                b->modeCcount   = a->messages;
-                b->modeACflags |= MODEAC_MSG_MODEC_HIT;
-                a->modeACflags |= MODEAC_MSG_MODEC_HIT;
-                if ( (b->modeAcount > 0) && 
-                     (b->modeCcount > 1) )
-                    {a->modeACflags |= (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD);} // flag this ModeA/C probably belongs to a known Mode S                    
+            // If both (a) and (b) have valid altitudes...
+            if ((a->bFlags & b->bFlags) & MODES_ACFLAGS_ALTITUDE_VALID) {
+                // ... check for Mode-C == Mode-S Altitude matches
+                if (  (a->modeC     == b->modeC    )     // If a 'real' Mode-S ICAO exists at this Mode-C Altitude
+                   || (a->modeC     == b->modeC + 1)     //          or this Mode-C - 100 ft
+                   || (a->modeC + 1 == b->modeC    ) ) { //          or this Mode-C + 100 ft
+                    b->modeCcount   = a->messages;
+                    b->modeACflags |= MODEAC_MSG_MODEC_HIT;
+                    a->modeACflags |= MODEAC_MSG_MODEC_HIT;
+                    if ( (b->modeAcount > 0) && 
+                         (b->modeCcount > 1) )
+                        {a->modeACflags |= (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD);} // flag this ModeA/C probably belongs to a known Mode S                    
+                }
             }
         }
         b = b->next;

-- 
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