PUD: make sure horizontal distance is an absolute number
[olsrd.git] / 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);
 
                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;
                hDistanceValid = true;
        } else {
                hDistanceValid = false;