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

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

@bradcar

Description

@bradcar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions