Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from bradcar/master
Browse files Browse the repository at this point in the history
Update bmp581.py correct altitude calc, and remove excessive rounding…
  • Loading branch information
jposada202020 authored Dec 1, 2024
2 parents a9f4a63 + 4953d5c commit fb6c6ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bmp581.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ def altitude(self):
With the measured pressure p and the absolute altitude the pressure at sea level
can be calculated too. See the altitude setter for this calculation
"""

# updated to Bosch’s formula in bmp180 datasheet, and eliminate excessive rounding of altitude
altitude = 44330.0 * (
1.0 - ((self.pressure / self.sea_level_pressure) ** 0.190284)
1.0 - ((self.pressure / self.sea_level_pressure) ** (1.0 / 5.255))
)
return round(altitude, 1)
return altitude

@altitude.setter
def altitude(self, value: float) -> None:
Expand Down

0 comments on commit fb6c6ef

Please sign in to comment.