Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in altitude calculation, and over agressive rounding round(altitude, 1) #1

Open
bradcar opened this issue Nov 22, 2024 · 0 comments

Comments

@bradcar
Copy link

bradcar commented Nov 22, 2024

In your code for altitude you have
altitude = 44330.0 * (
1.0 - ((self.pressure / self.sea_level_pressure) ** 0.190284)
)
return round(altitude, 1)
In the Bosch Sensor guide (ex: in bmp180 they show a different formula page 16 of: https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf).
Since you are raising the difference in pressure & SLP to a power small differences can make a difference.

Consider this return value instead, because it eliminates the over rounding of altitude limits accuracy to 100cm on device capable of a couple of centimeters:
altitude = 44330.0 * (
1.0 - ((self.pressure / self.sea_level_pressure) ** (1.0 / 5.255))
)
return altitude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant