Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdece4bb authored by Mathias Agopian's avatar Mathias Agopian
Browse files

resolved conflicts for merge of dfce290b to master

Change-Id: I9caace962cb0a697dd99ed92c5f35e57690fdf91
parents ce49d03a dfce290b
Loading
Loading
Loading
Loading
+30 −7
Original line number Diff line number Diff line
@@ -268,6 +268,10 @@ public class SensorManager
    public static final float MAGNETIC_FIELD_EARTH_MIN = 30.0f;


    /** Standard atmosphere, or average sea-level pressure in hPa (millibar) */
    public static final float PRESSURE_STANDARD_ATMOSPHERE = 1013.25f;


    /** Maximum luminance of sunlight in lux */
    public static final float LIGHT_SUNLIGHT_MAX = 120000.0f;
    /** luminance of sunlight in lux */
@@ -1514,6 +1518,25 @@ public class SensorManager
        return values;
    }

    /**
     * Computes the Altitude in meters from the atmospheric pressure and the
     * pressure at sea level.
     * <p>
     * Typically the atmospheric pressure is read from a
     * {@link Sensor#TYPE_PRESSURE} sensor. The pressure at sea level must be
     * known, usually it can be retrieved from airport databases in the
     * vicinity.
     * </p>
     *
     * @param p0 pressure at sea level
     * @param p atmospheric pressure
     * @return Altitude in meters
     */
   public static float getAltitude(float p0, float p) {
        final float coef = 1.0f / 5.255f;
        return 44330.0f * (1.0f - (float)Math.pow(p/p0, coef));
    }


   /**
     * {@hide}