Fixed compass update time not getting updated

This commit is contained in:
Bharath MG
2018-12-13 10:57:23 +05:30
committed by Łukasz Paczos
parent e84748c170
commit 25286011e5

View File

@@ -127,9 +127,6 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen
if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
rotationVectorValue = getRotationVectorFromSensorEvent(event);
updateOrientation();
// Update the compassUpdateNextTimestamp
compassUpdateNextTimestamp = currentTime + LocationComponentConstants.COMPASS_UPDATE_RATE_MS;
} else if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
notifyCompassChangeListeners((event.values[0] + 360) % 360);
} else if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
@@ -139,6 +136,9 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen
magneticValues = lowPassFilter(getRotationVectorFromSensorEvent(event), magneticValues);
updateOrientation();
}
// Update the compassUpdateNextTimestamp
compassUpdateNextTimestamp = currentTime + LocationComponentConstants.COMPASS_UPDATE_RATE_MS;
}
@Override