Add heater bit masks

This commit is contained in:
Marcus Kempe 2019-05-12 21:34:51 +02:00
parent 797aadaf26
commit c7629f106c

View file

@ -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