PUD: make sure horizontal distance is an absolute number
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Mar 2012 11:04:26 +0000 (12:04 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Mar 2012 11:04:49 +0000 (12:04 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/receiver.c

index 06610ec..613ac69 100644 (file)
@@ -471,7 +471,7 @@ static void detemineMovingFromPosition(PositionUpdateEntry * avg, PositionUpdate
                lastTxPos.lat = nmea_degree2radian(lastTx->nmeaInfo.lat);
                lastTxPos.lon = nmea_degree2radian(lastTx->nmeaInfo.lon);
 
-               hDistance = nmea_distance_ellipsoid(&avgPos, &lastTxPos, NULL, NULL);
+               hDistance = fabs(nmea_distance_ellipsoid(&avgPos, &lastTxPos, NULL, NULL));
                hDistanceValid = true;
        } else {
                hDistanceValid = false;