Move speed calculation before timeMoving detection

This commit is contained in:
sonora 2017-05-25 18:04:24 +02:00
parent c87db40e1a
commit 75a255f0ff

View file

@ -476,6 +476,11 @@ public class GPXUtilities {
point.distance = segmentDistance; point.distance = segmentDistance;
timeDiff = (int)((point.time - prev.time) / 1000); timeDiff = (int)((point.time - prev.time) / 1000);
//Last resort: Derive speed values from displacement if track does not originally contain speed
if (!hasSpeedInTrack && speed == 0 && timeDiff > 0) {
speed = calculations[0] / timeDiff;
}
// Motion detection: // Motion detection:
// speed > 0 uses GPS chipset's motion detection // speed > 0 uses GPS chipset's motion detection
// calculations[0] > minDisplacment * time is heuristic needed because tracks may be filtered at recording time, so points at rest may not be present in file at all // calculations[0] > minDisplacment * time is heuristic needed because tracks may be filtered at recording time, so points at rest may not be present in file at all
@ -489,11 +494,6 @@ public class GPXUtilities {
// timeMoving0 = timeMoving0 + (point.time - prev.time); // timeMoving0 = timeMoving0 + (point.time - prev.time);
// totalDistanceMoving0 += calculations[0]; // totalDistanceMoving0 += calculations[0];
// } // }
//Last resorz: Derive speed values from displacment if track does not originally contain speed
if (!hasSpeedInTrack && speed == 0 && timeDiff > 0) {
speed = calculations[0] / timeDiff;
}
} }
elevation1.time = timeDiff; elevation1.time = timeDiff;