[hamradio-commits] [dump1090] 112/389: VK1ET : Additions to check fflags

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Wed Nov 5 00:19:45 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 f77a85e8b8c96a38665f221cd7289f340d6442be
Author: Malcolm Robb <Support at ATTAvionics.com>
Date:   Fri Apr 26 09:49:53 2013 +0100

    VK1ET : Additions to check fflags
    
    Implement changes suggested by John/VK1ET
    
    Changes to cprNFunction to ensure fflag {was 'isodd'} is used as a flag.
    Fix to decodeCPRrelative to pass 'surface' flag.
---
 dump1090.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dump1090.c b/dump1090.c
index 2a32ea0..9244024 100644
--- a/dump1090.c
+++ b/dump1090.c
@@ -2338,14 +2338,14 @@ int cprNLFunction(double lat) {
     else return 1;
 }
 
-int cprNFunction(double lat, int isodd) {
-    int nl = cprNLFunction(lat) - isodd;
+int cprNFunction(double lat, int fflag) {
+    int nl = cprNLFunction(lat) - (fflag ? 1 : 0);
     if (nl < 1) nl = 1;
     return nl;
 }
 
-double cprDlonFunction(double lat, int isodd, int surface) {
-    return (surface ? 90.0 : 360.0) / cprNFunction(lat, isodd);
+double cprDlonFunction(double lat, int fflag, int surface) {
+    return (surface ? 90.0 : 360.0) / cprNFunction(lat, fflag);
 }
 
 /* This algorithm comes from:
@@ -2381,7 +2381,7 @@ void decodeCPR(struct aircraft *a, int fflag, int surface) {
         int ni = cprNFunction(rlat1,1);
         int m = (int) floor((((lon0 * (cprNLFunction(rlat1)-1)) -
                               (lon1 * cprNLFunction(rlat1))) / 131072.0) + 0.5);
-        a->lon = cprDlonFunction(rlat1,1,surface) * (cprModFunction(m,ni)+lon1/131072);
+        a->lon = cprDlonFunction(rlat1, 1, surface) * (cprModFunction(m, ni)+lon1/131072);
         a->lat = rlat1;
     } else {     // Use even packet.
         int ni = cprNFunction(rlat0,0);
@@ -2444,7 +2444,7 @@ int decodeCPRrelative(struct aircraft *a, int fflag, int surface, double latr, d
     }
 
     // Compute the Longitude Index "m"
-    AirDlon = cprDlonFunction(rlat, fflag, 0);
+    AirDlon = cprDlonFunction(rlat, fflag, surface);
     m = (int) (floor(lonr/AirDlon) +
                trunc(0.5 + cprModFunction((int)lonr, (int)AirDlon)/AirDlon - lon/131072));
     rlon = AirDlon * (m + lon/131072);

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