mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 01:53:05 +02:00
@@ -56,7 +56,7 @@ public class TrackPoint {
|
||||
|
||||
SEGMENT_START_AUTOMATIC(-1), //Start of a segment due to too much distance from previous TrackPoint
|
||||
TRACKPOINT(0), //Just GPS data and may contain BLE sensor data
|
||||
SENSORPOINT(2), //Just BLE sensor data; required to have speed and sensorDistance
|
||||
SENSORPOINT(2), //Just BLE sensor data; may have speed and sensorDistance
|
||||
|
||||
SEGMENT_END_MANUAL(1); //End of a segment
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.util.Pair;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneOffset;
|
||||
|
||||
import de.dennisguse.opentracks.R;
|
||||
@@ -180,8 +181,16 @@ class TrackRecordingManager implements SharedPreferences.OnSharedPreferenceChang
|
||||
}
|
||||
|
||||
if (!trackPoint.hasLocation() && !trackPoint.hasSensorDistance()) {
|
||||
Log.d(TAG, "Ignoring TrackPoint as it has no distance.");
|
||||
return false;
|
||||
Duration minStorageInterval = Duration.ofSeconds(10); // TODO Should be configurable.
|
||||
boolean shouldStore = lastStoredTrackPoint.getTime().plus(minStorageInterval)
|
||||
.isBefore(trackPoint.getTime());
|
||||
if (!shouldStore) {
|
||||
Log.d(TAG, "Ignoring TrackPoint as it has no distance (and sensor data is not new enough).");
|
||||
return false;
|
||||
} else {
|
||||
insertTrackPoint(trackPoint, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Distance distanceToLastStoredTrackPoint;
|
||||
|
||||
Reference in New Issue
Block a user