adafruit/Adafruit_BME280_Library

Switch control register setting order?

NJAldwin opened this issue · 1 comments

I was reading the BME280 datasheet, and it claims

Changes to this register [ctrl_hum] only become effective after a write operation to “ctrl_meas”.

(§5.4.4, page 25)

However, in the initialization code in this library, the following two lines are present:

  write8(BME280_REGISTER_CONTROL, 0x3F);
  write8(BME280_REGISTER_CONTROLHUMID, 0x03);

It would appear to me that those two lines should be switched, in order to first write the humidity options and then set the other options + confirm the humidity options.

I've attempted to test this locally, and it did appear to change the results; I don't have a great secondary humidity sensor to test it against, though.

I didn't see a significant difference in the output either way, but the datasheet does seem to imply we should write to CONTROL after a change to CONTROLHUMID. I just pushed a quick update with that, plus changing the pressure output values to hPa in the sample sketch, and tagged it as release 1.0.1. Thanks for the heads up here.