Skip to content

Commit b96dcdb

Browse files
committed
Enable/disable gas heater for #38
1 parent 027575c commit b96dcdb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

library/bme680/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ def get_gas_heater_profile(self):
183183
"""Get gas sensor conversion profile: 0 to 9."""
184184
return self._get_regs(constants.CONF_ODR_RUN_GAS_NBC_ADDR, 1) & constants.NBCONV_MSK
185185

186+
def set_gas_heater_status(self, value):
187+
"""Enable/disable gas heater."""
188+
self.gas_settings.heater = value
189+
self._set_bits(constants.CONF_HEAT_CTRL_ADDR, constants.HCTRL_MSK, constants.HCTRL_POS, value)
190+
191+
def get_gas_heater_status(self):
192+
"""Get current heater status."""
193+
return (self._get_regs(constants.CONF_HEAT_CTRL_ADDR, 1) & constants.HCTRL_MSK) >> constants.HCTRL_POS
194+
186195
def set_gas_status(self, value):
187196
"""Enable/disable gas sensor."""
188197
self.gas_settings.run_gas = value

library/bme680/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
OST_POS = 5
166166
OSP_POS = 2
167167
OSH_POS = 0
168+
HCTRL_POS = 3
168169
RUN_GAS_POS = 4
169170
MODE_POS = 0
170171
NBCONV_POS = 0

0 commit comments

Comments
 (0)