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

constants don't match Bosch-version #42

Open bablokb opened 3 years ago

bablokb commented 3 years ago

I forked this repo quite some time ago and started porting it to the BME688. I mainly came up with the same set of changes as you now. But when I started to compare all the constants, I noted a number of differences.

E.g. you have

COEFF_SIZE = 41
COEFF_ADDR1_LEN = 25
COEFF_ADDR2_LEN = 16

# Coefficient's address
COEFF_ADDR1 = 0x89
COEFF_ADDR2 = 0xe1

and Bosch has

#define BME68X_LEN_COEFF1                         UINT8_C(23)
#define BME68X_LEN_COEFF2                         UINT8_C(14)

#define BME68X_REG_COEFF1                         UINT8_C(0x8a)
#define BME68X_REG_COEFF2                         UINT8_C(0xe1)

(Bosch also reads and processes a third set of coefficients).

So this stopped me from going on (there are more differences, e.g. in the array-indices, and it would need way more time to figure out where and how all those constants are used). I also ran a program with the Bosch-Code and with my code (which is almost identical to your code) and the results did not match.

All of this is not really related to the BME688, at least Bosch claims their BME68x code works with both sensors. So I wonder if the python-bme680-package has ever produced correct results or if Bosch is wrong.