private DirectionData.DeviceOrientation getDeviceOrientation(final DirectionData.DeviceOrientation devOr, final boolean applyDamping) {
        if (lastMeasuredOrientationSince < 0 || !Objects.equals(devOr, lastMeasuredOrientation)) {
            this.lastMeasuredOrientationSince = System.currentTimeMillis();
        }
        this.lastMeasuredOrientation = devOr;
        if (!applyDamping || System.currentTimeMillis() - this.lastMeasuredOrientationSince > 1000) {
            this.currentOrientation = devOr;
        }
        return this.currentOrientation;
    }
Helper for calculating orientation values as well as (corrected) direction
out of "raw" orientation vector and rotation matrix from one of the sensors
main/src/main/java/cgeo/geocaching/sensors/DirectionDataCalculator.java