From c7629f106c26c9524906b0d2d247a0041f4bf130 Mon Sep 17 00:00:00 2001 From: Marcus Kempe Date: Sun, 12 May 2019 21:34:51 +0200 Subject: [PATCH] Add heater bit masks --- esphome/components/bme680/bme680.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esphome/components/bme680/bme680.cpp b/esphome/components/bme680/bme680.cpp index 5c48753ad8..1efc323a72 100644 --- a/esphome/components/bme680/bme680.cpp +++ b/esphome/components/bme680/bme680.cpp @@ -17,6 +17,8 @@ static const uint8_t BME680_REGISTER_CONTROL_GAS0 = 0x70; static const uint8_t BME680_REGISTER_HEATER_HEAT0 = 0x5A; static const uint8_t BME680_REGISTER_HEATER_WAIT0 = 0x64; +static const uint8_t BME680_RHRANGE_MSK = 0x30; +static const uint8_t BME680_RSERROR_MSK = 0xf0; static const uint8_t BME680_REGISTER_CHIPID = 0xD0; static const uint8_t BME680_REGISTER_FIELD0 = 0x1D; @@ -120,6 +122,9 @@ void BME680Component::setup() { this->mark_failed(); return; } + &this->calibration_res_heat_range &= BME680_RHRANGE_MSK; + &this->calibration_res_heat_range /= 16; + if (!this->read_byte(0x00, &this->calibration_.res_heat_val)) { this->mark_failed(); return; @@ -128,6 +133,8 @@ void BME680Component::setup() { this->mark_failed(); return; } + &this->calibration_.range_sw_err &= BME680_RSERROR_MSK; + &this->calibration_.range_sw_err /= 16; this->calibration_.ambient_temperature = 25; // prime ambient temperature