Skip to content

Commit

Permalink
Altitude calculation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatApo committed Aug 25, 2019
1 parent 2e53641 commit c52f867
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public Pressure(float measurement, int temperature) {
//int temperature = WeatherWidget.getSlptWeather().getTemperatureValueCelsius();
//int temperature = 15;
// Altitude conversion using hypsometric formula
this.altitude = (float) Math.round( ( Math.pow(this.airPressure/p0, 1/5.25579) - 1 )*(temperature+273.15)/0.0065 );
this.altitude = (float) Math.round( ( 1 - Math.pow(this.airPressure/p0, 1/5.25579) )*(temperature+273.15)/0.0065 );
}else{
// Dive depth mode
this.altitude = (float) - Math.round( measurement - p0 )/100;
Expand All @@ -28,7 +28,7 @@ public float getAltitude(int temperature) {
if( this.airPressure < 1200 ) { // less than 1.2m underwater
//int temperature = WeatherWidget.getSlptWeather().getTemperatureValueCelsius();
// Altitude conversion using hypsometric formula
this.altitude = (float) Math.round( ( Math.pow(this.airPressure/p0, 1/5.25579) - 1 )*(temperature+273.15)/0.0065 );
this.altitude = (float) Math.round( ( 1 - Math.pow(this.airPressure/p0, 1/5.25579) )*(temperature+273.15)/0.0065 );
}else{
// Dive depth mode
this.altitude = (float) - Math.round( this.airPressure - p0 )/100;
Expand Down

0 comments on commit c52f867

Please sign in to comment.