forked from upstream-mirrors/OpenTracks
GPS data recording: remove idle/non-idle changes due to reported speed greater than 0.5mph.
This avoids that to storing GPS locations if the user r actually is not moving (likely bad GPS reception). Fixes #968. Co-authored-by: vlmendz <91810638+vlmendz@users.noreply.github.com> Co-authored-by: Dennis Guse <dennis.guse@alumni.tu-berlin.de>
This commit is contained in:
committed by
Dennis Guse
parent
2f7a56bb17
commit
083b620e41
+1
-21
@@ -252,13 +252,6 @@ public class TrackRecordingServiceTestLocation {
|
|||||||
.setSpeed(Speed.of(0))
|
.setSpeed(Speed.of(0))
|
||||||
.setAltitudeGain(0f)
|
.setAltitudeGain(0f)
|
||||||
.setAltitudeLoss(0f),
|
.setAltitudeLoss(0f),
|
||||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, null) //TODO Why is this added? Systems is idle and not moving at all.
|
|
||||||
.setLatitude(45)
|
|
||||||
.setLongitude(35)
|
|
||||||
.setHorizontalAccuracy(Distance.of(2))
|
|
||||||
.setSpeed(Speed.of(0))
|
|
||||||
.setAltitudeGain(0f)
|
|
||||||
.setAltitudeLoss(0f),
|
|
||||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, null)
|
new TrackPoint(TrackPoint.Type.TRACKPOINT, null)
|
||||||
.setLatitude(45)
|
.setLatitude(45)
|
||||||
.setLongitude(35)
|
.setLongitude(35)
|
||||||
@@ -305,20 +298,6 @@ public class TrackRecordingServiceTestLocation {
|
|||||||
.setSpeed(Speed.of(15))
|
.setSpeed(Speed.of(15))
|
||||||
.setAltitudeGain(0f)
|
.setAltitudeGain(0f)
|
||||||
.setAltitudeLoss(0f),
|
.setAltitudeLoss(0f),
|
||||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, null) //TODO Check why this trackPoint is inserted.
|
|
||||||
.setLatitude(45)
|
|
||||||
.setLongitude(35)
|
|
||||||
.setHorizontalAccuracy(Distance.of(2))
|
|
||||||
.setSpeed(Speed.of(0))
|
|
||||||
.setAltitudeGain(0f)
|
|
||||||
.setAltitudeLoss(0f),
|
|
||||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, null) //TODO Check why this trackPoint is inserted.
|
|
||||||
.setLatitude(45)
|
|
||||||
.setLongitude(35)
|
|
||||||
.setHorizontalAccuracy(Distance.of(5))
|
|
||||||
.setSpeed(Speed.of(0))
|
|
||||||
.setAltitudeGain(0f)
|
|
||||||
.setAltitudeLoss(0f),
|
|
||||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, null)
|
new TrackPoint(TrackPoint.Type.TRACKPOINT, null)
|
||||||
.setLatitude(45)
|
.setLatitude(45)
|
||||||
.setLongitude(35)
|
.setLongitude(35)
|
||||||
@@ -427,6 +406,7 @@ public class TrackRecordingServiceTestLocation {
|
|||||||
), trackPoints);
|
), trackPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated // Will be superseded when fixing #500
|
||||||
@MediumTest
|
@MediumTest
|
||||||
@Test
|
@Test
|
||||||
public void testOnLocationChangedAsync_idle_withSensorDistance() {
|
public void testOnLocationChangedAsync_idle_withSensorDistance() {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class TrackRecordingManager {
|
|||||||
private boolean currentSegmentHasTrackPoint;
|
private boolean currentSegmentHasTrackPoint;
|
||||||
private TrackPoint lastTrackPoint;
|
private TrackPoint lastTrackPoint;
|
||||||
private TrackPoint lastStoredTrackPoint;
|
private TrackPoint lastStoredTrackPoint;
|
||||||
private boolean isIdle;
|
|
||||||
|
|
||||||
TrackRecordingManager(Context context) {
|
TrackRecordingManager(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -101,7 +100,6 @@ class TrackRecordingManager {
|
|||||||
lastTrackPoint = null;
|
lastTrackPoint = null;
|
||||||
lastStoredTrackPoint = null;
|
lastStoredTrackPoint = null;
|
||||||
currentSegmentHasTrackPoint = false;
|
currentSegmentHasTrackPoint = false;
|
||||||
isIdle = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Track, Pair<TrackPoint, SensorDataSet>> get(TrackPointCreator trackPointCreator) {
|
Pair<Track, Pair<TrackPoint, SensorDataSet>> get(TrackPointCreator trackPointCreator) {
|
||||||
@@ -164,33 +162,15 @@ class TrackRecordingManager {
|
|||||||
if (distanceToLastTrackLocation.greaterThan(maxRecordingDistance)) {
|
if (distanceToLastTrackLocation.greaterThan(maxRecordingDistance)) {
|
||||||
trackPoint.setType(TrackPoint.Type.SEGMENT_START_AUTOMATIC);
|
trackPoint.setType(TrackPoint.Type.SEGMENT_START_AUTOMATIC);
|
||||||
insertTrackPoint(trackId, trackPoint);
|
insertTrackPoint(trackId, trackPoint);
|
||||||
|
|
||||||
isIdle = false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackPoint.hasSensorData() || distanceToLastTrackLocation.greaterOrEqualThan(recordingDistanceInterval)) {
|
if (trackPoint.hasSensorData() || (distanceToLastTrackLocation.greaterOrEqualThan(recordingDistanceInterval) && trackPoint.isMoving())) {
|
||||||
insertTrackPoint(trackId, trackPoint);
|
insertTrackPoint(trackId, trackPoint);
|
||||||
|
|
||||||
isIdle = false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isIdle && !trackPoint.isMoving()) {
|
|
||||||
insertTrackPoint(trackId, trackPoint);
|
|
||||||
|
|
||||||
isIdle = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isIdle && trackPoint.isMoving()) {
|
|
||||||
insertTrackPoint(trackId, trackPoint);
|
|
||||||
|
|
||||||
isIdle = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d(TAG, "Not recording TrackPoint, idle");
|
Log.d(TAG, "Not recording TrackPoint, idle");
|
||||||
lastTrackPoint = trackPoint;
|
lastTrackPoint = trackPoint;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user