pimoroni / bme680-python

Python library for the BME680 gas, temperature, humidity and pressure sensor.
https://shop.pimoroni.com/products/bme680
MIT License
260 stars 93 forks source link

Fix reassignment of variable in pressure calculation algo #5

Closed gkluoe closed 6 years ago

gkluoe commented 6 years ago

Found it! I'm not 100% sure what's going on here, but I think the problem is that you reassigned var1 but the last part of the calculation relied on its original value.

With this patch I get matching values from the C and the Python.

jorisvervuurt commented 6 years ago

Nice! I'll run a test tomorrow.

Gadgetoid commented 6 years ago

@gkluoe you are my favourite person right now.

You'll never believe it, but I was looking into this yesterday and was having a hard enough time finding a BME680 that even works. Apparently we've sold or hoarded them all somewhere.

@jorisvervuurt if you confirm this works, and the Python 2/3 issues are squashed then I'll push out a new release ASAP.

jorisvervuurt commented 6 years ago

Before installing the fixed version, pressure was measured to be ~1018 hPa while it should measure ~1006 hPa. After installing the fixed version, it measures ~1004 hPa and it now also works in Python 3.

I think it's safe to say that @gkluoe has fixed the problem!