VersBinarii / bme280-rs

A platform agnostic Rust driver for the Bosch BM[PE]-280
Other
59 stars 73 forks source link

Configure before calibrate (fix for uber-foo/bme280-rs#5) #8

Closed mbrossard closed 4 years ago

mbrossard commented 4 years ago

I hit the same issue as described in uber-foo/bme280-rs#5.

I looked at the calibration data and found that it was incorrect (if I remember correctly, dig_t1, dig_t2 and dig_t3 were all 0). I tried making calibrate() public and call it again if receiving Error::InvalidData. Except for the first call that was always failing, the next calls work.

I tried inverting the calibrate() and configure() calls and it worked as well, which seems to be the best solution. @Glaeqen, can you confirm if this fixes the issue for you?

gl4eqen commented 4 years ago

Thank you for your insight. Because of some reason I did not get notified that someone responded to my issue. I applied your changes and now it does not crash but I still get weird results. Result of calling sensor.measure():

temperature: 0,
pressure: 94403.3672,
humidity: 49.1812973,

I can provide Saelae Logic i2c sniffing dump if you need one.

gl4eqen commented 4 years ago

I think we can close this PR, as problem laid elsewhere.

mbrossard commented 4 years ago

It seems the real issue and fix was stm32-rs/stm32f4xx-hal#169 and this work-around just happened to work.