[hamradio-commits] [dump1090] 265/373: Bugfix in position decoding

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Thu Oct 23 14:58:26 UTC 2014


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

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

commit 64b24ebc29b5307fd4df53c2943b46b49c282dc7
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Fri Oct 4 11:09:40 2013 +0100

    Bugfix in position decoding
    
    If the aircraft lands or takes off, the Lat/Lon valid flags are cleared.
    In the original code, this also resulted in any even/odd position
    reports in the mm record being discarded  This meant that the code would
    require an even and odd position after the change of flight status.
    
    The code had been modified so that any position report in the mm record
    is used even if there is a change of flight status. This means there
    only needs to be an even or odd after a change of FS, rather than
    requiring both even and odd. The result should be earlier decoding of
    position.
---
 interactive.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/interactive.c b/interactive.c
index 6fdb7a5..b2ce05a 100644
--- a/interactive.c
+++ b/interactive.c
@@ -258,36 +258,38 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) {
     // if the Aircraft has landed or taken off since the last message, clear the even/odd CPR flags
     if ((mm->bFlags & MODES_ACFLAGS_AOG_VALID) && ((a->bFlags ^ mm->bFlags) & MODES_ACFLAGS_AOG)) {
         a->bFlags &= ~(MODES_ACFLAGS_LLBOTH_VALID | MODES_ACFLAGS_AOG);
+    } 
 
-    } else  if (   (mm->bFlags & MODES_ACFLAGS_LLEITHER_VALID) 
-              && (((mm->bFlags | a->bFlags) & MODES_ACFLAGS_LLEITHER_VALID) == MODES_ACFLAGS_LLBOTH_VALID) ) {
-        // If it's a new even/odd raw lat/lon, and we now have both even and odd,decode the CPR
-        int fflag;
+    // If we've got a new cprlat or cprlon
+    if (mm->bFlags & MODES_ACFLAGS_LLEITHER_VALID) {
 
         if (mm->bFlags & MODES_ACFLAGS_LLODD_VALID) {
-            fflag = 1;
             a->odd_cprlat  = mm->raw_latitude;
             a->odd_cprlon  = mm->raw_longitude;
             a->odd_cprtime = mstime();
         } else {
-            fflag = 0;
             a->even_cprlat  = mm->raw_latitude;
             a->even_cprlon  = mm->raw_longitude;
             a->even_cprtime = mstime();
         }
-        // Try relative CPR first
-        if (decodeCPRrelative(a, fflag, (mm->bFlags & MODES_ACFLAGS_AOG))) {
-            // If it fails then try global if the two data are less than 10 seconds apart
-            if (abs((int)(a->even_cprtime - a->odd_cprtime)) <= 10000) {
-                decodeCPR(a, fflag, (mm->bFlags & MODES_ACFLAGS_AOG));
+
+        if (((mm->bFlags | a->bFlags) & MODES_ACFLAGS_LLEITHER_VALID) == MODES_ACFLAGS_LLBOTH_VALID) {
+        // If we now have both even and odd, decode the CPR
+
+            // Try relative CPR first
+            if (decodeCPRrelative(a, (mm->bFlags & MODES_ACFLAGS_LLODD_VALID), (mm->bFlags & MODES_ACFLAGS_AOG))) {
+                // If relative CPR fails then try global if the two data are less than 10 seconds apart
+                if (abs((int)(a->even_cprtime - a->odd_cprtime)) <= 10000) {
+                    decodeCPR(a, (mm->bFlags & MODES_ACFLAGS_LLODD_VALID), (mm->bFlags & MODES_ACFLAGS_AOG));
+                }
             }
-        }
 
-        //If we sucessfully decoded, back copy the results to mm so that we can print them in list output
-        if (a->bFlags & MODES_ACFLAGS_LATLON_VALID) {
-            mm->bFlags |= MODES_ACFLAGS_LATLON_VALID;
-            mm->fLat    = a->lat;
-            mm->fLon    = a->lon;
+            //If we sucessfully decoded, back copy the results to mm so that we can print them in list output
+            if (a->bFlags & MODES_ACFLAGS_LATLON_VALID) {
+                mm->bFlags |= MODES_ACFLAGS_LATLON_VALID;
+                mm->fLat    = a->lat;
+                mm->fLon    = a->lon;
+            }
         }
     }
 

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