If maxRange is >= 360NM, don't do receiver-centered local CPR at all.

This commit is contained in:
Oliver Jowett 2015-02-11 12:10:40 +00:00
parent 7849e1019d
commit 967a3e9558

View file

@ -198,8 +198,12 @@ static int doLocalCPR(struct aircraft *a, int fflag, int surface, uint64_t now)
// ambiguity. (e.g. if we receive a position report // ambiguity. (e.g. if we receive a position report
// at 200NM distance, this may resolve to a position // at 200NM distance, this may resolve to a position
// at (200-360) = 160NM in the wrong direction) // at (200-360) = 160NM in the wrong direction)
if (Modes.maxRange > 1852*180)
if (Modes.maxRange > 1852*180) {
range_limit = (1852*360) - Modes.maxRange; range_limit = (1852*360) - Modes.maxRange;
if (range_limit <= 0)
return (-1); // Can't do receiver-centered checks at all
}
} else { } else {
// No local reference, give up // No local reference, give up
return (-1); return (-1);