Fix incorrect minimum precision logic for track recording

OsmAnd 2.5 introduced an optional minimum precision for location when
recording tracks. When this is used, track points are only recorded if the
location accuracy at the time of sampling is within the minimum precision.

Logic in the code was inverted: points with accuracy below (i.e. within)
the minimum precision were rejected, and points with accuracy above the
minimum precision were accepted.

For example, if the minimum precision was set to 20 metres, all points with
an accuracy of 20 metres or under were incorrectly rejected.
This commit is contained in:
njohnston 2016-12-20 20:53:34 +00:00
parent 8a595efff0
commit 6cb4b0315c

View file

@ -375,7 +375,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
record = false;
}
float precision = settings.SAVE_TRACK_PRECISION.get();
if(precision > 0 && (!location.hasAccuracy() || location.getAccuracy() < precision)) {
if(precision > 0 && (!location.hasAccuracy() || location.getAccuracy() > precision)) {
record = false;
}
float minSpeed = settings.SAVE_TRACK_MIN_SPEED.get();