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

Ensure set_gas_heater_temperature calls _set_regs with int #1

Closed davea closed 6 years ago

davea commented 6 years ago

When running the examples/read-all.py script I was seeing a crash because the value passed to write_i2c_block_data wasn't being converted to an int:

  File "/home/pi/tmp/bme680/library/bme680/__init__.py", line 281, in _set_regs
    self._i2c.write_i2c_block_data(self.i2c_addr, register, value)
TypeError: Third argument must be a list of at least one, but not more than 32 integers

This commit ensures set_gas_heater_temperature converts the temperature to an int before it's passed to self._set_regs.

Gadgetoid commented 6 years ago

Drat! Good catch, thank you! I need to watch out for any other instances of this. Although heater duration doesn't share the issue. I'll have to put out a new release of this today.

davea commented 6 years ago

Happy to help, thanks for the cool stuff you folks put out! 👍