From 16d22e28d259fb1722f31dab6d1d9c0af66c371a Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Wed, 27 Dec 2017 16:33:40 +0100 Subject: [PATCH] LP-572 Change the setCoord() threshold from 11m to 21cm --- .../src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp index c256f56b2..c559957b9 100644 --- a/ground/gcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp +++ b/ground/gcs/src/libs/opmapcontrol/src/mapwidget/waypointitem.cpp @@ -29,6 +29,8 @@ #include "homeitem.h" #include +#define COORDINATES_THRESHOLD 0.000002 // ~21cm + namespace mapcontrol { WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(""), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type) { @@ -259,7 +261,9 @@ void WayPointItem::setRelativeCoord(distBearingAltitude value) void WayPointItem::SetCoord(const internals::PointLatLng &value) { - if (qAbs(Coord().Lat() - value.Lat()) < 0.0001 && qAbs(Coord().Lng() - value.Lng()) < 0.0001) { + // If no changes from previous coordinates, return. + if ((qAbs(Coord().Lat() - value.Lat()) < COORDINATES_THRESHOLD) && + (qAbs(Coord().Lng() - value.Lng()) < COORDINATES_THRESHOLD)) { return; } coord = value;