If maxrange is 0, we cannot do receiver-relative CPR at all.

This commit is contained in:
Oliver Jowett 2016-08-26 11:31:32 +01:00
parent 43906f994b
commit 308b928f8c

View file

@ -308,7 +308,9 @@ static int doLocalCPR(struct aircraft *a, struct modesMessage *mm, uint64_t now,
// 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 == 0) {
return (-1); // Can't do receiver-centered checks at all
} else if (Modes.maxRange <= 1852*180) {
range_limit = Modes.maxRange; range_limit = Modes.maxRange;
} else if (Modes.maxRange < 1852*360) { } else if (Modes.maxRange < 1852*360) {
range_limit = (1852*360) - Modes.maxRange; range_limit = (1852*360) - Modes.maxRange;