Skip to content

Ensure set_gas_heater_temperature calls _set_regs with int#1

Merged
Gadgetoid merged 1 commit intopimoroni:masterfrom
davea:patch-1
Oct 18, 2017
Merged

Ensure set_gas_heater_temperature calls _set_regs with int#1
Gadgetoid merged 1 commit intopimoroni:masterfrom
davea:patch-1

Conversation

@davea
Copy link
Contributor

@davea davea commented Oct 18, 2017

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.

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 Gadgetoid merged commit 8863492 into pimoroni:master Oct 18, 2017
@Gadgetoid
Copy link
Member

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.

@Gadgetoid Gadgetoid added the bug label Oct 18, 2017
@Gadgetoid Gadgetoid modified the milestones: v0.0.3, v1.0.2 Oct 18, 2017
@davea
Copy link
Contributor Author

davea commented Oct 18, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants